2012-10-23 50 views
0

我已經下載了一個php web應用程序(Studip)。當我去到index.php,我收到以下錯誤:PHP「文件意外結束...」語法錯誤

Parse error: syntax error, unexpected end of file in /var/www/html/studip/public/index.php on line 248

我已經檢查了語法,沒有語法錯誤。還有什麼會導致這個錯誤?

以下是文件:

<?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 <[email protected]> 
* @author  Ralf Stockmann <[email protected]> 
* @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' => 'Seminar_Session', 'auth' => 'Seminar_Default_Auth', 'perm' => 'Seminar_Perm', 'user' => 'Seminar_User')); 

$auth->login_if(Request::get('again') && ($auth->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->is_authenticated() && $user->id != 'nobody') { 
    // store last language click 
    if (strlen($_SESSION['forced_language'])) { 
     $db->query("UPDATE user_info SET preferred_language = '".$_SESSION['forced_language']."' WHERE user_id='$user->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') && ($auth->is_authenticated() && $user->id != 'nobody')){ 
    $rss_id = StudipNews::GetRssIdFromRangeId('studip'); 
    if ($rss_id) { 
     PageLayout::addHeadElement('link', array('rel' => 'alternate', 
               'type' => 'application/rss+xml', 
               'title' => 'RSS', 
               'href' => '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->is_authenticated() && $user->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->have_perm('root')) { // root 
     $ueberschrift = _("Startseite f�r Root bei Stud.IP"); 
    } elseif ($perm->have_perm('admin')) { // admin 
     $ueberschrift = _("Startseite f�r AdministratorInnen bei Stud.IP"); 
    } elseif ($perm->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 
?> 
    <div class="index_container"> 
     <table class="index_box"> 
      <tr> 
       <td class="topic" style="font-weight: bold;" colspan="2"> 
        <?= Assets::img('icons/16/white/home.png', array('class' => 'middle')) ?> 
        <?= htmlReady($ueberschrift) ?> 
       </td> 
      </tr> 
      <? if ($perm->get_perm() == 'user') : ?> 
      <tr> 
       <td class="blank" style="padding: 1em 1em 0em 1em;" colspan="2"> 
        <?= MessageBox::info(sprintf(_('Sie haben noch nicht auf Ihre %s Best�tigungsmail %s geantwortet.'), '<a href="'.$help_url.'" target="_blank">', '</a>'), 
          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'), '<a href="mailto:'.$GLOBALS['UNI_CONTACT'].'">'.$GLOBALS['UNI_CONTACT'].'</a>'))) ?> 
       </td> 
      </tr> 
      <? endif ?> 
      <tr> 
       <td class="blank" valign="top" style="padding-left:25px; width:80%;" id="index_navigation"> 
       <? foreach (Navigation::getItem('/start') as $nav) : ?> 
        <? if ($nav->isVisible()) : ?> 
         <div class="mainmenu"> 
         <? if (is_internal_url($url = $nav->getURL())) : ?> 
          <a href="<?= URLHelper::getLink($url) ?>"> 
         <? else : ?> 
          <a href="<?= htmlspecialchars($url) ?>" target="_blank"> 
         <? endif ?> 
         <?= htmlReady($nav->getTitle()) ?></a> 
         <? $pos = 0 ?> 
         <? foreach ($nav as $subnav) : ?> 
          <? if ($subnav->isVisible()) : ?> 
           <font size="-1"> 
           <?= $pos++ ? '/' : '<br>' ?> 
           <? if (is_internal_url($url = $subnav->getURL())) : ?> 
            <a href="<?= URLHelper::getLink($url) ?>"> 
           <? else : ?> 
            <a href="<?= htmlspecialchars($url) ?>" target="_blank"> 
           <? endif ?> 
           <?= htmlReady($subnav->getTitle()) ?></a> 
           </font> 
          <? endif ?> 
         <? endforeach ?> 
         </div> 
        <? endif ?> 
       <? endforeach ?> 
       </td> 
       <td class="indexpage" align="right" valign="top"><img src="<?=$GLOBALS['ASSETS_URL']?>images/blank.gif" width="390" height="100" alt=""></td> 
      </tr> 
     </table> 
<? 

    // display news 
    show_news('studip', $perm->have_perm('root'), 0, $index_data['nopen'], "", null, $index_data); 

    // display dates 
    if (!$perm->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->auth['uid'], $perm); 
    } 
} else { //displaymodul for nobody 
    $index_nobody_template = $GLOBALS['template_factory']->open('index_nobody'); 
    $db->query("SELECT count(*) from seminare"); 
    $db->next_record(); 
    $index_nobody_template->set_attribute('num_active_courses', $db->f(0)); 
    $db->query("SELECT count(*) from auth_user_md5"); 
    $db->next_record(); 
    $index_nobody_template->set_attribute('num_registered_users', $db->f(0)); 
    $index_nobody_template->set_attribute('num_online_users', get_users_online_count(10)); 

    if ($_REQUEST['logout']) 
    { 
     $index_nobody_template->set_attribute('logout', true); 
    } 

    echo '<div class="index_container" style="width: 750px; margin: 0 auto !important;">'; 
    echo $index_nobody_template->render(); 
} 

$layout = $GLOBALS['template_factory']->open('shared/index_box'); 

// Pr�fen, ob PortalPlugins vorhanden sind. 
$portalplugins = PluginEngine::getPlugins('PortalPlugin'); 

foreach ($portalplugins as $portalplugin) { 
    $template = $portalplugin->getPortalTemplate(); 

    if ($template) { 
     echo $template->render(NULL, $layout); 
     $layout->clear_attributes(); 
    } 
} 

page_close(); 

if (is_object($user) && $user->id != 'nobody') { 
    $db->query(sprintf("SELECT * FROM rss_feeds WHERE user_id='%s' AND hidden=0 ORDER BY priority",$auth->auth["uid"])); 
    while ($db->next_record()) { 
     if ($db->f("name")!="" && $db->f("url")!="") { 
      $feed = new RSSFeed($db->f("url")); 
      if ($db->f('fetch_title') && $feed->ausgabe->channel['title']) { 
       $feedtitle = $feed->ausgabe->channel['title']; 
      } else { 
       $feedtitle = $db->f("name"); 
      } 

      ob_start(); 
      $feed->rssfeed_start(); 
      echo $layout->render(array('title' => $feedtitle, 'icon_url' => 'icons/16/white/rss.png', 'admin_url' => 'edit_about.php?view=rss', 'content_for_layout' => ob_get_clean())); 
     } 
    } 
} 

echo '</div>'; 

include 'lib/include/html_end.inc.php'; 
+2

這很可能是一個缺失} –

+0

暫時刪除線247('包括 'LIB /包含/ html_end.inc.php';')。你仍然得到這個錯誤?如果是這樣,問題可能在那裏 –

+0

是否需要用'?>'結束文件? –

回答

13

你們的服務器支持短開放標籤?檢查你的ini。如果沒有,啓用它們。如果您不能然後替換<?<?php

+0

相關的設置被命名爲'short_open_tag',並且它應該被設置爲'開啓'爲那些需要它的傳統應用程序。 –

-2

行170上的php打開標記似乎沒有結束。

<? 

    // display news show_news('studip', $perm->have_perm('root'), 0,$index_data['nopen'], "", null, $index_data); 
    ..... ..... .... 
    include 'lib/include/html_end.inc.php'; 

所以它可能你需要一個結束標籤在結束。

2

您可能需要更改<?<?php (格外如果您使用的是localhost)

0

這只是工作不錯給我。它避免了XML標籤,並且可以進行替換。

正則表達式(<\?[^(php|xml)])

相關問題