示例#1
0
 * @copyright  2005-2006 Francois Proulx, Technologies Coeus inc.
 * @version    Subversion $Id: hotspots.php 1337 2008-03-20 18:07:28Z benoitg $
 * @link       http://www.wifidog.org/
 */
/**
 * Load required files
 */
require_once '../../include/common.php';
require_once 'classes/MainUI.php';
require_once 'classes/Content/PatternLanguage/PatternLanguage.php';
$smarty = SmartyWifidog::getObject();
$session = Session::getObject();
// This trick is done to allow displaying of Pattern Language right away if there is only one available.
if (!empty($_REQUEST['content_id'])) {
    $content_id = $_REQUEST['content_id'];
    $pattern_language = PatternLanguage::getObject($content_id);
} else {
    $content_id = "";
    $pattern_languages = PatternLanguage::getAllContent();
    if (count($pattern_languages) >= 1) {
        $pattern_language = $pattern_languages[0];
    } else {
        exit;
    }
}
// The Pattern Language toolbar
$tool_html = "<h1>{$pattern_language->getTitle()->__toString()}</h1>";
$tool_html .= '<ul class="pattern_language_menu">' . "\n";
$node_id = $session->get(SESS_NODE_ID_VAR);
if (!empty($node_id)) {
    $tool_html .= "<li><a href='/portal/?node_id={$node_id}'>" . _("Go back to this hotspot portal page") . "</a></li>";
示例#2
0
$current_user = User::getCurrentUser();
if ($current_user) {
    if (!empty($_REQUEST['subscribe']) || !empty($_REQUEST['unsubscribe'])) {
        if (!empty($_REQUEST['subscribe'])) {
            $pattern_language = PatternLanguage::getObject($_REQUEST['content_id']);
            if (!$pattern_language->isUserSubscribed($current_user)) {
                $pattern_language->subscribe($current_user);
                $body_html .= _("Thank you for subscribing");
                $node_id = $session->get(SESS_NODE_ID_VAR);
                if (!empty($node_id)) {
                    $body_html .= "<p><a href='/portal/?node_id={$node_id}'>" . _("Go back to this hotspot portal page") . "</a>";
                }
            }
        } else {
            if (!empty($_REQUEST['unsubscribe'])) {
                $pattern_language = PatternLanguage::getObject($_REQUEST['content_id']);
                if ($pattern_language->isUserSubscribed($current_user)) {
                    $pattern_language->unsubscribe($current_user);
                }
                $body_html .= _("You are now unsubscribed");
                $node_id = $session->get(SESS_NODE_ID_VAR);
                if (!empty($node_id)) {
                    $body_html .= "<p><a href='/portal/?node_id={$node_id}'>" . _("Go back to this hotspot portal page") . "</a>";
                }
            }
        }
    } else {
        if (!$pattern_language->isUserSubscribed($current_user)) {
            // Subscription
            $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\".");
            $body_html .= "<br><a href='subscription.php?subscribe=true&content_id={$pattern_language->getId()}'>" . _("Subscribe now") . "</a>";