Changeset 1699


Ignore:
Timestamp:
Jan 8, 2007, 1:16:10 AM (17 years ago)
Author:
rub
Message:

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.

Location:
trunk
Files:
23 added
16 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/admin.php

    r1682 r1699  
    5555// +-----------------------------------------------------------------------+
    5656
    57 if (isset($_GET['page'])
     57unset($page['page']);
     58
     59if
     60  (
     61    isset($_GET['page'])
    5862    and preg_match('/^[a-z_]*$/', $_GET['page'])
    59     and is_file(PHPWG_ROOT_PATH.'admin/'.$_GET['page'].'.php'))
    60 {
    61   $page['page'] = $_GET['page'];
    62 }
    63 else
    64 {
    65   $page['page'] = 'intro';
     63  )
     64{
     65  if
     66    (
     67      (!isset($_GET['page_type']) or $_GET['page_type'] == 'standard')
     68      and is_file(PHPWG_ROOT_PATH.'admin/'.$_GET['page'].'.php')
     69    )
     70  {
     71    $page['page']['type'] = 'standard';
     72    $page['page']['name'] = $_GET['page'];
     73  }
     74  else if
     75    (
     76      (isset($_GET['page_type']) and $_GET['page_type'] == 'plugin')
     77      and isset($_GET['plugin_id'])
     78      and preg_match('/^[a-z_]*$/', $_GET['plugin_id'])
     79      and is_file(PHPWG_PLUGINS_PATH.$_GET['plugin_id'].'/admin/'.$_GET['page'].'.php')
     80    )
     81  {
     82    if (function_exists('mysql_real_escape_string'))
     83    {
     84      $page['page']['plugin_id'] = mysql_real_escape_string($_GET['plugin_id']);
     85    }
     86    else
     87    {
     88      $page['page']['plugin_id'] = mysql_escape_string($_GET['plugin_id']);
     89    }
     90
     91    $check_db_plugin = get_db_plugins('', $page['page']['plugin_id']);
     92    if (!empty($check_db_plugin))
     93    {
     94      $page['page']['type'] = $_GET['page_type'];
     95      $page['page']['name'] = $_GET['page'];
     96    }
     97    else
     98    {
     99      unset($page['page']);
     100    }
     101    unset($check_db_plugin);
     102  }
     103}
     104
     105if (!isset($page['page']))
     106{
     107  if (isset($_GET['page_type']) and $_GET['page_type'] == 'plugin')
     108  {
     109    $page['page']['type'] = 'standard';
     110    $page['page']['name'] = 'plugins';
     111  }
     112  else
     113  {
     114    $page['page']['type'] = 'standard';
     115    $page['page']['name'] = 'intro';
     116  }
    66117}
    67118
     
    136187trigger_action('plugin_admin_menu');
    137188
    138 include(PHPWG_ROOT_PATH.'admin/'.$page['page'].'.php');
     189switch($page['page']['type'])
     190{
     191  case 'standard':
     192  {
     193    include(PHPWG_ROOT_PATH.'admin/'.$page['page']['name'].'.php');
     194    break;
     195  }
     196  case 'plugin':
     197  {
     198    include(PHPWG_PLUGINS_PATH.$page['page']['plugin_id'].'/admin/'.$page['page']['name'].'.php');
     199    break;
     200  }
     201  default:
     202  {
     203    die ("Hacking attempt!");
     204    break;
     205  }
     206}
     207
    139208
    140209//------------------------------------------------------------- content display
  • trunk/admin/advanced_feature.php

    r1688 r1699  
    33// | PhpWebGallery - a PHP based picture gallery                           |
    44// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
    5 // | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
     5// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
    66// +-----------------------------------------------------------------------+
    77// | branch        : BSF (Best So Far)
     
    3737
    3838// +-----------------------------------------------------------------------+
    39 // |                                actions                                |
     39// | Actions                                                               |
    4040// +-----------------------------------------------------------------------+
    4141
     
    5555
    5656// +-----------------------------------------------------------------------+
    57 // |                             template init                             |
     57// | Define advanced features                                              |
     58// +-----------------------------------------------------------------------+
     59
     60$advanced_features = array();
     61
     62// Add advanced features
     63/*array_push($advanced_features,
     64  array
     65  (
     66    'CAPTION' => l10n('???'),
     67    'URL' => $start_url.'???'
     68  ));*/
     69
     70array_push($advanced_features,
     71  array
     72  (
     73    'CAPTION' => l10n('Elements_not_linked'),
     74    'URL' => get_root_url().'admin.php?page=element_set&cat=not_linked'
     75  ));
     76
     77array_push($advanced_features,
     78  array
     79  (
     80    'CAPTION' => l10n('Duplicates'),
     81    'URL' => get_root_url().'admin.php?page=element_set&cat=duplicates'
     82  ));
     83
     84//$advanced_features is array of array composed of CAPTION & URL
     85$advanced_features =
     86    trigger_event('array_advanced_features', $advanced_features);
     87
     88// +-----------------------------------------------------------------------+
     89// |  Template init                                                        |
    5890// +-----------------------------------------------------------------------+
    5991
    6092$template->set_filenames(array('advanced_feature'=>'admin/advanced_feature.tpl'));
    6193
    62 $start_url = PHPWG_ROOT_PATH.'admin.php?page=advanced_feature&action=';
     94$start_url = get_root_url().'admin.php?page=advanced_feature&action=';
    6395
    6496$template->assign_vars(
    65   array(
    66 //    'U_ADV_????' => $start_url.'???',
    67     'U_ADV_ELEMENT_NOT_LINKED' => PHPWG_ROOT_PATH.'admin.php?page=element_set&cat=not_linked',
    68     'U_ADV_DUP_FILES' => PHPWG_ROOT_PATH.'admin.php?page=element_set&cat=duplicates',
    69     'U_HELP' => PHPWG_ROOT_PATH.'popuphelp.php?page=advanced_feature'
    70     )
    71   );
     97  array
     98  (
     99    'U_HELP' => get_root_url().'popuphelp.php?page=advanced_feature'
     100  ));
     101
     102// advanced_features
     103if (count($advanced_features) > 0)
     104{
     105  foreach ($advanced_features as $advanced_feature)
     106  {
     107    $template->assign_block_vars('advanced_features.advanced_feature', $advanced_feature);
     108  }
     109}
    72110
    73111// +-----------------------------------------------------------------------+
    74 // |                           sending html code                           |
     112// | Sending html code                                                     |
    75113// +-----------------------------------------------------------------------+
    76114
    77115$template->assign_var_from_handle('ADMIN_CONTENT', 'advanced_feature');
     116
    78117?>
  • trunk/admin/include/functions_notification_by_mail.inc.php

    r1679 r1699  
    255255    // language files
    256256    include(get_language_filepath('common.lang.php'));
    257     @include(get_language_filepath('local.lang.php'));
    258257    // No test admin because script is checked admin (user selected no)
    259258    // Translations are in admin file too
    260259    include(get_language_filepath('admin.lang.php'));
     260    trigger_action('loading_lang');
     261    @include(get_language_filepath('local.lang.php'));
    261262  }
    262263}
  • trunk/admin/plugins.php

    r1655 r1699  
    4343if ( isset($_REQUEST['action']) and isset($_REQUEST['plugin'])  )
    4444{
    45   $plugin_id = $_REQUEST['plugin'];
     45  if (function_exists('mysql_real_escape_string'))
     46  {
     47    $plugin_id = mysql_real_escape_string($_REQUEST['plugin']);
     48  }
     49  else
     50  {
     51    $plugin_id = mysql_escape_string($_REQUEST['plugin']);
     52  }
     53
    4654  $crt_db_plugin = get_db_plugins('', $plugin_id);
    4755  if (!empty($crt_db_plugin))
  • trunk/admin/site_manager.php

    r1654 r1699  
    206206
    207207$template->assign_vars( array(
    208   'U_HELP' => PHPWG_ROOT_PATH.'popuphelp.php?page=remote_site',
     208  'U_HELP' => PHPWG_ROOT_PATH.'popuphelp.php?page=site_manager',
    209209  'F_ACTION' => PHPWG_ROOT_PATH.'admin.php'
    210210                .get_query_string_diff( array('action','site') )
     
    294294        );
    295295  }
     296 
     297  $plugin_links = array();
     298  //$plugin_links is array of array composed of U_HREF, U_HINT & U_CAPTION
     299  $plugin_links =
     300    trigger_event('array_site_manager_plugin_links',
     301      $plugin_links, $row['id'], $is_remote);
     302
     303  // plugin_links
     304  if (count($plugin_links) > 0)
     305  {
     306    foreach ($plugin_links as $plugin_link)
     307    {
     308      $template->assign_block_vars('sites.site.plugin_links.plugin_link', $plugin_link);
     309    }
     310  }
     311
    296312}
    297313
  • trunk/include/common.inc.php

    r1692 r1699  
    150150  include_once(get_language_filepath('admin.lang.php'));
    151151}
     152trigger_action('loading_lang');
    152153@include_once(get_language_filepath('local.lang.php'));
    153154
  • trunk/include/functions.inc.php

    r1690 r1699  
    641641    $user = build_user( $conf['guest_id'], true);
    642642    include_once(get_language_filepath('common.lang.php'));
     643    trigger_action('loading_lang');
    643644    @include_once(get_language_filepath('local.lang.php'));
    644645    list($tmpl, $thm) = explode('/', $conf['default_template']);
  • trunk/include/functions_plugins.inc.php

    r1616 r1699  
    3434*/
    3535
    36 define('PHPWG_PLUGINS_PATH',PHPWG_ROOT_PATH.'plugins/');
     36define('PHPWG_PLUGINS_PATH', PHPWG_ROOT_PATH.'plugins/');
    3737
    3838define('EVENT_HANDLER_PRIORITY_NEUTRAL', 50);
  • trunk/include/functions_user.inc.php

    r1677 r1699  
    822822 *
    823823 * @param string filename
     824 * @param string dirname
    824825 * @return string filepath
    825826 */
    826 function get_language_filepath($filename)
     827function get_language_filepath($filename, $dirname = '')
    827828{
    828829  global $user, $conf;
     830
     831  if (empty($dirname))
     832  {
     833    $dirname = PHPWG_ROOT_PATH;
     834  }
     835  $dirname .= 'language'.'/';
    829836
    830837  $directories = array();
    831838  if ( isset($user['language']) )
    832839  {
    833     $directories[] = PHPWG_ROOT_PATH.'language/'.$user['language'];
    834   }
    835   $directories[] = PHPWG_ROOT_PATH.'language/'.$conf['default_language'];
    836   $directories[] = PHPWG_ROOT_PATH.'language/'.PHPWG_DEFAULT_LANGUAGE;
     840    $directories[] = $dirname.$user['language'];
     841  }
     842  $directories[] = $dirname.$conf['default_language'];
     843  $directories[] = $dirname.PHPWG_DEFAULT_LANGUAGE;
    837844
    838845  foreach ($directories as $directory)
  • trunk/language/en_UK.iso-8859-1/help/advanced_feature.html

    r1688 r1699  
    11<h2>Advanced features</h2>
    22
    3 <p>List special functionnalties for expert PWG administrator.</p>
     3<p>List special functionnalties for expert PWG administrator:</p>
    44
    55<ul>
  • trunk/language/fr_FR.iso-8859-1/help/advanced_feature.html

    r1688 r1699  
    11<h2>Fonctions avancées</h2>
    22
    3 <p>Liste des fonctionnalités spéciales pour les administrateurs experts de PWG.</p>
     3<p>Liste des fonctionnalités spéciales pour les administrateurs experts de PWG:</p>
    44
    55<ul>
    66
    77  <li>
    8     <strong>Eléments non liés :</strong>
     8    <strong>Eléments non liés:</strong>
    99    Affiche les images qui ne sont pas associées à une catégorie virtuelle
    1010  </li>
    1111  <li>
    12     <strong>Fichiers portant le même nom dans plusieurs catégories physiques :</strong>
     12    <strong>Fichiers portant le même nom dans plusieurs catégories physiques:</strong>
    1313    Affiche les images ou les éventuels fichiers qui pourraient être trouvés dans plusieurs catégories.
    1414  </li>
  • trunk/nbm.php

    r1118 r1699  
    3636// Translations are in admin file too
    3737include(get_language_filepath('admin.lang.php'));
     38// Need to update a second time
     39trigger_action('loading_lang');
     40@include(get_language_filepath('local.lang.php'));
     41
    3842
    3943// +-----------------------------------------------------------------------+
  • trunk/plugins/admin_advices/main.inc.php

    r1694 r1699  
    1414  // This Plugin works only on the Admin page
    1515  if ( isset($page['body_id']) and $page['body_id']=='theAdminPage'
    16     and isset($page['page']) and $page['page'] == 'intro' )
     16    and isset($page['page']['name']) and $page['page']['name'] == 'intro'
     17    and isset($page['page']['type']) and $page['page']['type'] == 'standard'
     18    )
    1719  {
    1820  // Setup Advice Language (Maybe there is already a variable) 
  • trunk/popuphelp.php

    r1072 r1699  
    4343include(PHPWG_ROOT_PATH.'include/page_header.php');
    4444
    45 $template->set_filenames(
    46   array(
    47     'help_content' => get_language_filepath('help/'.$_GET['page'].'.html')
    48     )
    49   );
     45if
     46  (
     47    isset($_GET['page'])
     48    and preg_match('/^[a-z_]*$/', $_GET['page'])
     49  )
     50{
     51  $help_content =
     52    @file_get_contents(get_language_filepath('help/'.$_GET['page'].'.html'));
     53
     54  if ($help_content == false)
     55  {
     56    $help_content = '';
     57  }
     58
     59  $help_content = trigger_event(
     60    'get_popup_help_content', $help_content, $_GET['page']);
     61}
     62else
     63{
     64  die('Hacking attempt!');
     65}
    5066
    5167$template->set_filenames(array('popuphelp' => 'popuphelp.tpl'));
    5268
    53 $template->assign_var_from_handle('HELP_CONTENT', 'help_content');
     69$template->assign_vars(
     70  array
     71  (
     72    'HELP_CONTENT' => $help_content
     73  ));
    5474
    5575// +-----------------------------------------------------------------------+
     
    6080
    6181include(PHPWG_ROOT_PATH.'include/page_tail.php');
     82
    6283?>
  • trunk/template/yoga/admin/advanced_feature.tpl

    r1688 r1699  
    88
    99<ul>
    10 <!--  <li><a href="{U_ADV_????}" {TAG_INPUT_ENABLED}>{lang:update categories informations}</a></li>-->
    11   <li><a href="{U_ADV_ELEMENT_NOT_LINKED}" {TAG_INPUT_ENABLED}>{lang:Elements_not_linked}</a></li>
    12   <li><a href="{U_ADV_DUP_FILES}" {TAG_INPUT_ENABLED}>{lang:Duplicates}</a></li>
     10  <!-- BEGIN advanced_features -->
     11    <!-- BEGIN advanced_feature -->
     12      <li><a href="{advanced_features.advanced_feature.URL}" {TAG_INPUT_ENABLED}>{advanced_features.advanced_feature.CAPTION}</a></li>
     13    <!-- END advanced_feature -->
     14  <!-- END advanced_features -->
    1315</ul>
  • trunk/template/yoga/admin/site_manager.tpl

    r1458 r1699  
    5151      [<a href="{sites.site.remote.U_CLEAN}" title="{lang:remote_site_clean_hint}" {TAG_INPUT_ENABLED}>{lang:remote_site_clean}</a>]
    5252    <!-- END remote -->
     53    <!-- BEGIN plugin_links -->
     54        <br>
     55      <!-- BEGIN plugin_link -->
     56        [<a href="{sites.site.plugin_links.plugin_link.U_HREF}" title='{sites.site.plugin_links.plugin_link.U_HINT}' {TAG_INPUT_ENABLED}>{sites.site.plugin_links.plugin_link.U_CAPTION}</a>]
     57      <!-- END plugin_link -->
     58    <!-- END plugin_links -->
    5359  </td></tr>
    5460  <!-- END site -->
Note: See TracChangeset for help on using the changeset viewer.