source: extensions/TakeATour/tours/first_contact/config_preparse.inc.php @ 28129

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

styling
using enable_synchronization

File size: 1.7 KB
Line 
1<?php
2  //picture id
3  if (isset($_GET['page']) and preg_match('/^photo-(\d+)(?:-(.*))?$/', $_GET['page'], $matches))
4  {
5    $_GET['image_id'] = $matches[1];
6  }
7  check_input_parameter('image_id', $_GET, false, PATTERN_ID);
8  if (isset($_GET['image_id']) and pwg_get_session_var('TAT_image_id')==null)
9  {
10    $template->assign('TAT_image_id', $_GET['image_id']);
11    pwg_set_session_var('TAT_image_id', $_GET['image_id']);
12  }
13  elseif (is_numeric(pwg_get_session_var('TAT_image_id')))
14  {
15    $template->assign('TAT_image_id', pwg_get_session_var('TAT_image_id'));
16  }
17  else
18  {
19    $query = '
20    SELECT id
21      FROM '.IMAGES_TABLE.'
22      ORDER BY RAND()
23      LIMIT 1 
24    ;';
25    $row = pwg_db_fetch_assoc(pwg_query($query));
26    $template->assign('TAT_image_id', $row['id']);
27  }
28  //album id
29  if (isset($_GET['page']) and preg_match('/^album-(\d+)(?:-(.*))?$/', $_GET['page'], $matches))
30  {
31    $_GET['cat_id'] = $matches[1];
32  }
33  check_input_parameter('cat_id', $_GET, false, PATTERN_ID);
34  if (isset($_GET['cat_id']) and pwg_get_session_var('TAT_cat_id')==null)
35  {
36    $template->assign('TAT_cat_id', $_GET['cat_id']);
37    pwg_set_session_var('TAT_cat_id', $_GET['cat_id']);
38  }
39  elseif (is_numeric(pwg_get_session_var('TAT_cat_id')))
40  {
41    $template->assign('TAT_cat_id', pwg_get_session_var('TAT_cat_id'));
42  }
43  else
44  {
45    $query = '
46    SELECT id
47      FROM '.CATEGORIES_TABLE.'
48      ORDER BY RAND()
49      LIMIT 1 
50    ;';
51    $row = pwg_db_fetch_assoc(pwg_query($query));
52    $template->assign('TAT_cat_id', $row['id']);
53  }
54  global $conf;
55  if ( isset($conf['enable_synchronization']) )
56  {
57    $template->assign('TAT_FTP', $conf['enable_synchronization']);
58  }
59?>
Note: See TracBrowser for help on using the repository browser.