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

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

first try to set modules

#sync from mobile storage

File size: 3.0 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  )
29{
30  if !in_array(pwg_get_session_var('tour_to_launch'), $conf['TakeATour_tour_ignored']) or !isset($conf['TakeATour_tour_ignored']))
31  {
32    add_event_handler('init', 'TAT_add_js_css');
33    include('tours/'.pwg_get_session_var('tour_to_launch').'/config.inc.php');
34  }
35}
36function TAT_add_js_css()
37{
38  global $template, $TAT_restart;
39  $tour_to_launch=pwg_get_session_var('tour_to_launch');
40  load_language('plugin.lang', PHPWG_PLUGINS_PATH .'TakeATour/');
41  $template->set_filename('TAT_js_css', PHPWG_PLUGINS_PATH.'TakeATour/tpl/js_css.tpl');
42  $template->parse('TAT_js_css');//http://piwigo.org/forum/viewtopic.php?id=23248
43  if (isset($TAT_restart) and $TAT_restart)
44  {
45    $TAT_restart=false;
46    $template->assign('TAT_restart',true);
47  }
48  $tat_path=str_replace(basename($_SERVER['SCRIPT_NAME']),'', $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']);
49  //$tat_path=$_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];
50  $template->assign('TAT_path', $tat_path);
51  include('tours/'.$tour_to_launch.'/config_preparse.inc.php')
52  $template->set_filename('TAT_tour_tpl', PHPWG_PLUGINS_PATH.'TakeATour/tpl/'.$tour_to_launch.'.tpl');
53  $template->parse('TAT_tour_tpl');
54}
55
56
57/*
58add_event_handler('init', 'TAT_add_js_css');
59function TAT_add_js_css()
60{
61  $avalaible_tour = array('first_contact', 'privacy', 'picture_protection');
62
63  if ( isset($_POST['submited_tour']) and in_array($_POST['submited_tour'], $avalaible_tour) and defined('IN_ADMIN') and IN_ADMIN )
64  {
65    $tour_to_launch = $_POST['submited_tour'];
66  }
67  global $template;
68  load_language('plugin.lang', PHPWG_PLUGINS_PATH .'TakeATour/');
69  $template->set_filename('TAT_js_css', PHPWG_PLUGINS_PATH.'TakeATour/tpl/js_css.tpl');
70  $template->parse('TAT_js_css');//http://piwigo.org/forum/viewtopic.php?id=23248
71  $template->set_filename('TAT_tour_tpl', PHPWG_PLUGINS_PATH.'TakeATour/tpl/'.$tour_to_launch.'.tpl');
72  $template->parse('TAT_tour_tpl');
73}*/
74add_event_handler('get_admin_plugin_menu_links', 'TAT_admin_menu' );
75function TAT_admin_menu($menu)
76{
77  array_push($menu, array(
78    'NAME' => 'Take a Tour',
79    'URL' => get_root_url().'admin.php?page=plugin-TakeATour'
80    )
81  );
82  return $menu;
83}
84?>
Note: See TracBrowser for help on using the repository browser.