1<?php
2// +-----------------------------------------------------------------------+
3// | This file is part of Piwigo.                                          |
4// |                                                                       |
5// | For copyright and license information, please view the COPYING.txt    |
6// | file that was distributed with this source code.                      |
7// +-----------------------------------------------------------------------+
8
9
10//--------------------------------------------------------------------- include
11define('PHPWG_ROOT_PATH','./');
12include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
13check_status(ACCESS_FREE);
14include_once(PHPWG_ROOT_PATH.'include/functions_notification.inc.php');
15include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
16include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
17include_once(PHPWG_ROOT_PATH.'admin/include/functions_notification_by_mail.inc.php');
18// Translations are in admin file too
19load_language('admin.lang');
20// Need to update a second time
21trigger_notify('loading_lang');
22load_language('lang', PHPWG_ROOT_PATH.PWG_LOCAL_DIR, array('no_fallback'=>true, 'local'=>true) );
23
24
25// +-----------------------------------------------------------------------+
26// | Main                                                                  |
27// +-----------------------------------------------------------------------+
28if (isset($_GET['subscribe'])
29    and preg_match('/^[A-Za-z0-9]{16}$/', $_GET['subscribe']))
30{
31  subscribe_notification_by_mail(false, array($_GET['subscribe']));
32}
33else if (isset($_GET['unsubscribe'])
34    and preg_match('/^[A-Za-z0-9]{16}$/', $_GET['unsubscribe']))
35{
36  unsubscribe_notification_by_mail(false, array($_GET['unsubscribe']));
37}
38else
39{
40  $page['errors'][] = l10n('Unknown identifier');
41}
42
43// +-----------------------------------------------------------------------+
44// | template initialization                                               |
45// +-----------------------------------------------------------------------+
46$title = l10n('Notification');
47$page['body_id'] = 'theNBMPage';
48
49$template->set_filenames(array('nbm'=>'nbm.tpl'));
50
51
52// include menubar
53$themeconf = $template->get_template_vars('themeconf');
54if (!isset($themeconf['hide_menu_on']) OR !in_array('theNBMPage', $themeconf['hide_menu_on']))
55{
56  include( PHPWG_ROOT_PATH.'include/menubar.inc.php');
57}
58
59// +-----------------------------------------------------------------------+
60// | html code display                                                     |
61// +-----------------------------------------------------------------------+
62include(PHPWG_ROOT_PATH.'include/page_header.php');
63flush_page_messages();
64$template->parse('nbm');
65include(PHPWG_ROOT_PATH.'include/page_tail.php');
66?>
67