source: extensions/TakeATour/main.inc.php @ 28097

Last change on this file since 28097 was 28097, checked in by flop25, 10 years ago

every steps move to lang file
script debugged/enhanced

File size: 3.2 KB
Line 
1<?php
2/*
3Plugin Name: Take A Tour of Your Piwigo
4Version: 1.0
5Description: Plugin Personnel
6Plugin URI: http://piwigo.org
7Author:Piwigo Team
8Author URI:
9*/
10if (!defined('PHPWG_ROOT_PATH'))
11{
12  die('Hacking attempt!');
13}
14
15$avalaible_tour = array('first_contact', 'privacy', 'picture_protection');
16
17if ( isset($_POST['submited_tour']) and in_array($_POST['submited_tour'], $avalaible_tour) and defined('IN_ADMIN') and IN_ADMIN )
18{
19  pwg_set_session_var('tour_to_launch', $_POST['submited_tour']);
20  global $TAT_restart;
21  $TAT_restart=true;
22}
23elseif ( isset($_GET['tour_ended']) and in_array($_GET['tour_ended'], $avalaible_tour) and defined('IN_ADMIN') and IN_ADMIN )
24{
25  pwg_unset_session_var('tour_to_launch');
26}
27
28if (pwg_get_session_var('tour_to_launch') and defined('IN_ADMIN') and IN_ADMIN and isset($_GET['page']) and $_GET['page']=="plugin-TakeATour" )
29{ 
30  pwg_unset_session_var('tour_to_launch');
31}
32elseif ( pwg_get_session_var('tour_to_launch') and defined('IN_ADMIN') and IN_ADMIN)
33{
34  global $conf;
35  if ((isset($conf['TakeATour_tour_ignored']) and !in_array(pwg_get_session_var('tour_to_launch'), $conf['TakeATour_tour_ignored'])) or !isset($conf['TakeATour_tour_ignored']))
36  {
37      add_event_handler('init', 'TAT_add_js_css');
38      include('tours/'.pwg_get_session_var('tour_to_launch').'/config.inc.php');
39  }
40}
41
42function TAT_add_js_css()
43{
44  global $template, $TAT_restart;
45  $tour_to_launch=pwg_get_session_var('tour_to_launch');
46  load_language('plugin.lang', PHPWG_PLUGINS_PATH .'TakeATour/');
47  $template->set_filename('TAT_js_css', PHPWG_PLUGINS_PATH.'TakeATour/tpl/js_css.tpl');
48  $template->parse('TAT_js_css');//http://piwigo.org/forum/viewtopic.php?id=23248
49  if (isset($TAT_restart) and $TAT_restart)
50  {
51    $TAT_restart=false;
52    $template->assign('TAT_restart',true);
53  }
54  $tat_path=str_replace(basename($_SERVER['SCRIPT_NAME']),'', $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']);
55  //$tat_path=$_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];
56  $template->assign('TAT_path', $tat_path);
57  include('tours/'.$tour_to_launch.'/config_preparse.inc.php');
58  $template->set_filename('TAT_tour_tpl', PHPWG_PLUGINS_PATH.'TakeATour/tours/'.$tour_to_launch.'/tour.tpl');
59  $template->parse('TAT_tour_tpl');
60}
61
62
63/*
64add_event_handler('init', 'TAT_add_js_css');
65function TAT_add_js_css()
66{
67  $avalaible_tour = array('first_contact', 'privacy', 'picture_protection');
68
69  if ( isset($_POST['submited_tour']) and in_array($_POST['submited_tour'], $avalaible_tour) and defined('IN_ADMIN') and IN_ADMIN )
70  {
71    $tour_to_launch = $_POST['submited_tour'];
72  }
73  global $template;
74  load_language('plugin.lang', PHPWG_PLUGINS_PATH .'TakeATour/');
75  $template->set_filename('TAT_js_css', PHPWG_PLUGINS_PATH.'TakeATour/tpl/js_css.tpl');
76  $template->parse('TAT_js_css');//http://piwigo.org/forum/viewtopic.php?id=23248
77  $template->set_filename('TAT_tour_tpl', PHPWG_PLUGINS_PATH.'TakeATour/tpl/'.$tour_to_launch.'.tpl');
78  $template->parse('TAT_tour_tpl');
79}*/
80add_event_handler('get_admin_plugin_menu_links', 'TAT_admin_menu' );
81function TAT_admin_menu($menu)
82{
83  array_push($menu, array(
84    'NAME' => 'Take a Tour',
85    'URL' => get_root_url().'admin.php?page=plugin-TakeATour'
86    )
87  );
88  return $menu;
89}
90?>
Note: See TracBrowser for help on using the repository browser.