Ejemplo n.º 1
0
	/**
	* check valid URL
	*/
	function scanYoutubePage ( $buffer )
	{
		global $option;
		$app = & JFactory::getApplication();

		$admin_import = true;
		$search_counter = 0;
		$insert_counter = 0;
		$real_counter = 0;
		$offset = intval(0);
		$duplicate_check = null;
		$duplicate_counter = 0;

		while ($insert_counter <= 50) {

			$pos_track = strpos($buffer, "watch?v=", $offset);
			$pos_code = $pos_track + 8;
			$code = substr($buffer, $pos_code, 11);
			$code = strip_tags($code );
			$code = preg_replace("/[^a-zA-Z0-9s_-]/", "", $code);

			//echo $code.'<b>'.$search_counter.'</b>'.$insert_counter.'<br />';

			if ($pos_track === false) {
				$insert_counter = 1000000;
				continue;
			} else {
				$offset = intval($pos_track+1);
			}
			if ($offset >= strlen($buffer)) {
				$insert_counter = 1000000;
			}
			if ($code == $duplicate_check) {
				$search_counter++;
				if ($search_counter > 500) {
					$insert_counter = 1000000;
					continue;
				} else {
					continue;
				}
			} else {
				$duplicate_check = $code;
			}

			unset ($_REQUEST['embeddump']);
			$_REQUEST['embeddump'] = "http://www.youtube.com/watch?v=".$code;

			if (hwd_vs_uploads::addConfirm($option, $admin_import)) {
				$insert_counter++;
				$real_counter++;
			} else {
				$duplicate_counter++;
			}
			$search_counter++;

		}

		$app->enqueueMessage($duplicate_counter." duplicate videos skipped");
		$app->enqueueMessage($real_counter." videos imported");
		return;

	}
Ejemplo n.º 2
0
	function addconfirm()
	{
		require_once(JPATH_SITE.DS.'components'.DS.'com_hwdvideoshare'.DS.'models'.DS.'uploads.php');
		hwd_vs_uploads::addConfirm();
	}