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

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

reload local lang files to allow override

File size: 3.3 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  load_language('lang', PHPWG_ROOT_PATH.PWG_LOCAL_DIR, array('no_fallback'=>true, 'local'=>true) );
48  $template->set_filename('TAT_js_css', PHPWG_PLUGINS_PATH.'TakeATour/tpl/js_css.tpl');
49  $template->parse('TAT_js_css');//http://piwigo.org/forum/viewtopic.php?id=23248
50  if (isset($TAT_restart) and $TAT_restart)
51  {
52    $TAT_restart=false;
53    $template->assign('TAT_restart',true);
54  }
55  $tat_path=str_replace(basename($_SERVER['SCRIPT_NAME']),'', $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']);
56  //$tat_path=$_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];
57  $template->assign('TAT_path', $tat_path);
58  include('tours/'.$tour_to_launch.'/config_preparse.inc.php');
59  $template->set_filename('TAT_tour_tpl', PHPWG_PLUGINS_PATH.'TakeATour/tours/'.$tour_to_launch.'/tour.tpl');
60  $template->parse('TAT_tour_tpl');
61}
62
63
64/*
65add_event_handler('init', 'TAT_add_js_css');
66function TAT_add_js_css()
67{
68  $avalaible_tour = array('first_contact', 'privacy', 'picture_protection');
69
70  if ( isset($_POST['submited_tour']) and in_array($_POST['submited_tour'], $avalaible_tour) and defined('IN_ADMIN') and IN_ADMIN )
71  {
72    $tour_to_launch = $_POST['submited_tour'];
73  }
74  global $template;
75  load_language('plugin.lang', PHPWG_PLUGINS_PATH .'TakeATour/');
76  $template->set_filename('TAT_js_css', PHPWG_PLUGINS_PATH.'TakeATour/tpl/js_css.tpl');
77  $template->parse('TAT_js_css');//http://piwigo.org/forum/viewtopic.php?id=23248
78  $template->set_filename('TAT_tour_tpl', PHPWG_PLUGINS_PATH.'TakeATour/tpl/'.$tour_to_launch.'.tpl');
79  $template->parse('TAT_tour_tpl');
80}*/
81add_event_handler('get_admin_plugin_menu_links', 'TAT_admin_menu' );
82function TAT_admin_menu($menu)
83{
84  array_push($menu, array(
85    'NAME' => 'Take a Tour',
86    'URL' => get_root_url().'admin.php?page=plugin-TakeATour'
87    )
88  );
89  return $menu;
90}
91?>
Note: See TracBrowser for help on using the repository browser.