root/trunk/wifidog-auth/wifidog/portal/index.php @ 356

Revision 356, 5.6 KB (checked in by aprilp, 8 years ago)

Removed references to user_management pages that don't exist anymore

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?php
2  // $Id$
3  /********************************************************************\
4   * This program is free software; you can redistribute it and/or    *
5   * modify it under the terms of the GNU General Public License as   *
6   * published by the Free Software Foundation; either version 2 of   *
7   * the License, or (at your option) any later version.              *
8   *                                                                  *
9   * This program is distributed in the hope that it will be useful,  *
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
12   * GNU General Public License for more details.                     *
13   *                                                                  *
14   * You should have received a copy of the GNU General Public License*
15   * along with this program; if not, contact:                        *
16   *                                                                  *
17   * Free Software Foundation           Voice:  +1-617-542-5942       *
18   * 59 Temple Place - Suite 330        Fax:    +1-617-542-2652       *
19   * Boston, MA  02111-1307,  USA       gnu@gnu.org                   *
20   *                                                                  *
21   \********************************************************************/
22  /**@file index.php Displays the portal page
23   * @author Copyright (C) 2004 Benoit Gr�goire et Philippe April
24   */
25
26define('BASEPATH','../');
27require_once BASEPATH.'include/common.php';
28require_once BASEPATH.'classes/SmartyWifidog.php';
29require_once BASEPATH.'classes/Session.php';
30
31if(CONF_USE_CRON_FOR_DB_CLEANUP == false)
32  {
33    garbage_collect();
34  }
35
36$smarty = new SmartyWifidog;
37$session = new Session;
38
39include BASEPATH.'include/language.php';
40
41$portal_template = $_REQUEST['gw_id'] . ".html";
42$node_id = $db->EscapeString($_REQUEST['gw_id']);
43$db->ExecSqlUniqueRes("SELECT * FROM nodes WHERE node_id='$node_id'", $node_info);
44if($node_info==null)
45  {
46    $smarty->assign('hotspot_name', UNKNOWN_HOSTPOT_NAME);
47    $hotspot_rss_url = UNKNOWN_HOTSPOT_RSS_URL;
48  }
49 else
50   {
51     $smarty->assign('hotspot_name', $node_info['name']);
52     $hotspot_rss_url =  $node_info['rss_url'];
53   }
54
55/* Find out who is online */
56$db->ExecSql("SELECT users.user_id FROM users,connections " .
57             "WHERE connections.token_status='" . TOKEN_INUSE . "' " .
58             "AND users.user_id=connections.user_id AND connections.node_id='$node_id' "
59             ,$users, false);
60if($users!=null)
61  {
62    foreach ($users as $user_info)
63      {
64        $smarty->append("online_users", $user_info);
65      }
66  }
67
68if(RSS_SUPPORT)
69  {
70    //      $old_error_level = error_reporting(E_ERROR);
71    define('MAGPIE_DIR', BASEPATH.MAGPIE_REL_PATH);
72    //    require_once(MAGPIE_DIR.'rss_fetch.inc');
73    //    define('MAGPIE_DEBUG', 0);
74    require_once BASEPATH.'classes/RssPressReview.inc';
75    $press_review=new RssPressReview;
76    $tokens = "/[\s,]+/";
77    $network_rss_sources = NETWORK_RSS_URL;
78    $network_rss_html = null;
79    if(!empty($network_rss_sources))
80      {
81
82        $extract_array=null;
83        $extract_array = preg_split($tokens, $network_rss_sources);
84        //print_r($extract_array);
85        foreach($extract_array as $source)
86          {
87            $network_rss_sources_array[] = array('url' => $source, 'default_publication_interval' => 7*24*3600);
88          }
89        $network_rss_html=$press_review->get_rss_html($network_rss_sources_array, 5);
90      }
91                     
92    $hotspot_rss_html=null;
93    if(!empty($hotspot_rss_url))
94      {
95        $extract_array=null;
96        $extract_array = preg_split($tokens, $hotspot_rss_url);
97        //print_r($extract_array);
98        foreach($extract_array as $source)
99          {
100            $hotspot_rss_sources_array[] = array('url' => $source, 'default_publication_interval' => 7*24*3600);
101          }
102        $hotspot_rss_html=$press_review->get_rss_html($hotspot_rss_sources_array, 5);     
103      }
104    /**
105     @return the generated html or the error message or an empty string if called without a URL.
106    */
107    function generate_rss_html ( $url ) {
108      $rss_html='';
109      if(!empty($url))
110        {
111          $rss = fetch_rss( $url );
112          $rss_html='';
113          if ( !$rss )
114            {
115              $rss_html .= _("Error: ") . magpie_error() ;
116            }
117          else 
118            {
119              //$rss->show_channel();
120              //$rss->show_list();
121              $rss_html .= "<p>"._('Channel: ') . $rss->channel['title'] . "</p>\n";
122              $rss_html .= "<ul>\n";
123              foreach ($rss->items as $item)
124                {
125                  //echo '<pre>'; print_r($item);       echo '</pre>';
126                  $href = $item['link'];
127                  $title = $item['title'];
128                  $summary =  $item['summary']; 
129                  $rss_html .= "<li><emp><a href=$href>$title</a></emp> $summary</li>\n";
130                }
131              $rss_html .= "</ul>\n";
132            }
133        }
134      return $rss_html;
135    }
136
137
138    //$network_rss_html=generate_rss_html(NETWORK_RSS_URL);   
139    //echo $networkrss_html;
140    $smarty->assign("network_rss_html", $network_rss_html);
141
142   
143    //$hotspot_rss_html=generate_rss_html($hotspot_rss_url);   
144    //echo $hotspot_rss_html;
145    $smarty->assign("hotspot_rss_html", $hotspot_rss_html);
146    //   error_reporting($old_error_level);
147  }
148
149if (isset($session)) {
150    $smarty->assign("original_url_requested", $session->get(SESS_ORIGINAL_URL_VAR));
151}
152
153$smarty->display(DEFAULT_CONTENT_SMARTY_PATH."header.html");
154$smarty->display(DEFAULT_CONTENT_SMARTY_PATH."header_portal.html");
155if (is_file(NODE_CONTENT_PHP_RELATIVE_PATH.PORTAL_PAGE_NAME)) {
156    $smarty->display(NODE_CONTENT_SMARTY_PATH.PORTAL_PAGE_NAME);
157} else {
158    $smarty->display(DEFAULT_CONTENT_SMARTY_PATH.PORTAL_PAGE_NAME);
159}
160$smarty->display(DEFAULT_CONTENT_SMARTY_PATH."footer_portal.html");
161$smarty->display(DEFAULT_CONTENT_SMARTY_PATH."footer.html");
162?>
Note: See TracBrowser for help on using the browser.