Ignore:
Timestamp:
Apr 18, 2010, 8:59:37 PM (14 years ago)
Author:
nikrou
Message:

Bug 1617 fixed : help page is displayed in current theme in public or admin pages

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/admin/popuphelp.php

    r5917 r5920  
    2222// +-----------------------------------------------------------------------+
    2323
    24 if (!defined('PHPWG_ROOT_PATH'))
    25 {
    26   die('Hacking attempt!');
    27 }
     24// +-----------------------------------------------------------------------+
     25// |                           initialization                              |
     26// +-----------------------------------------------------------------------+
    2827
    29 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
     28define('PHPWG_ROOT_PATH', '../');
     29define('PWG_HELP', true);
     30define('IN_ADMIN', true);
     31include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
    3032
    3133// +-----------------------------------------------------------------------+
     
    3436check_status(ACCESS_ADMINISTRATOR);
    3537
     38$page['body_id'] = 'thePopuphelpPage';
     39$title = l10n('Piwigo Help');
     40$page['page_banner'] = '<h1>'.$title.'</h1>';
     41$page['meta_robots']=array('noindex'=>1, 'nofollow'=>1);
     42include(PHPWG_ROOT_PATH.'include/page_header.php');
     43
     44if
     45  (
     46    isset($_GET['page'])
     47    and preg_match('/^[a-z_]*$/', $_GET['page'])
     48  )
     49{
     50  $help_content =
     51    load_language('help/'.$_GET['page'].'.html', '', array('return'=>true) );
     52
     53  if ($help_content == false)
     54  {
     55    $help_content = '';
     56  }
     57
     58  $help_content = trigger_event(
     59    'get_popup_help_content', $help_content, $_GET['page']);
     60}
     61else
     62{
     63  die('Hacking attempt!');
     64}
     65
     66$template->set_filename('popuphelp','popuphelp.tpl');
     67
     68$template->assign(
     69  array
     70  (
     71    'HELP_CONTENT' => $help_content
     72  ));
     73
    3674// +-----------------------------------------------------------------------+
    37 // |                               functions                               |
     75// |                           html code display                           |
    3876// +-----------------------------------------------------------------------+
    3977
     78$template->pparse('popuphelp');
    4079
    41 // +-----------------------------------------------------------------------+
    42 // |                          categories movement                          |
    43 // +-----------------------------------------------------------------------+
     80include(PHPWG_ROOT_PATH.'include/page_tail.php');
    4481
    45 if (isset($_POST['submit']))
    46 {
    47   if (count($_POST['selection']) > 0)
    48   {
    49     // TODO: tests
    50     move_categories($_POST['selection'], $_POST['parent']);
    51   }
    52   else
    53   {
    54     array_push(
    55       $page['errors'],
    56       l10n('Select at least one category')
    57       );
    58   }
    59 }
    60 
    61 // +-----------------------------------------------------------------------+
    62 // |                       template initialization                         |
    63 // +-----------------------------------------------------------------------+
    64 $template->set_filename('cat_move', 'cat_move.tpl');
    65 
    66 $template->assign(
    67   array(
    68     'U_HELP' => PHPWG_ROOT_PATH.'popuphelp.php?page=cat_move',
    69     'F_ACTION' => PHPWG_ROOT_PATH.'admin.php?page=cat_move',
    70     )
    71   );
    72  
    73 // +-----------------------------------------------------------------------+
    74 // |                          Categories display                           |
    75 // +-----------------------------------------------------------------------+
    76 
    77 $query = '
    78 SELECT id,name,uppercats,global_rank
    79   FROM '.CATEGORIES_TABLE.'
    80   WHERE dir IS NULL
    81 ;';
    82 display_select_cat_wrapper(
    83   $query,
    84   array(),
    85   'category_to_move_options'
    86   );
    87 
    88 $query = '
    89 SELECT id,name,uppercats,global_rank
    90   FROM '.CATEGORIES_TABLE.'
    91 ;';
    92 
    93 display_select_cat_wrapper(
    94   $query,
    95   array(),
    96   'category_parent_options'
    97   );
    98 
    99 // +-----------------------------------------------------------------------+
    100 // |                          sending html code                            |
    101 // +-----------------------------------------------------------------------+
    102 
    103 $template->assign_var_from_handle('ADMIN_CONTENT', 'cat_move');
    10482?>
Note: See TracChangeset for help on using the changeset viewer.