Page 1 of 1

PHP Error | Parse syntax error, unexpected T_OBJECT_OPERATOR

Posted: Fri Apr 18, 2008 11:36 am
by calbae
I'm getting this error:

Code: Select all

Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /home/b*****n/public_html/video/templates/default/index.php on line 50
I'm using:
2.2.8 (Unix) Apache;
5.2.5 PHP
5.0.45 MySQL

Following are the files associated:

index.php

Code: Select all

<?php
 
require_once 'admin/sort.php';
function randtag($str){
    $font_size = rand(1,5);
    $color_array = array('black', 'blue', 'green', 'white');
    shuffle($color_array);
    $font_color = $color_array[0];
    $link = ' <a href="index.php?tag='.$str.'" style="text-decoration:none"><font size="'.$font_size.'" color="'.$font_color.'">'.$str.',</font></a> ';
    return $link;
}
 
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title><? if(isset($_GET['tag'])){ echo ucwords($_GET['tag']).' Videos - '.$sqlinfo['site_slogan']; } else { echo $sqlinfo['site_slogan']; }?></title>
<meta name="keywords" content="<? if(isset($_GET['tag'])){ echo $_GET['tag'].', '; }?><?=$sqlinfo['site_keywords']?>">
<meta name="description" content="<?=$sqlinfo['site_description']?>">
<style type="text/css">@import url(<?='templates/'.$sqlinfo['template']?>/newstyle.php);</style>
<link rel="shortcut icon" href="images/favicon.ico">
</head>
 
<body>
<form name="search" action="index.php" method="get">
  <table width="900" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="509"><div class="logo"></div></td>
    <td width="391" align="right"><input name="tag" type="text" id="tag" style="font-family:Verdana; font-size:18px; border:2px solid #ed891a;" onfocus="if(this.value=='Search...')this.value=''" value="Search..." /> 
    <input type="submit" value="Search!" style="font-family:Verdana; font-size:18px; background-color:#ed891a; border:2px solid #ed891a; color:#FFFFFF;"></td>
  </tr>
  <tr>
    <td colspan="2" style="padding-top:10px;"><table width="900" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="topnav_left"></td>
        <td class="topnav_bg"><a href="<?=$sqlinfo['site_url']?>">Home</a> <a href="index.php?tag=<?php echo $sqlinfo['link1']?>"><?php echo $sqlinfo['link1']?></a> <a href="index.php?tag=<?php echo $sqlinfo['link2']?>"><?php echo $sqlinfo['link2']?></a> <a href="index.php?tag=<?php echo $sqlinfo['link3']?>"><?php echo $sqlinfo['link3']?></a> <a href="index.php?tag=<?php echo $sqlinfo['link4']?>"><?php echo $sqlinfo['link4']?></a></td>
        <td class="topnav_right"></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td colspan="2" style="padding-top:10px;"><table width="900" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="520" valign="top">
            <table width="520" border="0" cellspacing="0" cellpadding="0">
              <?
                foreach ($feed as $entry) {
                    $videoId = $entry->getVideoId();
                    $thumbnailUrl = $entry->medx-MoBiLeroup->thumbnail[0]->url;
                    $videoTitle = $entry->medx-MoBiLeroup->title;
                    $viewCount = $entry->statistics->viewCount;
                    $authorUsername = $entry->author[0]->name;
                    $videoDescription = $entry->medx-MoBiLeroup->description;
                    $videoRating = $entry->rating->average;
                    $duration = $entry->medx-MoBiLeroup->duration->seconds;
                    $videoTitle2 = substr($videoTitle, 0, 40);
                    $newtitle = ucwords(str_replace($string, $replace, $videoTitle));
                    //$desc = htmlspecialchars(wordwrap(substr($videoDescription, 0, 100) . '...', 30, ' ', 1));
                    
                    //Check title
                    $check_title = substr($videoId, 0, 1);
                    if($check_title == '_'){ $url = 'show_video.php?video_id='.$videoId; } else { $url = $newtitle.'__'.$videoId.'.html'; }
                ?>
              <tr>
                <td class="list_left"></td>
                <td width="130" valign="top" class="list_bg"><a href="<?=$url?>"><img src="<?=$thumbnailUrl?>" style="border:3px solid #216b88;" width="121" height="86" ></a></td>
                <td width="372" valign="top" class="list_bg" style="padding-left:10px;">
                <a href="<?=$url?>"><b><?=$videoTitle2?></b></a>
                <br /><br />
                <div title="<?=$videoRating?>" style="background:url(templates/<?=$sqlinfo['template']?>/images/stars.gif); width:<?=$videoRating*20?>px; height:20px;"></div>
                <br />
                <div style="font-size:11px;"><b>Views:</b> <?=number_format($viewCount)?> | <b>Username:</b> <?=$authorUsername?></div>
                </td>
                <td class="list_right"></td>
              </tr>
              <tr>
                <td colspan="4">&nbsp;</td>
              </tr>
              <? } ?>
              <tr>
                <td colspan="4" align="center" valign="bottom"><span class="table_content">
                  <? 
                    $pages = ceil(990/$sqlinfo['videos_per_page']);
                    if(isset($_GET['page']) and $_GET['page'] != 1){ $pageless = $_GET['page']-1; $pagemore = $_GET['page']+1; } else { $pageless = 1; $pagemore = 2; } 
            
                    //Set Pages
                    echo '<br /><br />';
                    if($pages>7) {
                      if($currentpage>4) {
                        echo ' <a href="index.php?page=1&tag='.$tag.'" style="color:#ed8621"><<</a>&nbsp;&nbsp;&nbsp; '; 
                      }
                    }
                    echo ' <a href="index.php?page='.$pageless.'&tag='.$tag.'" style="padding-right:20px; color:#ed8621"><</a> ';
                    $startpage = $currentpage-3<1?1:$currentpage-3;
                    $endpage = $startpage+6>$pages?$pages:$startpage+6;
                
                    for($i=0;$i<$pages;$i++) {
                      if($i+1>=$startpage && $i+1<=$endpage) {
                        if($i+1==$currentpage) {
                          $current = 1;
                        }else{
                          $current = 0;
                        }
                        $next = $i+1;
                        if($current == 1){ echo '<b>'.$next.'</b>'; } 
                        else { echo ' <a href="index.php?tag='.$tag.'&page='.$next.'" style="color:#ed8621">'.$next.'</a> '; }
                
                      }
                    }
                    if ($_GET['page'] < $pages){ echo ' <a href="index.php?page='.$pagemore.'&tag='.$tag.'" style="padding-left:20px; color:#ed8621">></a>&nbsp;&nbsp;&nbsp; '; }
                    if($pages>7) {
                      if($currentpage<$pages-3) {
                        echo ' <a href="index.php?tag='.$tag.'&page='.$pages.'" style="color:#ed8621">>></a> '; 
                
                      }
                    }
                  
                  ?>
 
                 </td>
              </tr>
            </table>
 
        </td>
        <td width="380" valign="top">
            <div class="welcome_top"></div>
            <div class="welcome_bg"><h1>Welcome to <?=str_replace('http://', '', $sqlinfo['site_url']); ?></h1><?=ucwords(str_replace('http://', '', $sqlinfo['site_url'])); ?> is your source for the funniest videos online. Using YouTube's API we're able to provide you with millions of <b>funny videos</b> from all over the world. We also provide you with the embed code so you can place it on your MySpace profile. That's right all these videos can also be <b>MySpace videos</b>.</div>
            <div class="welcome_bottom"></div><br />
            <div class="welcome_top"></div>
            <center><div class="welcome_bg"><?=$sqlinfo['336_280']?></div></center>
            <div class="welcome_bottom"></div><br />
            <div class="featured_top"></div>
            <div class="featured_bg">
              <h1>Featured Video </h1>
              <center>
                <embed src="http://www.youtube.com/v/IQaC8gjnOYE" type="application/x-shockwave-flash" wmode="transparent" width="300" height="240"></embed>
              </center>
            </div><div class="featured_bottom"></div><br>
            <div class="welcome_top"></div>
            <div class="welcome_bg">
              <h1>Random Cloud Tags </h1><? while($taginfo = mysql_fetch_assoc($get_tags)){ echo randtag($taginfo['tag']); } ?>
              </div>
            <div class="welcome_bottom"></div>
 
   </td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td colspan="2" style="padding-top:10px;"><table width="900" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="footer_left"></td>
        <td class="footer_bg">Copyright &copy; 2008 <?=$sqlinfo['site_url']?>. All Rights Reserved.<br />
          All videos are hosted on YouTube and are property of their respected owners.</td>
        <td class="footer_right"></td>
      </tr>
    </table></td>
  </tr>
</table>    
</form>
<?=$sqlinfo['tracker']?>
</body>
</html>

Re: PHP Error | Parse syntax error, unexpected T_OBJECT_OPERATOR

Posted: Fri Apr 18, 2008 11:36 am
by calbae
sort.php

Code: Select all

<?php
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_YouTube');
require_once ('settings.php');
$sqlinfo = mysql_fetch_assoc(mysql_query('SELECT * FROM settings'));
$string = array('-', ' ', '(', ')', ':', '.', '/', '\'', '"', ',', '%', 'é', 'á', '!', '"');
$replace = array('', '-', '', '', '', '', '', '', '', '', '', 'e', 'a', '', '');
if (isset($_GET['tag']))
{
        $search = str_replace('+', '', $_GET['tag']);
        $search2 = str_replace(' ', '', $search);
        if (ctype_alnum($search2))
        {
                if (!is_numeric($search))
                {
                        $check = mysql_num_rows(mysql_query("SELECT tagid FROM tags WHERE tag='$search'"));
                        if ($check == 0)
                        {
                                mysql_query("INSERT INTO tags (tag) VALUES ('$search')");
                        }
                }
        }
}
$get_tags = mysql_query("SELECT tag FROM tags WHERE tag != '' ORDER BY tagid DESC LIMIT 0,30");
$sqlinfo = mysql_fetch_assoc(mysql_query('SELECT * FROM settings'));
if (empty($_GET['page']))
{
        $currentpages = 1;
        $currentpage = 1;
}
else
{
        $currentpages = $_GET['page'] * 10;
        $currentpage = $_GET['page'];
}
if (empty($_GET['tag']))
{
        $tag = $sqlinfo['default_tag'];
}
else
{
        $tag = $_GET['tag'];
}
$yt = new Zend_Gdata_YouTube();
$query = $yt->newVideoQuery();
$query->setQuery($tag);
$query->setStartIndex($currentpages);
$query->setMaxResults($sqlinfo['videos_per_page']);
$query->setOrderBy($sqlinfo['video_display']);
$feed = $yt->getVideoFeed($query);
?>

Re: PHP Error | Parse syntax error, unexpected T_OBJECT_OPERATOR

Posted: Fri Apr 18, 2008 11:37 am
by calbae
newstyle.php

Code: Select all

<?php ob_start("ob_gzhandler");
header("Content-type: text/css");
header("Cache-Control: must-revalidate");
$offset = 60 * 60;
$ExpStr = "Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT";
header($ExpStr);
?>
table, tr, td { font-family:Verdana; }
h1 { font-size:18px; margin:0px; padding-bottom:5px; }
.logo { background:url(images/logo.gif) no-repeat; width:509px; height:132px; }
.topnav_left { background:url(images/topnav_left.gif) no-repeat; width:10px; height:38px; }
.topnav_right { background:url(images/topnav_right.gif) no-repeat; width:10px; height:38px; }
.topnav_bg { background:url(images/topnav_bg.gif) repeat-x; width:880px; height:38px; text-align:center; }
.topnav_bg a{ color:#fff; text-decoration:none; font-size:18px; padding:0 30px 0 30px;  }
.topnav_bg a:hover{ color:#226985; background-color:#fff; text-decoration:none; font-size:18px; padding:0 30px 0 30px;  }
.welcome_top { background:url(images/welcome_top.gif) top no-repeat; height:9px; width:380px; margin:0px; padding:0px;    }
.welcome_bg { background:url(images/welcome_bg.gif) repeat-y; width:360px; padding-left:15px; padding-right:5px; color:#fff; font-size:11px; margin:0px;  }
.welcome_bottom { background:url(images/welcome_bottom.gif) top no-repeat; height:9px; width:380px;  }
.featured_top { background:url(images/featured_top.gif) top no-repeat; height:9px; width:380px;  }
.featured_bg { background:url(images/featured_bg.gif) repeat-y; width:360px; padding-left:15px; padding-right:5px; color:#fff; font-size:11px;  }
.featured_bottom { background:url(images/featured_bottom.gif) top no-repeat; height:9px; width:380px;  }
.list_left { background:url(images/list_left.gif) no-repeat; width:9px; height:110px; }
.list_bg { background-color:#4bb2dd; padding:5px; color:#fff; font-size:14px; }
.list_bg a{ color:#fff; text-decoration:none; }
.list_bg a:hover{ color:#fff; text-decoration:underline; }
.list_right { background:url(images/list_right.gif) no-repeat; width:9px; height:110px; }
.footer_left { background:url(images/footer_left.gif) no-repeat; width:10px; height:71px; }
.footer_bg { background-color:#226985; text-align:center; color:#fff; font-size:11px; }
.footer_right { background:url(images/footer_right.gif) no-repeat; width:10px; height:71px; }
.content_top { background:url(images/content-top.gif) no-repeat; height:8px; width:485px; }
.content_bg { background-color:#4bb2dd; padding:5px; color:#fff; font-size:14px; }
.content_bg a{ color:#fff; text-decoration:none; }
.content_bg a:hover{ color:#fff; text-decoration:underline; }
.content_bottom { background:url(images/content-bottom.gif) no-repeat; height:8px; width:485px; }

Re: PHP Error | Parse syntax error, unexpected T_OBJECT_OPERATOR

Posted: Fri Apr 18, 2008 11:40 am
by calbae
show_video.php

Code: Select all

 
<?php
require_once ('settings.php');
$sqlinfo = mysql_fetch_assoc(mysql_query('SELECT * FROM settings'));
if (isset($sqlinfo['template']))
{
        if (is_file('templates/' . $sqlinfo['template'] . '/show_video.php'))
        {
                require_once ('templates/' . $sqlinfo['template'] . '/show_video.php');
                if ($sqlinfo['sitemap'] == 0)
                {
                        $link = $sqlinfo['site_url'] . $_SERVER['REQUEST_URI'];
                        $video_check = mysql_num_rows(mysql_query("SELECT vid FROM youtube_videos WHERE code='$videoId'"));
                        if ($video_check == 0)
                        {
                                mysql_query("INSERT INTO youtube_videos (name, code, link) VALUES ('$title','$videoId','$link')");
                        }
                }
        }
        else
        {
                die('Your template appears to be corrupt. Try re-uploading the folder.');
        }
}
else
{
        die("Your default template doesn't appear to be set.");
}
?>
I'll be really grateful to you for solving it...Thanks a lot.

CalBae.