root/trunk/wifidog-auth/wifidog/content/PatternLanguage/subscription.php @ 1009

Revision 1009, 7.2 KB (checked in by benoitg, 7 years ago)
  • First step in massive simplification of CSS and templates
  • Implement the new main CSS structure
    • Implement working content assignation interface and content ordering for both network and nodes.
    • Display of content according to assignation work on 'portal' and 'login'. 'everywhere' not yet implemented
  • Get rid of some ISF specific interface elements
  • Finally replace the overly complicated start button by a "Use the Internet" link that will not get you out of your working tab
  • Fix #118
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?php
2
3/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
4
5// +-------------------------------------------------------------------+
6// | WiFiDog Authentication Server                                     |
7// | =============================                                     |
8// |                                                                   |
9// | The WiFiDog Authentication Server is part of the WiFiDog captive  |
10// | portal suite.                                                     |
11// +-------------------------------------------------------------------+
12// | PHP version 5 required.                                           |
13// +-------------------------------------------------------------------+
14// | Homepage:     http://www.wifidog.org/                             |
15// | Source Forge: http://sourceforge.net/projects/wifidog/            |
16// +-------------------------------------------------------------------+
17// | This program is free software; you can redistribute it and/or     |
18// | modify it under the terms of the GNU General Public License as    |
19// | published by the Free Software Foundation; either version 2 of    |
20// | the License, or (at your option) any later version.               |
21// |                                                                   |
22// | This program is distributed in the hope that it will be useful,   |
23// | but WITHOUT ANY WARRANTY; without even the implied warranty of    |
24// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     |
25// | GNU General Public License for more details.                      |
26// |                                                                   |
27// | You should have received a copy of the GNU General Public License |
28// | along with this program; if not, contact:                         |
29// |                                                                   |
30// | Free Software Foundation           Voice:  +1-617-542-5942        |
31// | 59 Temple Place - Suite 330        Fax:    +1-617-542-2652        |
32// | Boston, MA  02111-1307,  USA       gnu@gnu.org                    |
33// |                                                                   |
34// +-------------------------------------------------------------------+
35
36/**
37 * @package    WiFiDogAuthServer
38 * @author     Francois Proulx <francois.proulx@gmail.com>
39 * @copyright  2005-2006 Francois Proulx, Technologies Coeus inc.
40 * @version    Subversion $Id$
41 * @link       http://www.wifidog.org/
42 */
43
44/**
45 * Load required files
46 */
47require_once('../../include/common.php');
48
49require_once('include/common_interface.php');
50require_once('classes/User.php');
51require_once('classes/Content/PatternLanguage.php');
52require_once('classes/MainUI.php');
53
54// This trick is done to allow displaying of Pattern Language right away if there is only one available.
55if(!empty($_REQUEST['content_id']))
56{
57    $content_id = $_REQUEST['content_id'];
58    $pattern_language = PatternLanguage::getObject($content_id);
59}
60else
61{
62    $content_id = "";
63    $pattern_languages = PatternLanguage :: getAllContent();
64    if(count($pattern_languages) >= 1)
65        $pattern_language = $pattern_languages[0];
66    else
67        exit;
68}
69
70// The Pattern Language toolbar
71$tool_html = "<h1>{$pattern_language->getTitle()->__toString()}</h1>";
72$tool_html .= '<ul class="pattern_language_menu">'."\n";
73$gw_id = $session->get(SESS_GW_ID_VAR);
74if(!empty($gw_id))
75    $tool_html .= "<li><a href='/portal/?gw_id=$gw_id'>"._("Go back to this hotspot portal page")."</a></li>";
76$tool_html .= '<li><a href="'.BASE_SSL_PATH.'content/PatternLanguage/index.php?content_id='.$content_id.'">'._("About Pattern Language").'</a><br>'."\n";
77$tool_html .= '<li><a href="'.BASE_SSL_PATH.'content/PatternLanguage/narrative.php?content_id='.$content_id.'">'._("Read narrative").'</a><br>'."\n";
78$tool_html .= '<li><a href="'.BASE_SSL_PATH.'content/PatternLanguage/archives.php?content_id='.$content_id.'">'._("Archives").'</a><br>'."\n";
79$tool_html .= '<li><a href="'.BASE_SSL_PATH.'content/PatternLanguage/hotspots.php?content_id='.$content_id.'">'._("Participating hotspots").'</a><br>'."\n";
80$tool_html .= '<li><a href="'.BASE_SSL_PATH.'content/PatternLanguage/subscription.php?content_id='.$content_id.'">'._("Subscription").'</a><br>'."\n";
81$tool_html .= '</ul>'."\n";
82
83$tool_html .= "<div class='pattern_language_credits'>";
84$tool_html .=  $pattern_language->getSponsorInfo()->__toString();
85$tool_html .= "</div>";
86
87// Body
88$body_html = "<img src='".BASE_SSL_PATH."images/PatternLanguage/header.gif'>\n";
89$body_html .= "<h1>"._("Pattern Language Subscription")."</h1>\n";
90$body_html .= "<div class='pattern_language_body'>\n";
91
92$current_user = User::getCurrentUser();
93if($current_user)
94{
95    if(!empty($_REQUEST['subscribe']) || !empty($_REQUEST['unsubscribe']))
96    {
97        if(!empty($_REQUEST['subscribe']))
98        {
99            $pattern_language = PatternLanguage::getObject($_REQUEST['content_id']);
100            if(!$pattern_language->isUserSubscribed($current_user))
101            {
102                $pattern_language->subscribe($current_user);
103                $body_html .= _("Thank you for subscribing");
104                $gw_id = $session->get(SESS_GW_ID_VAR);
105                if(!empty($gw_id))
106                    $body_html .= "<p><a href='/portal/?gw_id=$gw_id'>"._("Go back to this hotspot portal page")."</a>";
107            }
108        }
109        else if(!empty($_REQUEST['unsubscribe']))
110        {
111            $pattern_language = PatternLanguage::getObject($_REQUEST['content_id']);
112            if($pattern_language->isUserSubscribed($current_user))
113                $pattern_language->unsubscribe($current_user);
114            $body_html .= _("You are now unsubscribed");
115            $gw_id = $session->get(SESS_GW_ID_VAR);
116            if(!empty($gw_id))
117                $body_html .= "<p><a href='/portal/?gw_id=$gw_id'>"._("Go back to this hotspot portal page")."</a>";
118        }
119    }
120    else
121    {
122        if(!$pattern_language->isUserSubscribed($current_user))
123        {
124            // Subscription
125            $body_html .= _("Subscribe to Pattern Language by clicking the link below. Once you have subscribed you will receive a fragment of text each time you log in to a participating hotspot in the city of Montreal. These text fragments will accumulate to form a unique narrative for every user. You can read your narrative anytime by clicking on \"Read Narrative\", or you can read the narratives generated by other users by going to \"Archives\".");
126            $body_html .= "<br><a href='subscription.php?subscribe=true&content_id={$pattern_language->getId()}'>"._("Subscribe now")."</a>";
127        }
128        else
129        {
130            // Unsubscription
131            $body_html .= _("You are already subscribed to Pattern Language, you can terminate your participation by clicking below.");
132            $body_html .= "<br><a href='subscription.php?unsubscribe=true&content_id={$pattern_language->getId()}'>"._("Unsubscribe now")."</a>";
133        }
134    }
135}
136else
137{
138    $body_html .= _("You must be logged in to subscribe !");
139}
140
141$body_html .= "</div>\n";
142
143$ui = new MainUI();
144$ui->appendContent('left_area_middle', $tool_html);
145$ui->setTitle(_("Pattern Language - Subscription"));
146$ui->appendContent('main_area_middle', $body_html);
147$ui->display();
148
149/*
150 * Local variables:
151 * tab-width: 4
152 * c-basic-offset: 4
153 * c-hanging-comment-ender-p: nil
154 * End:
155 */
156
157?>
Note: See TracBrowser for help on using the browser.