1
jeffgr
Removing file upload encryption from X_movie module?
  • 2007/7/16 22:01

  • jeffgr

  • Quite a regular

  • Posts: 263

  • Since: 2004/2/22


Hi everyone,

I am trying to remove the encryption that is given to movie files when they are uploaded using the x_movie module. Does anyone have any idea on how to do this?

Form processing for the module seems to be handled by a class file called Snoopy.class.php. I think it is somewhere in this file that there is the code that I have to change / comment out in order to remove this encryption function. I am posting the code from this file below, in case anyone has any ideas. Specifically, I think the issue is in the following snippet of code:

(at line 1184)

/////////////////////////////////////////

/*======================================================================*\
Function: _prepare_post_body
Purpose: Prepare post body according to encoding type
Input: $formvars - form variables
$formfiles - form upload files
Output: post body
\*======================================================================*/

function _prepare_post_body($formvars, $formfiles)
{
settype($formvars, "array");
settype($formfiles, "array");
$postdata = '';

if (count($formvars) == 0 && count($formfiles) == 0)
return;

switch ($this->_submit_type) {
case "application/x-www-form-urlencoded":
reset($formvars);
while(list($key,$val) = each($formvars)) {
if (is_array($val) || is_object($val)) {
while (list($cur_key, $cur_val) = each($val)) {
$postdata .= urlencode($key)."[]=".urlencode($cur_val)."&";
}
} else
$postdata .= urlencode($key)."=".urlencode($val)."&";

}
break;

case "multipart/form-data":
$this->_mime_boundary = "Snoopy".md5(uniqid(microtime()));

reset($formvars);
while(list($key,$val) = each($formvars)) {
if (is_array($val) || is_object($val)) {
while (list($cur_key, $cur_val) = each($val)) {
$postdata .= "--".$this->_mime_boundary."\r\n";
$postdata .= "Content-Disposition: form-data; name=\"$key\[\]\"\r\n\r\n";
$postdata .= "$cur_val\r\n";
}
} else {
$postdata .= "--".$this->_mime_boundary."\r\n";
$postdata .= "Content-Disposition: form-data; name=\"$key\"\r\n\r\n";
$postdata .= "$val\r\n";
}
}

reset($formfiles);
while (list($field_name, $file_names) = each($formfiles)) {
settype($file_names, "array");
while (list(, $file_name) = each($file_names)) {
if (!is_readable($file_name)) continue;

$fp = fopen($file_name, "r");
$file_content = fread($fp, filesize($file_name));
fclose($fp);
$base_name = basename($file_name);

$postdata .= "--".$this->_mime_boundary."\r\n";
$postdata .= "Content-Disposition: form-data; name=\"$field_name\"; filename=\"$base_name\"\r\n\r\n";
$postdata .= "$file_content\r\n";
}
}
$postdata .= "--".$this->_mime_boundary."--\r\n";
break;
}

return $postdata;
}
}

?>

////////////////////////////////////////

Any ideas on what to tweak above? Thanks!!!

jeffgr

Login

Who's Online

447 user(s) are online (61 user(s) are browsing Support Forums)


Members: 0


Guests: 447


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Sep 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits