Example #1
0
 // 에러메세지는 출력하지 않는다.
 //-----------------------------------------------------------------
 $timg = @getimagesize($tmp_file);
 // image type
 if (preg_match("/\\.({$config['cf_image_extension']})\$/i", $filename) || preg_match("/\\.({$config['cf_flash_extension']})\$/i", $filename)) {
     if ($timg['2'] < 1 || $timg['2'] > 16) {
         continue;
     }
 }
 //=================================================================
 if ($w == 'u') {
     // 존재하는 파일이 있다면 삭제합니다.
     @unlink(G5_DATA_PATH . '/qa/' . $write['qa_file' . $i]);
     // 이미지파일이면 썸네일삭제
     if (preg_match("/\\.({$config['cf_image_extension']})\$/i", $write['qa_file' . $i])) {
         delete_qa_thumbnail($row['qa_file' . $i]);
     }
 }
 // 프로그램 원래 파일명
 $upload[$i]['source'] = $filename;
 $upload[$i]['filesize'] = $filesize;
 // 아래의 문자열이 들어간 파일은 -x 를 붙여서 웹경로를 알더라도 실행을 하지 못하도록 함
 $filename = preg_replace("/\\.(php|phtm|htm|cgi|pl|exe|jsp|asp|inc)/i", "\$0-x", $filename);
 shuffle($chars_array);
 $shuffle = implode('', $chars_array);
 // 첨부파일 첨부시 첨부파일명에 공백이 포함되어 있으면 일부 PC에서 보이지 않거나 다운로드 되지 않는 현상이 있습니다. (길상여의 님 090925)
 $upload[$i]['file'] = abs(ip2long($_SERVER['REMOTE_ADDR'])) . '_' . substr($shuffle, 0, 8) . '_' . replace_filename($filename);
 $dest_file = G5_DATA_PATH . '/qa/' . $upload[$i]['file'];
 // 업로드가 안된다면 에러메세지 출력하고 죽어버립니다.
 $error_code = move_uploaded_file($tmp_file, $dest_file) or die($_FILES['bf_file']['error'][$i]);
 // 올라간 파일의 퍼미션을 변경합니다.
Example #2
0
        @unlink(G5_DATA_PATH . '/qa/' . $row['qa_file' . $k]);
        // 썸네일삭제
        if (preg_match("/\\.({$config['cf_image_extension']})\$/i", $row['qa_file' . $k])) {
            delete_qa_thumbnail($row['qa_file' . $k]);
        }
    }
    // 에디터 썸네일 삭제
    delete_editor_thumbnail($row['qa_content']);
    // 답변이 있는 질문글이라면 답변글 삭제
    if (!$row['qa_type'] && $row['qa_status']) {
        $row2 = sql_fetch(" select qa_content, qa_file1, qa_file2 from {$g5['qa_content_table']} where qa_parent = '{$qa_id}' ");
        // 첨부파일 삭제
        for ($k = 1; $k <= 2; $k++) {
            @unlink(G5_DATA_PATH . '/qa/' . $row2['qa_file' . $k]);
            // 썸네일삭제
            if (preg_match("/\\.({$config['cf_image_extension']})\$/i", $row2['qa_file' . $k])) {
                delete_qa_thumbnail($row2['qa_file' . $k]);
            }
        }
        // 에디터 썸네일 삭제
        delete_editor_thumbnail($row2['qa_content']);
        sql_query(" delete from {$g5['qa_content_table']} where qa_type = '1' and qa_parent = '{$qa_id}' ");
    }
    // 답변글 삭제시 질문글의 상태변경
    if ($row['qa_type']) {
        sql_query(" update {$g5['qa_content_table']} set qa_status = '0' where qa_id = '{$row['qa_parent']}' ");
    }
    // 글삭제
    sql_query(" delete from {$g5['qa_content_table']} where qa_id = '{$qa_id}' ");
}
goto_url(G5_ADMIN_URL . '/shop_admin/admin_qalist.php?' . preg_replace('/^&amp;/', '?', $qstr));