code commented

useless code removed
first step for tour after update


git-svn-id: http://piwigo.org/svn/trunk@28207 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
flop25 2014-04-16 20:45:31 +00:00
parent a1f9dbb486
commit 2383cd0072
2 changed files with 29 additions and 7 deletions

View file

@ -12,31 +12,31 @@ if (!defined('PHPWG_ROOT_PATH'))
die('Hacking attempt!'); die('Hacking attempt!');
} }
$avalaible_tour = array('first_contact', 'privacy', 'picture_protection'); /** Tour sended via $_POST or $_GET**/
if ( isset($_REQUEST['submited_tour']) and defined('IN_ADMIN') and IN_ADMIN )
if ( isset($_POST['submited_tour']) and in_array($_POST['submited_tour'], $avalaible_tour) and defined('IN_ADMIN') and IN_ADMIN )
{ {
check_pwg_token(); check_pwg_token();
pwg_set_session_var('tour_to_launch', $_POST['submited_tour']); pwg_set_session_var('tour_to_launch', $_POST['submited_tour']);
global $TAT_restart; global $TAT_restart;
$TAT_restart=true; $TAT_restart=true;
} }
elseif ( isset($_GET['tour_ended']) and in_array($_GET['tour_ended'], $avalaible_tour) and defined('IN_ADMIN') and IN_ADMIN ) elseif ( isset($_GET['tour_ended']) and defined('IN_ADMIN') and IN_ADMIN )
{ {
pwg_unset_session_var('tour_to_launch'); pwg_unset_session_var('tour_to_launch');
} }
/** Setup the tour **/
if (pwg_get_session_var('tour_to_launch') and isset($_GET['page']) and $_GET['page']=="plugin-TakeATour" ) if (pwg_get_session_var('tour_to_launch') and isset($_GET['page']) and $_GET['page']=="plugin-TakeATour" )
{ {
pwg_unset_session_var('tour_to_launch'); pwg_unset_session_var('tour_to_launch');
} }
elseif ( pwg_get_session_var('tour_to_launch') ) elseif ( pwg_get_session_var('tour_to_launch') )
{ {
add_event_handler('init', 'TAT_add_js_css'); add_event_handler('init', 'TAT_tour_setup');
include('tours/'.pwg_get_session_var('tour_to_launch').'/config.inc.php'); include('tours/'.pwg_get_session_var('tour_to_launch').'/config.inc.php');
} }
function TAT_add_js_css() function TAT_tour_setup()
{ {
global $template, $TAT_restart; global $template, $TAT_restart;
$tour_to_launch=pwg_get_session_var('tour_to_launch'); $tour_to_launch=pwg_get_session_var('tour_to_launch');
@ -56,7 +56,7 @@ function TAT_add_js_css()
$template->parse('TAT_tour_tpl'); $template->parse('TAT_tour_tpl');
} }
/** Add link in Help pages **/
add_event_handler('loc_end_help','TAT_help'); add_event_handler('loc_end_help','TAT_help');
function TAT_help() function TAT_help()
{ {
@ -76,6 +76,8 @@ function TAT_help_prefilter($content, &$smarty)
return(str_replace($search, $replacement, $content)); return(str_replace($search, $replacement, $content));
} }
/** Add link in no_photo_yet **/
add_event_handler('loc_end_no_photo_yet','TAT_no_photo_yet'); add_event_handler('loc_end_no_photo_yet','TAT_no_photo_yet');
function TAT_no_photo_yet() function TAT_no_photo_yet()
{ {
@ -120,6 +122,19 @@ form input[type="submit"]:hover {
return(str_replace($search, $replacement, $content)); return(str_replace($search, $replacement, $content));
} }
/** After a Piwigo Update **/
add_event_handler('list_check_integrity', 'TAT_prompt');
function TAT_prompt($c13y)
{
global $page;
$version_=str_replace('.','_',PHPWG_VERSION);
if (file_exists('tours/'.$version_.'/config.inc.php'))
{
$page['infos'][] = '<a href="'.get_root_url().'admin.php?submited_tour='.$version_.'&pwg_token='.get_pwg_token().'">'.l10n('Discover what is new in the version %s of Piwigo', PHPWG_VERSION).'</a>';
}
}
/** Add admin menu link **/
add_event_handler('get_admin_plugin_menu_links', 'TAT_admin_menu' ); add_event_handler('get_admin_plugin_menu_links', 'TAT_admin_menu' );
function TAT_admin_menu($menu) function TAT_admin_menu($menu)
{ {

View file

@ -446,6 +446,13 @@ REPLACE INTO '.PLUGINS_TABLE.'
;'; ;';
pwg_query($query);*/ pwg_query($query);*/
$query = '
REPLACE INTO '.PLUGINS_TABLE.'
(id, state)
VALUES (\'TakeATour\', \'active\')
;';
pwg_query($query);
// Delete cache data // Delete cache data
invalidate_user_cache(true); invalidate_user_cache(true);
$template->delete_compiled_templates(); $template->delete_compiled_templates();