<?php


switch ($websiteWidgetArgs['method']){
	case "local":
		$_REQUEST["wwid"] = $websiteWidgetArgs['widgetID'];
		$_REQUEST["whoisWidget"] = (int)$websiteWidgetArgs["whoisWidget"];
		$_REQUEST["multiDomain"] = (int)$websiteWidgetArgs["multiDomain"];
		if (file_exists($websiteWidgetArgs['urlORpath']."/website_widget.php")){
			include($websiteWidgetArgs['urlORpath']."/website_widget.php");
		} else {
			echo "Include path error, cannot find file.<br />(".$websiteWidgetArgs['urlORpath']."website_widget.php)";
		}
	break;
	case "fopen":
		$url = $websiteWidgetArgs['urlORpath']."/website_widget.php?wwid=".$websiteWidgetArgs['widgetID']."&whoisWidget=".(int)$websiteWidgetArgs["whoisWidget"]."&multiDomain=".(int)$websiteWidgetArgs["multiDomain"];
		if ($_REQUEST['sid']){
			$url .= "&sid=".$_REQUEST['sid'];
		}
		$fp = @fopen($url, "r");
		if (!$fp){
			echo "Connection error or invalid URL.<br />URL: $url";
		} else {
			$content = "";
			while (!@feof($fp)){
				$content .= @fread($fp, 4096);
			}
			@fclose($fp);
			if ($content==""){
				echo "URL contained no data.<br />URL: $url";
			} else {
				echo $content;
			}
		}
	break;
}

?>
