Ignore:
Timestamp:
Jul 15, 2014, 8:03:00 PM (10 years ago)
Author:
flop25
Message:

Take A Tour:
-only 2 files per tour.tpl
-allow external tours
-absolute url when ending the tour
-better code, commented
wiki updated (2.7 technical changes)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/TakeATour/main.inc.php

    r29007 r29046  
    1414
    1515/** Tour sended via $_POST or $_GET**/
    16 if ( isset($_REQUEST['submited_tour']) and defined('IN_ADMIN') and IN_ADMIN )
     16if ( isset($_REQUEST['submited_tour_path']) and defined('IN_ADMIN') and IN_ADMIN )
    1717{
    1818  check_pwg_token();
    19   pwg_set_session_var('tour_to_launch', $_REQUEST['submited_tour']);
     19  pwg_set_session_var('tour_to_launch', $_REQUEST['submited_tour_path']);
    2020  global $TAT_restart;
    2121  $TAT_restart=true;
     
    2828/** Setup the tour **/
    2929/*
    30  * REMOVE FOR RELEASE
    31 $version_=str_replace('.','_',PHPWG_VERSION);
    32 if (pwg_get_session_var('tour_to_launch')!=$version_ and isset($_GET['page']) and $_GET['page']=="plugin-TakeATour")
     30 * CHANGE FOR RELEASE
     31$version_=str_replace('.','_',PHPWG_VERSION);*/
     32$version_="2_7_0";
     33/***/
     34if (pwg_get_session_var('tour_to_launch')!='tours/'.$version_ and isset($_GET['page']) and $_GET['page']=="plugin-TakeATour")
    3335{
    3436  pwg_unset_session_var('tour_to_launch');
    3537}
    36 else*/if ( pwg_get_session_var('tour_to_launch') )
     38elseif ( pwg_get_session_var('tour_to_launch') )
    3739{
    3840  add_event_handler('init', 'TAT_tour_setup');
    39   include('tours/'.pwg_get_session_var('tour_to_launch').'/config.inc.php');
    4041}
    4142
     
    4546  $tour_to_launch=pwg_get_session_var('tour_to_launch');
    4647  load_language('plugin.lang', PHPWG_PLUGINS_PATH .'TakeATour/', array('force_fallback'=>'en_UK'));
     48
    4749  $template->set_filename('TAT_js_css', PHPWG_PLUGINS_PATH.'TakeATour/tpl/js_css.tpl');
    48   $template->assign(
    49   array(
    50     'ADMIN_THEME'    => $conf['admin_theme'],
    51     )
    52   );
     50  $template->assign('ADMIN_THEME', $conf['admin_theme']);
    5351  $template->parse('TAT_js_css');
     52
    5453  if (isset($TAT_restart) and $TAT_restart)
    5554  {
     
    5958  $tat_path=str_replace(basename($_SERVER['SCRIPT_NAME']),'', $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']);
    6059  $template->assign('TAT_path', $tat_path);
    61   @include('tours/'.$tour_to_launch.'/config_preparse.inc.php');
    62   $template->set_filename('TAT_tour_tpl', PHPWG_PLUGINS_PATH.'TakeATour/tours/'.$tour_to_launch.'/tour.tpl');
     60  $template->assign('ABS_U_ADMIN', get_absolute_root_url());// absolute one due to public pages and $conf['question_mark_in_urls'] = false+$conf['php_extension_in_urls'] = false;
     61  include($tour_to_launch.'/config.inc.php');
     62  $template->set_filename('TAT_tour_tpl', $TOUR_PATH);
    6363  $template->parse('TAT_tour_tpl');
    6464}
     
    102102{
    103103  $search = '<div class="bigButton"><a href="{$next_step_url}">{\'I want to add photos\'|@translate}</a></div>';
    104   $replacement = '<div class="bigButton"><a href="'.get_root_url().'admin.php?submited_tour=first_contact&pwg_token='.get_pwg_token().'">{\'I want to discover my gallery and add photos\'|@translate}</a></div>
     104  $replacement = '<div class="bigButton"><a href="'.get_root_url().'admin.php?submited_tour_path=tours/first_contact&pwg_token='.get_pwg_token().'">{\'I want to discover my gallery and add photos\'|@translate}</a></div>
    105105<div class="bigButton"><a href="{$next_step_url}">{\'I want to add photos\'|@translate}</a></div>';
    106106  return(str_replace($search, $replacement, $content));
     
    115115  if (file_exists('tours/'.$version_.'/config.inc.php'))
    116116  {
    117     $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>';
     117    $page['infos'][] = '<a href="'.get_root_url().'admin.php?submited_tour_path=tours/'.$version_.'&pwg_token='.get_pwg_token().'">'.l10n('Discover what is new in the version %s of Piwigo', PHPWG_VERSION).'</a>';
    118118  }
    119119}
Note: See TracChangeset for help on using the changeset viewer.