source: trunk/plugins/TakeATour/tours/2_7_0/config_preparse.inc.php @ 28951

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

[take a tour]
empty language value with a space
tour 2.7 : search page, select js
tour privacy : wip

File size: 973 bytes
Line 
1<?php
2  $template->assign('TAT_index', make_index_url(array('section' => 'categories')));
3  $template->assign('TAT_search', get_root_url().'search.php');
4
5  //picture id
6  if (isset($_GET['page']) and preg_match('/^photo-(\d+)(?:-(.*))?$/', $_GET['page'], $matches))
7  {
8    $_GET['image_id'] = $matches[1];
9  }
10  check_input_parameter('image_id', $_GET, false, PATTERN_ID);
11  if (isset($_GET['image_id']) and pwg_get_session_var('TAT_image_id')==null)
12  {
13    $template->assign('TAT_image_id', $_GET['image_id']);
14    pwg_set_session_var('TAT_image_id', $_GET['image_id']);
15  }
16  elseif (is_numeric(pwg_get_session_var('TAT_image_id')))
17  {
18    $template->assign('TAT_image_id', pwg_get_session_var('TAT_image_id'));
19  }
20  else
21  {
22    $query = '
23    SELECT id
24      FROM '.IMAGES_TABLE.'
25      ORDER BY RAND()
26      LIMIT 1 
27    ;';
28    $row = pwg_db_fetch_assoc(pwg_query($query));
29    $template->assign('TAT_image_id', $row['id']);
30  }
31?>
Note: See TracBrowser for help on using the repository browser.