[Phpslash-commit] CVS: phpslash-dev/include/modules/story Story_admin.class,1.3,1.4
Brought to you by:
joestewart,
nhruby
From: Luis M <le...@us...> - 2003-07-01 03:51:44
|
Update of /cvsroot/phpslash/phpslash-dev/include/modules/story In directory sc8-pr-cvs1:/tmp/cvs-serv2177 Modified Files: Story_admin.class Log Message: fixed file upload. now it works for all php 4.1.x and up. using autoglobals _FILES makes the script more secure and more efficient Index: Story_admin.class =================================================================== RCS file: /cvsroot/phpslash/phpslash-dev/include/modules/story/Story_admin.class,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Story_admin.class 3 Jun 2003 20:00:17 -0000 1.3 --- Story_admin.class 1 Jul 2003 03:51:41 -0000 1.4 *************** *** 184,188 **** $story = pslNew("Story"); ! $titlebar = getTitlebar("100%",$ary[title]); /* assume only one topic */ --- 184,188 ---- $story = pslNew("Story"); ! $titlebar = getTitlebar("100%",$ary['title']); /* assume only one topic */ *************** *** 244,247 **** --- 244,261 ---- $this->db->next_record(); + // check whether we were sent a file: + + if ( + is_uploaded_file($_FILES['body_text_file']['tmp_name']) + ) { + + $binary_junk = parse_upload($_FILES['body_text_file']['tmp_name']); + // append this file to the text typed in TEXT box: + $ary['body_text'] .= addslashes($binary_junk); + + } // end if isset ary[body_text_file] + + //debug( "Story_admin.class::showStory::ary",$ary ); + # set the formatting options for display only if ($ary['content'] == "exttrans") { *************** *** 552,555 **** --- 566,570 ---- $ary['intro_text'] = ''; $ary['body_text'] = ''; + $ary['body_text_file'] = ''; $ary['title'] = ''; $ary['story_date'] = ''; *************** *** 591,612 **** $ary['body_text'] = clean($ary['body_text']); $ary['title'] = clean($ary['title']); - - // this holds the file content if a file was submitted: - // This is dealt with later in this function, so I'm not adding slashes now.. - if ( - isset($ary['body_text_file']) && - is_file($ary['body_text_file']) - ) { - $binary_junk = parse_upload($ary['body_text_file']); - // append this file to the text typed in TEXT box: - $ary['body_text'] .= addslashes($binary_junk); - - } // end if isset ary[body_text_file] - - // Uncomment this if you want to take out iso-8859-1 characters - // and put standard html &CHAR; substitutes - // $ary['body_text'] = put_latin($ary['body_text']); - // $ary['intro_text'] = put_latin($ary['intro_text']); - // $ary['title'] = put_latin($ary['title']); if( $ary['story_date'] ) { --- 606,609 ---- |