Beispiel #1
0
function validateDownloadLink( $url )
{
  if(!$url)
  {
	  return array("no download link?!");
	}

  $errormessage = validateLink( $url );

  $myurl=parse_url($url);
  if(($myurl["scheme"]!="http")&&($myurl["scheme"]!="ftp")&&($myurl["scheme"]!="https"))
    $errormessage[] = "only http/https and ftp protocols are supported for the download link";

  if(strstr($myurl["host"],"youtube") || strstr($myurl["host"],"youtu.be"))
    $errormessage[] = "F**K YOUTUBE - BINARY OR GTFO";

  // ** apparently this is needed for csdb - still think its a bad idea
  //if(strstr($myurl["path"],".php") && !strstr($myurl["host"],"scene.org"))
  //  $errormessage[] = "please link to the file directly";

  if(strstr($myurl["path"],".txt"))
    $errormessage[] = "NO TEXTFILES.";

  if(strstr($myurl["host"],"untergrund.net"))
  {
    for ($x=1; $x<=5; $x++)
     if(strstr($myurl["host"],"ftp".$x.".untergrund.net"))
      $errormessage[] = "scamp says: link to ftp.untergrund.net not ftp".$x.".untergrund.net!!";
    if ($myurl["scheme"]=="http")
     $errormessage[] = "scamp says: no link to untergrund.net via http please!";
    if(strstr($myurl["host"],"www.untergrund.net"))
     $errormessage[] = "scamp says: godverdom!! link to ftp.untergrund.net instead!";
  }
  if(!basename($myurl["path"]))
    $errormessage[] = "no file? no prod!";

  return $errormessage;
}
  static function ValidateRequest($input,&$output)
  {
    $errors = validateLink($input["newLink"]);
    if ($errors)
      return $errors;

    if (!$input["reason"])
      return array("no changing without a good reason !");

    $row = SQLLib::selectRow(sprintf_esc("select * from downloadlinks where prod = %d and id = %d",$_REQUEST["prod"],$input["linkID"]));
    if (!$row)
      return array("nice try :|");

    if (strcmp($row->link,$input["newLink"])===0 && strcasecmp($row->type,$input["newLinkKey"])===0)
      return array("you didn't change anything :|");

    $output["linkID"] = $input["linkID"];
    $output["oldLink"] = $input["oldLink"];
    $output["oldLinkKey"] = $input["oldLinkKey"];
    $output["newLink"] = $input["newLink"];
    $output["newLinkKey"] = $input["newLinkKey"];
    $output["reason"] = $input["reason"];
    return array();
  }