title: PHP "unexpected end of file..." syntax error
body: <p>I have downloaded a php web application(Studip). When I go to index.php, I get the following error:</p>
  
  <p><code>
  Parse error: syntax error, unexpected end of file in /var/www/html/studip/public/index.php on line 248</code></p>
  
  <p>I have checked the syntax, there is no syntax error. Is there anything else that causes this error?</p>
  
  <p>Here is the file:</p>
  
  <pre><code>&lt;?php
  # Lifter002: TODO
  # Lifter007: TODO
  # Lifter003: TODO
  # Lifter010: TODO
  /**
   * index.php - Startseite von Stud.IP (anhaengig vom Status)
   *
   * This program is free software; you can redistribute it and/or
   * modify it under the terms of the GNU General Public License as
   * published by the Free Software Foundation; either version 2 of
   * the License, or (at your option) any later version.
   *
   * @author      Stefan Suchi &lt;suchi@gmx.de&gt;
   * @author      Ralf Stockmann &lt;rstockm@gwdg.de&gt;
   * @license     http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
   * @category    Stud.IP
   */
  
  require '../lib/bootstrap.php';
  
  unregister_globals();
  
  page_open(array('sess' =&gt; 'Seminar_Session', 'auth' =&gt; 'Seminar_Default_Auth', 'perm' =&gt; 'Seminar_Perm', 'user' =&gt; 'Seminar_User'));
  
  $auth-&gt;login_if(Request::get('again') &amp;&amp; ($auth-&gt;auth['uid'] == 'nobody'));
  
  // database object
  $db=new DB_Seminar;
  
  // evaluate language clicks
  // has to be done before seminar_open to get switching back to german (no init of i18n at all))
  if (Request::get('set_language')) {
      if(array_key_exists(Request::get('set_language'), $GLOBALS['INSTALLED_LANGUAGES'])) {
          $_SESSION['forced_language'] = Request::get('set_language');
          $_SESSION['_language'] = Request::get('set_language');
      }
  }
  
  // store  user-specific language preference
  if ($auth-&gt;is_authenticated() &amp;&amp; $user-&gt;id != 'nobody') {
      // store last language click
      if (strlen($_SESSION['forced_language'])) {
          $db-&gt;query("UPDATE user_info SET preferred_language = '".$_SESSION['forced_language']."' WHERE user_id='$user-&gt;id'");
          $_SESSION['_language'] = $_SESSION['forced_language'];
      }
      $_SESSION['forced_language'] = null;
  }
  
  include 'lib/seminar_open.php'; // initialise Stud.IP-Session
  require_once 'config.inc.php';
  require_once 'lib/functions.php';
  require_once 'lib/visual.inc.php';
  require_once 'lib/classes/MessageBox.class.php';
  include_once 'lib/classes/RSSFeed.class.php';
  // -- hier muessen Seiten-Initialisierungen passieren --
  
  // -- wir sind jetzt definitiv in keinem Seminar, also... --
  closeObject();
  
  if (get_config('NEWS_RSS_EXPORT_ENABLE') &amp;&amp; ($auth-&gt;is_authenticated() &amp;&amp; $user-&gt;id != 'nobody')){
      $rss_id = StudipNews::GetRssIdFromRangeId('studip');
      if ($rss_id) {
          PageLayout::addHeadElement('link', array('rel'   =&gt; 'alternate',
                                                   'type'  =&gt; 'application/rss+xml',
                                                   'title' =&gt; 'RSS',
                                                   'href'  =&gt; 'rss.php?id='.$rss_id));
      }
  }
  
  PageLayout::setHelpKeyword("Basis.Startseite"); // set keyword for new help
  PageLayout::setTitle(_("Startseite"));
  Navigation::activateItem('/start');
  PageLayout::setTabNavigation(NULL); // disable display of tabs
  
  // Start of Output
  include 'lib/include/html_head.inc.php'; // Output of html head
  include 'lib/include/header.php';
  
  // only for authenticated users
  if ($auth-&gt;is_authenticated() &amp;&amp; $user-&gt;id != 'nobody') {
  
      UrlHelper::bindLinkParam('index_data', $index_data);
  
      //Auf und Zuklappen News
      require_once 'lib/showNews.inc.php';
      process_news_commands($index_data);
  
      // Auf- und Zuklappen Termine
      if (Request::get('dopen')) {
          $index_data['dopen'] = Request::option('dopen');
      }
      if (Request::get('dclose')) {
          unset($index_data['dopen']);
      }
  
      if ($perm-&gt;have_perm('root')) { // root
          $ueberschrift = _("Startseite f�r Root bei Stud.IP");
      } elseif ($perm-&gt;have_perm('admin')) { // admin
          $ueberschrift = _("Startseite f�r AdministratorInnen bei Stud.IP");
      } elseif ($perm-&gt;have_perm('dozent')) { // dozent
          $ueberschrift = _("Startseite f�r DozentInnen bei Stud.IP");
      } else { // user, autor, tutor
          $ueberschrift = _("Ihre pers�nliche Startseite bei Stud.IP");
      }
  
      // Warning for Users
      $help_url = format_help_url("Basis.AnmeldungMail");
  
      // Display banner ad
      if (get_config('BANNER_ADS_ENABLE')) {
          require_once 'lib/banner_show.inc.php';
          banner_show();
      }
  
      // add skip link
      SkipLinks::addIndex(_("Navigation Startseite"), 'index_navigation');
  
  // display menue
  ?&gt;
      &lt;div class="index_container"&gt;
          &lt;table class="index_box"&gt;
              &lt;tr&gt;
                  &lt;td class="topic" style="font-weight: bold;" colspan="2"&gt;
                      &lt;?= Assets::img('icons/16/white/home.png', array('class' =&gt; 'middle')) ?&gt;
                      &lt;?= htmlReady($ueberschrift) ?&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
              &lt;? if ($perm-&gt;get_perm() == 'user') : ?&gt;
              &lt;tr&gt;
                  &lt;td class="blank" style="padding: 1em 1em 0em 1em;" colspan="2"&gt;
                      &lt;?= MessageBox::info(sprintf(_('Sie haben noch nicht auf Ihre %s Best�tigungsmail %s geantwortet.'), '&lt;a href="'.$help_url.'" target="_blank"&gt;', '&lt;/a&gt;'),
                              array(_('Bitte holen Sie dies nach, um Stud.IP Funktionen wie das Belegen von Veranstaltungen nutzen zu k�nnen.'),
                                  sprintf(_('Bei Problemen wenden Sie sich an: %s'), '&lt;a href="mailto:'.$GLOBALS['UNI_CONTACT'].'"&gt;'.$GLOBALS['UNI_CONTACT'].'&lt;/a&gt;'))) ?&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
              &lt;? endif ?&gt;
              &lt;tr&gt;
                  &lt;td class="blank" valign="top" style="padding-left:25px; width:80%;" id="index_navigation"&gt;
                  &lt;? foreach (Navigation::getItem('/start') as $nav) : ?&gt;
                      &lt;? if ($nav-&gt;isVisible()) : ?&gt;
                          &lt;div class="mainmenu"&gt;
                          &lt;? if (is_internal_url($url = $nav-&gt;getURL())) : ?&gt;
                              &lt;a href="&lt;?= URLHelper::getLink($url) ?&gt;"&gt;
                          &lt;? else : ?&gt;
                              &lt;a href="&lt;?= htmlspecialchars($url) ?&gt;" target="_blank"&gt;
                          &lt;? endif ?&gt;
                          &lt;?= htmlReady($nav-&gt;getTitle()) ?&gt;&lt;/a&gt;
                          &lt;? $pos = 0 ?&gt;
                          &lt;? foreach ($nav as $subnav) : ?&gt;
                              &lt;? if ($subnav-&gt;isVisible()) : ?&gt;
                                  &lt;font size="-1"&gt;
                                  &lt;?= $pos++ ? ' / ' : '&lt;br&gt;' ?&gt;
                                  &lt;? if (is_internal_url($url = $subnav-&gt;getURL())) : ?&gt;
                                      &lt;a href="&lt;?= URLHelper::getLink($url) ?&gt;"&gt;
                                  &lt;? else : ?&gt;
                                      &lt;a href="&lt;?= htmlspecialchars($url) ?&gt;" target="_blank"&gt;
                                  &lt;? endif ?&gt;
                                  &lt;?= htmlReady($subnav-&gt;getTitle()) ?&gt;&lt;/a&gt;
                                  &lt;/font&gt;
                              &lt;? endif ?&gt;
                          &lt;? endforeach ?&gt;
                          &lt;/div&gt;
                      &lt;? endif ?&gt;
                  &lt;? endforeach ?&gt;
                  &lt;/td&gt;
                  &lt;td class="indexpage" align="right" valign="top"&gt;&lt;img src="&lt;?=$GLOBALS['ASSETS_URL']?&gt;images/blank.gif" width="390" height="100" alt=""&gt;&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;
  &lt;?
  
      // display news
      show_news('studip', $perm-&gt;have_perm('root'), 0, $index_data['nopen'], "", null, $index_data);
  
      // display dates
      if (!$perm-&gt;have_perm('admin')) { // only dozent, tutor, autor, user
          include 'lib/show_dates.inc.php';
          $start = time();
          $end = $start + 60 * 60 * 24 * 7;
          if (get_config('CALENDAR_ENABLE')) {
              show_all_dates($start, $end, TRUE, FALSE, $index_data['dopen']);
          } else {
              show_dates($start, $end, $index_data['dopen']);
          }
      }
  
      // display votes
      if (get_config('VOTE_ENABLE')) {
          include 'lib/vote/vote_show.inc.php';
          show_votes('studip', $auth-&gt;auth['uid'], $perm);
      }
  } else { //displaymodul for nobody
      $index_nobody_template = $GLOBALS['template_factory']-&gt;open('index_nobody');
      $db-&gt;query("SELECT count(*) from seminare");
      $db-&gt;next_record();
      $index_nobody_template-&gt;set_attribute('num_active_courses', $db-&gt;f(0));
      $db-&gt;query("SELECT count(*) from auth_user_md5");
      $db-&gt;next_record();
      $index_nobody_template-&gt;set_attribute('num_registered_users', $db-&gt;f(0));
      $index_nobody_template-&gt;set_attribute('num_online_users', get_users_online_count(10));
  
      if ($_REQUEST['logout'])
      {
          $index_nobody_template-&gt;set_attribute('logout', true);
      }
  
      echo '&lt;div class="index_container" style="width: 750px; margin: 0 auto !important;"&gt;';
      echo $index_nobody_template-&gt;render();
  }
  
  $layout = $GLOBALS['template_factory']-&gt;open('shared/index_box');
  
  // Pr�fen, ob PortalPlugins vorhanden sind.
  $portalplugins = PluginEngine::getPlugins('PortalPlugin');
  
  foreach ($portalplugins as $portalplugin) {
      $template = $portalplugin-&gt;getPortalTemplate();
  
      if ($template) {
          echo $template-&gt;render(NULL, $layout);
          $layout-&gt;clear_attributes();
      }
  }
  
  page_close();
  
  if (is_object($user) &amp;&amp; $user-&gt;id != 'nobody') {
      $db-&gt;query(sprintf("SELECT * FROM rss_feeds WHERE user_id='%s' AND hidden=0 ORDER BY priority",$auth-&gt;auth["uid"]));
      while ($db-&gt;next_record()) {
          if ($db-&gt;f("name")!="" &amp;&amp; $db-&gt;f("url")!="") {
              $feed = new RSSFeed($db-&gt;f("url"));
              if ($db-&gt;f('fetch_title') &amp;&amp; $feed-&gt;ausgabe-&gt;channel['title']) {
                  $feedtitle = $feed-&gt;ausgabe-&gt;channel['title'];
              } else {
                  $feedtitle = $db-&gt;f("name");
              }
  
              ob_start();
              $feed-&gt;rssfeed_start();
              echo $layout-&gt;render(array('title' =&gt; $feedtitle, 'icon_url' =&gt; 'icons/16/white/rss.png', 'admin_url' =&gt; 'edit_about.php?view=rss', 'content_for_layout' =&gt; ob_get_clean()));
          }
      }
  }
  
  echo '&lt;/div&gt;';
  
  include 'lib/include/html_end.inc.php';
  </code></pre>