Jump to content

what is wrong w/ my code?


bms231

Recommended Posts

ok so i have to be missing a character or something b/c it breaks.  i am doing this in wordpad.  i am not a php programmer.  i am C# and this stuff just looks like greek to me but I am trying.

 

function streetfire(& $mediaArray)
{

	global $db;
	if (preg_match('/video\/(.*)\.htm', $this->_mediaInfo['url'], $match) {

		if ($this->vbulletin->options['vbmediaplayerproxy']) {
			$content = $this->fetchContent('http://www.freeproxysite.com/perl/nph-proxy.pl/101110A/http/videos.streetfire.net/vidiac.swf?video=' . $match[1]);
		} else {
			$content = $this->fetchContent('http://videos.streetfire.net/vidiac.swf?video=' . $match[1]);
		}

		if (preg_match('|<title>(.+)</title>|Ui',$content,$out)) {
			$title = $out[1];
			if (preg_match('|^Video - |Ui',trim($out[1]))) {
				$title = preg_replace('|^Video - |Ui','',trim($out[1]));
			}
		} else {
			$title = '';
		}
		$this->_mediaInfo['title'] = $title;

		if (preg_match('|<span id="_ctl0_Description" class="v7-text">(.+)</span>|is',$content,$out)) {
			$description = trim(strip_tags($out[1]));
		} else {
			$description = '';
		}
		$this->_mediaInfo['description'] = $description;

		if($this->vbulletin->options['vbmediaplayerproxy']) {
			$this->_mediaInfo['url'] = 'http://www.freeproxysite.com/perl/nph-proxy.pl/111110A/http/videos.streetfire.net/vidiac.swf?video=' . $match[1];
		} else {
			$this->_mediaInfo['url'] = 'http://videos.streetfire.net/vidiac.swf?video=' . $match[1];
		}

		$this->streetfire_player($mediaArray);
		$db->query_write("INSERT INTO `" . TABLE_PREFIX . "vbmediaplayerinfo` ( `id` , `type`, `media_code`, `media_url`, `media_info` , `title` , `description` , `date_added` ) VALUES (NULL , '".addslashes($this->_mediaInfo['type'])."', '".addslashes($this->_mediaInfo['text'])."', '".addslashes($this->_mediaInfo['url'])."', '".addslashes(var_export($this->_mediaInfo,true))."', '".addslashes($title)."', '".addslashes($description)."', UNIX_TIMESTAMP( ));");
	} else {
		$this->_mediaInfo['type'] = 'error';
	}
}

Link to comment
Share on other sites

$this is only used in classes, not in functions.... If you're trying to access the variable of a class, do it like (assuming $class is an instance of the class) $class->Variable....  If you're trying to set a temporary variable for use just in the function, variables created in functions are separate from variables outside of functions (the reason the globalizing of the $db var is neccessary).  Also, to access variables created within a function, you just use the variable name.

 

Besides the use of $this, the only other problem I see is:

 

preg_match('/video\/(.*)\.htm',

 

That pattern will give off a warning because it will assume / is a delimiter....  It needs to be something like preg_match('/\/video\/(.*)\.htm/',

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.