aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/TakeATour/tours/first_contact/config_preparse.inc.php
diff options
context:
space:
mode:
authorflop25 <flop25@piwigo.org>2014-04-13 18:22:25 +0000
committerflop25 <flop25@piwigo.org>2014-04-13 18:22:25 +0000
commit5ebeec822fc3ee0d50591f2b25a1190760977327 (patch)
treee142eaff6582856ee22e60f956267e3c2fc11c92 /plugins/TakeATour/tours/first_contact/config_preparse.inc.php
parentd97c1394519a49f2d8d11f29e117be83a5f3979f (diff)
TakeATour replace c13y_upgrade ; c13y_upgrade not activated after upgrade
adding TakeATour files less margin-top in no_photo_yet.tpl git-svn-id: http://piwigo.org/svn/trunk@28169 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'plugins/TakeATour/tours/first_contact/config_preparse.inc.php')
-rw-r--r--plugins/TakeATour/tours/first_contact/config_preparse.inc.php59
1 files changed, 59 insertions, 0 deletions
diff --git a/plugins/TakeATour/tours/first_contact/config_preparse.inc.php b/plugins/TakeATour/tours/first_contact/config_preparse.inc.php
new file mode 100644
index 000000000..711dfe349
--- /dev/null
+++ b/plugins/TakeATour/tours/first_contact/config_preparse.inc.php
@@ -0,0 +1,59 @@
+<?php
+ //picture id
+ if (isset($_GET['page']) and preg_match('/^photo-(\d+)(?:-(.*))?$/', $_GET['page'], $matches))
+ {
+ $_GET['image_id'] = $matches[1];
+ }
+ check_input_parameter('image_id', $_GET, false, PATTERN_ID);
+ if (isset($_GET['image_id']) and pwg_get_session_var('TAT_image_id')==null)
+ {
+ $template->assign('TAT_image_id', $_GET['image_id']);
+ pwg_set_session_var('TAT_image_id', $_GET['image_id']);
+ }
+ elseif (is_numeric(pwg_get_session_var('TAT_image_id')))
+ {
+ $template->assign('TAT_image_id', pwg_get_session_var('TAT_image_id'));
+ }
+ else
+ {
+ $query = '
+ SELECT id
+ FROM '.IMAGES_TABLE.'
+ ORDER BY RAND()
+ LIMIT 1
+ ;';
+ $row = pwg_db_fetch_assoc(pwg_query($query));
+ $template->assign('TAT_image_id', $row['id']);
+ }
+ //album id
+ if (isset($_GET['page']) and preg_match('/^album-(\d+)(?:-(.*))?$/', $_GET['page'], $matches))
+ {
+ $_GET['cat_id'] = $matches[1];
+ }
+ check_input_parameter('cat_id', $_GET, false, PATTERN_ID);
+ if (isset($_GET['cat_id']) and pwg_get_session_var('TAT_cat_id')==null)
+ {
+ $template->assign('TAT_cat_id', $_GET['cat_id']);
+ pwg_set_session_var('TAT_cat_id', $_GET['cat_id']);
+ }
+ elseif (is_numeric(pwg_get_session_var('TAT_cat_id')))
+ {
+ $template->assign('TAT_cat_id', pwg_get_session_var('TAT_cat_id'));
+ }
+ else
+ {
+ $query = '
+ SELECT id
+ FROM '.CATEGORIES_TABLE.'
+ ORDER BY RAND()
+ LIMIT 1
+ ;';
+ $row = pwg_db_fetch_assoc(pwg_query($query));
+ $template->assign('TAT_cat_id', $row['id']);
+ }
+ global $conf;
+ if ( isset($conf['enable_synchronization']) )
+ {
+ $template->assign('TAT_FTP', $conf['enable_synchronization']);
+ }
+?> \ No newline at end of file