function action(&$c) { set_menu($c); $c->set('_page_title', 'キーワード一覧'); $imgs = $c->image->find(); $labels = array(); foreach ($imgs as $k => $v) { $tmp_arr = explode(',', $v['label']); foreach ($tmp_arr as $l) { $l = trim($l); if (!isset($labels[$l])) { $labels[$l] = 0; } $labels[$l]++; } } ksort($labels); //保存する if (count($labels) > 1 or count($labels) == 1 && !isset($labels[''])) { $labels_ = $labels; unset($labels_['']); $c->admin->saveLabels('replace', array_keys($labels_)); } $c->set('labels', $labels); }
function action(&$c) { $c->set('_page_title', 'ファイルチェック'); set_menu($c); $dir_obj = dir(SWFU_DATA_DIR); //make image list (and del nofile data) $log_del[] = array(); $imgs[] = array(); $tmp_imgs = $c->image->find(); foreach ($tmp_imgs as $k => $v) { //存在しないファイルを削除 if (!file_exists(SWFU_DATA_DIR . $v['name'])) { $c->image->del('$id==' . $v['id']); $log_del[] = $v['name']; } else { $imgs[$v['name']] = $k; } } $c->set('log_del', $log_del); $log[] = array(); while ($entry = $dir_obj->read()) { if (!is_dir(SWFU_DATA_DIR . $entry) && $entry[0] != '.' && !isset($imgs[$entry])) { $stat = stat(SWFU_DATA_DIR . $entry); $name = $entry; $time = $stat['mtime']; $size = $stat['size']; $c->image->regist($name, $time, $size); $log[] = $name; } } $c->set('log', $log); }
function action(&$c) { $c->setViewFile('ctp/index_.html'); $c->set('_page_title', 'トップ'); if (isset($_SESSION['swfu']['page_name'])) { unset($_SESSION['swfu']['page_name']); } set_menu($c); }
function action(&$c) { set_menu($c); $c->set('_page_title', 'トップ'); $page_name = isset($_GET['page']) ? $_GET['page'] : ''; $c->set('page_name', $page_name); $config = $c->admin->getConfig(); if ($config['overwrite']) { $c->set('overwrite_msg', '上書き保存'); } else { $c->set('overwrite_msg', '自動で別名保存'); } $_additional_head = ''; $c->set('_additional_head', $_additional_head); }
function action(&$c) { set_menu($c); $c->set('_page_title', '画像名一覧'); $imgs = $c->image->find(); $images = array(); foreach ($imgs as $k => $v) { $fname = $v['name']; $head = $fname[0]; if (!isset($images[$head])) { $images[$head] = array(); } $images[$head][] = $v; } ksort($images); $c->set('images', $images); }
function action(&$c) { set_menu($c); $c->set('_page_title', 'ページ名一覧'); $imgs = $c->image->find(); $pages = array(); foreach ($imgs as $k => $v) { $pname = $v['page_name']; if ($pname != '') { $matches = array(); $head = preg_match('/^([A-Za-z])/', $pname, $matches) ? $matches[1] : (preg_match('/^([ -~])/', $pname, $matches) ? '__symbol__' : '__other__'); } else { $head = '__nolabel__'; } if (!isset($pages[$head])) { $pages[$head] = array(); } $pages[$head][$pname][] = $v; } ksort($pages); $c->set('pages', $pages); }
function action(&$c) { set_menu($c); //表示 if (isset($_GET['id']) && ($img = $c->image->findone('$id==' . $_GET['id']))) { $c->set('image', $img); $c->set('_page_title', $img['name'] . '詳細'); } else { $c->set('_page_title', '見つかりません'); } if (isset($_SESSION['swfu']['page_name'])) { $page = $_SESSION['swfu']['page_name']; $c->set('page_name', $page); $images = $c->image->find('$page_name=="' . $page . '"', 'created desc'); $c->set('images', $images); } //apikey $apikey = $c->admin->regenerateApiKey(); $c->set('apikey', $apikey); //更新の確認 if (isset($_POST['confirm'])) { $c->set('id', $_POST['id']); $c->set('name', $_POST['name']); $c->set('description', $_POST['description']); $c->set('page_name', $_POST['page_name']); $labels = explode(',', $_POST['label']); foreach ($labels as $k => $v) { $labels[$k] = trim($v); } $c->set('label', implode(',', $labels)); //file name check $cur_rs = $c->image->findone('$id=="' . $_POST['id'] . '"'); if ($cur_rs['name'] != $_POST['name']) { if (!preg_match('/^[a-zA-Z0-9._-]+$/', $_POST['name'])) { $update_error .= 'ファイル名は、英数半角以外使えません<br />'; $c->set('notice_name', '<span style="color:red">←</span>'); } if ($c->image->findone('$name=="' . $_POST['name'] . '"')) { $update_error .= '同じファイル名が、存在します<br />'; $c->set('notice_name', '<span style="color:red">←</span>'); } $matches = array(); preg_match('/^(.*)\\.(.*)$/', $_POST['name'], $matches); $new_ext = $matches[2]; preg_match('/^(.*)\\.(.*)$/', $cur_rs['name'], $matches); $cur_ext = $matches[2]; if ($cur_ext != $new_ext) { $update_error .= '拡張子は、変更しないで下さい<br />'; $c->set('notice_name', '<span style="color:red">←</span>'); } } $c->set('update_error', $update_error); $c->setViewFile('ctp/image_confirm.html'); return; } //更新を実行 if (isset($_POST['update'])) { $old = $c->image->findone('$id=="' . $_POST['id'] . '"'); $new = array('id' => $_POST['id'], 'name' => $_POST['name'], 'description' => $_POST['description'], 'page_name' => $_POST['page_name'], 'label' => $_POST['label'], 'created' => time()); $c->image->update($new); if ($old['name'] != $new['name']) { rename(SWFU_DATA_DIR . $old['name'], SWFU_DATA_DIR . $new['name']); } $c->redirect('view.php?id=' . $_POST['id']); } //キャンセル if (isset($_POST['cancel'])) { $c->redirect('view.php?id=' . $_POST['id']); } //ファイルの上書き if (isset($_POST['replace'])) { if (!isset($_FILES["newfile"]) || !is_uploaded_file($_FILES["newfile"]["tmp_name"]) || $_FILES["newfile"]["error"] != 0) { $up_errmsg = 'このファイルはアップロードできません【' . $_FILES["newfile"]["error"] . '】'; $c->set('up_errmsg', '<span style="color:red">' . $up_errmsg . '</span><br />'); return; } $old = $c->image->findone('$id=="' . $_POST['id'] . '"'); $upload_file = $old['name']; $up_parts = pathinfo($upload_file); $newfile = $_FILES['newfile']['name']; $new_parts = pathinfo($newfile); if ($new_parts['extension'] == $up_parts['extension']) { $upload_file = SWFU_DATA_DIR . $upload_file; move_uploaded_file($_FILES['newfile']['tmp_name'], $upload_file); chmod($upload_file, 0666); $c->flash('view.php?id=' . $_POST['id']); return; } else { $up_errmsg = '上書きするファイルと元ファイルのファイル拡張子が違います'; $c->set('up_errmsg', '<span style="color:red">' . $up_errmsg . '</span><br />'); return; } } //削除 if (isset($_GET['delete'])) { $fname = $_GET['delete']; $img = $c->image->findone('$name=="' . $fname . '"'); $c->image->del('$id=="' . $img['id'] . '"'); if (file_exists(SWFU_DATA_DIR . $fname)) { unlink(SWFU_DATA_DIR . $fname); } if (isset($_SESSION['swfu']['page_name'])) { $c->redirect('list.php?page=' . rawurlencode($_SESSION['swfu']['page_name'])); } else { $c->redirect('index.php'); } } //ダウンロード if (isset($_GET['dl'])) { $fname = $_GET['dl']; $fp = fopen(SWFU_DATA_DIR . $fname, "rb"); header("Cache-Control: public"); header("Pragma: public"); header("Accept-Ranges: none"); header("Content-Transfer-Encoding: binary"); header("Content-Disposition: attachment; filename={$fname}"); header("Content-Type: application/octet-stream; name={$fname}"); fpassthru($fp); fclose($fp); exit; } }
$i++; $install_file[$i]['file'] = 'tests'; $install_file[$i]['name'] = 'Preliminary tests'; $i++; $install_file[$i]['file'] = 'db_update'; $install_file[$i]['name'] = 'Databse Update'; $i++; $install_file[$i]['file'] = 'selection'; $install_file[$i]['name'] = 'Package Selection'; $i++; $install_file[$i]['file'] = 'download'; $install_file[$i]['name'] = 'Package download'; $i++; $install_file[$i]['file'] = 'upgrade'; $install_file[$i]['name'] = 'Package Upgrade'; $i++; $install_file[$i]['file'] = 'verification'; $install_file[$i]['name'] = 'Database Verification'; $i++; $install_file[$i]['file'] = 'final'; $install_file[$i]['name'] = 'Upgrade Complete'; // finally we are ready to include the actual php file include_once 'install_' . $install_file[$step]['file'] . '.php'; // this is used in the menu $_SESSION['first_install'] = TRUE; $install_file = set_menu($install_file, $step); $gBitSmarty->assign('menu_path', PACKAGER_PKG_URL); $gBitSmarty->assign('menu_file', 'install.php'); $gBitSmarty->assign('section', 'Packager'); $gBitSmarty->assign('install_file', PACKAGER_PKG_PATH . "templates/install_" . $install_file[$step]['file'] . $app . ".tpl"); $gBitInstaller->display(INSTALL_PKG_PATH . 'templates/install.tpl', $install_file[$step]['name']);
function action(&$c) { set_menu($c); $c->set('_page_title', 'SWFUの設定'); $admin_org = array(); $admin_org = $c->admin->find('', 'id ASC'); $config = $c->admin->getConfig(); $c->set("settings", $admin_org); // 変更処理 if (isset($_POST['set'])) { $admin = $c->data['admin']; $errmsg = ""; $setdata = array(); foreach ($admin_org as $row) { $name = $row['name']; if (isset($admin[$name])) { $id = $row['id']; $value = isset($admin[$name]) ? $admin[$name] : ""; switch ($name) { case 'overwrite': $errmsg .= $c->v->notempty($value, $row['jname'] . 'を選択してください'); break; case 'recent_page': case 'recent_file': $errmsg .= $c->v->notempty($value, $row['jname'] . 'を入力してください'); $errmsg .= $c->v->number($value, $row['jname'] . 'は半角数字で入力してください<br />'); break; case 'list_num': $errmsg .= $c->v->notempty($value, $row['jname'] . 'を入力してください'); $errmsg .= $c->v->number($value, $row['jname'] . 'は半角数字で入力してください<br />'); if ($errmsg == "") { $errmsg .= $value < 1 ? $row['jname'] . 'は1以上を設定してください<br />' : ''; } break; case 'list_cols': $errmsg .= $c->v->notempty($value, $row['jname'] . 'を入力してください'); $errmsg .= $c->v->number($value, $row['jname'] . 'は半角数字で入力してください<br />'); if ($errmsg == "") { $errmsg .= $value < 1 ? $row['jname'] . 'は1以上を設定してください<br />' : ''; } break; } $setdata[$name] = array('id' => $id, 'value' => $value); } } if ($errmsg == "") { if (isset($setdata['list_num']) && isset($setdata['list_cols'])) { $num = (int) $setdata['list_num']['value']; $col = (int) $setdata['list_cols']['value']; $setdata['list_num']['value'] = $num * $col; } foreach ($setdata as $row) { if ($c->admin->update($row) == true) { } else { $errmsg .= "更新に失敗しました。【id=" . $id . ", value=" . $value . "】<br />"; } } } if ($errmsg == "") { $c->redirect("admin_settings.php"); return; } $c->set("admin", $admin); } else { if (isset($c->data['admin'])) { // 戻るボタンなど $admin = $c->data['admin']; $c->set("admin", $admin); } else { $num = (int) $config['list_num']; $col = (int) $config['list_cols']; $config['list_num'] = $num % $col == 0 ? $num / $col : $num / $col + 1; $c->set("admin", $config); } } if ($errmsg != "") { $errmsg = '<p style="color:red">' . $errmsg . "</p>"; } $c->set("errmsg", $errmsg); }
function action(&$c) { set_menu($c); $c->set('_page_title', 'トップ'); $page_name = isset($_GET['page']) ? $_GET['page'] : ''; $c->set('page_name', $page_name); $config = $c->admin->getConfig(); if ($config['overwrite']) { $c->set('overwrite_msg', '上書き保存'); $overwrite = 1; } else { $c->set('overwrite_msg', '自動で別名保存'); $overwrite = 0; } $_additional_head = <<<EOD <link rel="stylesheet" type="text/css" href="css/swfu.css" /> <script type="text/javascript" src="swfupload/swfupload.js"></script> <script type="text/javascript" src="js/swfupload.queue.js"></script> <script type="text/javascript" src="js/fileprogress.js"></script> <script type="text/javascript" src="js/handlers.js"></script> <script type="text/javascript"> \t\tvar _ieVersion = (function(_doc, reg) { \t\t return _doc.documentMode ? _doc.documentMode : \t\t /*@cc_on!@*/false && _nav.userAgent.match(reg) ? RegExp.\$1 * 1 : 0; \t\t })(document, /MSIE\\s([0-9]+[\\.0-9]*)/), \t\t _isMSIE = _ieVersion > 0 ? true : false; \t\tvar swfu; \t\twindow.onload = function() { \t\t\tvar up2 = '../'; \t\t\tif(_isMSIE){ //IE \t\t\t\tup2 = ''; \t\t\t} \t\t\tvar settings = { \t\t\t\tflash_url : "./swfupload/swfupload.swf", \t\t\t\tupload_url: up2+"upload.php",\t// Relative to the SWF file \t\t\t\tpost_params: { \t\t\t\t\t"PHPSESSID" : "{$ssid}", \t\t\t\t\t"PAGENAME" : "{$page_name}", \t\t\t\t\t"OVERWRITE" : "{$overwrite}" \t\t\t\t}, \t\t\t\tfile_size_limit : "100 MB", \t\t\t\tfile_types : "*.*", \t\t\t\tfile_types_description : "All Files", \t\t\t\tfile_upload_limit : 100, \t\t\t\tfile_queue_limit : 0, \t\t\t\tcustom_settings : { \t\t\t\t\tprogressTarget : "fsUploadProgress", \t\t\t\t\tcancelButtonId : "btnCancel" \t\t\t\t}, \t\t\t\tdebug: false, \t\t\t\t// Button settings \t\t\t\tbutton_image_url: "images/TestImageNoText_65x29.png",\t// Relative to the Flash file \t\t\t\tbutton_width: "65", \t\t\t\tbutton_height: "29", \t\t\t\tbutton_placeholder_id: "spanButtonPlaceHolder", \t\t\t\tbutton_text: '<span class="theFont">Click</span>', \t\t\t\tbutton_text_style: ".theFont { font-size: 16; }", \t\t\t\tbutton_text_left_padding: 11, \t\t\t\tbutton_text_top_padding: 5, \t\t\t\t \t\t\t\t// The event handler functions are defined in handlers.js \t\t\t\tfile_queued_handler : fileQueued, \t\t\t\tfile_queue_error_handler : fileQueueError, \t\t\t\tfile_dialog_complete_handler : fileDialogComplete, \t\t\t\tupload_start_handler : uploadStart, \t\t\t\tupload_progress_handler : uploadProgress, \t\t\t\tupload_error_handler : uploadError, \t\t\t\tupload_success_handler : uploadSuccess, \t\t\t\tupload_complete_handler : uploadComplete, \t\t\t\tqueue_complete_handler : queueComplete\t// Queue plugin event \t\t\t}; \t\t\tswfu = new SWFUpload(settings); \t }; \t</script> EOD; $c->set('_additional_head', $_additional_head); }
</script> </DIV> </DIV> <DIV id="main"><!-- contenue de la page --> <?php /**************************************************** gestion du menu */ if (isset($_POST["menu_link"])) { $current_page = $menu_path[$_POST["menu_link"]]; } else { $current_page = HOME_PATH; } require $current_page; ?> </DIV> <?php set_menu($menu); /************************************** affichage du menu */ ?> <DIV id="footer"><!-- les logo et les liens --> <?php $affil_cnt = count($user_affiliation); for ($i = 0; $i < $affil_cnt; $i++) { echo "<A href=" . $user_affiliation[$i]["link"] . "><IMG src=" . $user_affiliation[$i]["logo"] . "alt=" . $user_affiliation[$i]["name"] . "width='130'/></A>"; } ?> </DIV> </DIV> </DIV> </BODY> </HTML> <?php
function action(&$c) { set_menu($c); /** *********************************************************************** * 表示のページネーション、クエリの準備 * * pn_sizeを変えると、一頁当たりの表示が変わる。 * ***************************************************************************/ //pagenation setting $pagination = new Pagination(); $pn_size = $c->admin->getListNum(); $pn_page = isset($_GET['pn_page']) ? $_GET['pn_page'] : 1; $order_tmp = '<a href="list.php?%QUERY%=%VALUE%&order=%ORDER%&sort=%SORT%">%TITLE%</a>'; $order_que = ''; //表示用のパラメータをセット $c->set('cols', $c->admin->getListCols()); //query のテンプレを作る $order_link = array(); $skey = array('/%ORDER%/', '/%SORT%/', '/%TITLE%/'); $rkey = array('created', 'desc', '新しい順'); $o1 = preg_replace($skey, $rkey, $order_tmp); $rkey = array('created', 'asc', '古い順'); $o2 = preg_replace($skey, $rkey, $order_tmp); $order_link['更新日'] = array($o1, $o2); $rkey = array('size', 'desc', '大きい'); $o1 = preg_replace($skey, $rkey, $order_tmp); $rkey = array('size', 'asc', '小さい'); $o2 = preg_replace($skey, $rkey, $order_tmp); $order_link['サイズ'] = array($o1, $o2); $rkey = array('name', 'asc', '昇順'); $o1 = preg_replace($skey, $rkey, $order_tmp); $rkey = array('size', 'desc', '降順'); $o2 = preg_replace($skey, $rkey, $order_tmp); $order_link['名前'] = array($o1, $o2); /** *********************************************************************** * セッションから、ページ名を作成、並び替えのクエリをセット * * * ***************************************************************************/ //ページ名設定 if (isset($_SESSION['swfu']['page_name'])) { $page = $_SESSION['swfu']['page_name']; $c->set('page_name', $page); $images = $c->image->find('$page_name=="' . $page . '"', 'created desc'); $c->set('images', $images); } //並び替えクエリ if (isset($_GET['order']) && isset($_GET['sort'])) { $order_que = '&order=' . $_GET['order'] . '&sort=' . $_GET['sort']; } /** *********************************************************************** * ページ名の変更 * ***************************************************************************/ if (isset($_POST['change_page_name'])) { $old_page = $_POST['old_page']; $new_page = $_POST['new_page']; $rs = $c->image->find('$page_name=="' . $old_page . '"'); foreach ($rs as $r) { $r['page_name'] = $new_page; $c->image->update($r); } $c->redirect('list.php?page=' . rawurlencode($new_page)); } /** *********************************************************************** * ページ名の設定 * ***************************************************************************/ if (isset($_POST['set_page_name'])) { if ($_POST['new_page'] == '') { $c->redirect('index.php'); } else { $_SESSION['swfu']['page_name'] = $_POST['new_page']; $c->redirect('list.php?page=' . rawurlencode($_POST['new_page'])); } } /** *********************************************************************** * pageをもとに、リストを表示 * * * ***************************************************************************/ if (isset($_GET['page'])) { $page = $_GET['page']; $cond = '$page_name=="' . $page . '"'; $order = $order_que == '' ? 'created desc' : $_GET['order'] . ' ' . $_GET['sort']; $total_cnt = $c->image->getCount($cond); $pagination->setLink('list.php?page=' . rawurlencode($page) . '&pn_page=##PN_PAGE##' . $order_que); $pagination->setPage($pn_page); $pagination->setSize($pn_size); $pagination->setTotalRecords($total_cnt); $limit = $pagination->getLimit(); $images = $c->image->find($cond, $order, $limit); $c->set('images', $images); $c->set('pagination_link', $pagination->create_links()); $disp_pagename = $page == '' ? '未分類' : $page; $c->set('h2title', '「' . $disp_pagename . '」のファイル一覧'); $skey = array('/%QUERY%/', '/%VALUE%/'); $rkey = array('page', rawurlencode($page)); $str = ''; foreach ($order_link as $key => $val) { $str .= $key . '['; foreach ($val as $k => $v) { $order_link[$key][$k] = preg_replace($skey, $rkey, $v); } $str .= implode(' , ', $order_link[$key]); $str .= '] '; } $page_form = ' <form class="style_form" action="' . $_SERVER['PHP_SELF'] . '" method="post" style="text-align:right"> <input id="change_page_name" type="text" name="new_page" size="14" value="' . $page . '" /> <input type="submit" value="変更" name="change_page_name" onclick="return confirm_page_chg(\'' . $page . '\');" /> <input type="hidden" name="old_page" value="' . $page . '" /> </form>'; $page_form_set = ' <form class="style_form" action="' . $_SERVER['PHP_SELF'] . '" method="post" style="float:left;"> <input id="new_page" type="hidden" name="new_page" value="' . $page . '" /> <input type="submit" value="セット" name="set_page_name" onclick="return confirm_page_set();" /> <input type="hidden" name="old_page" value="' . $page . '" /> </form>'; $c->set('page_form', $page_form); $c->set('page_form_set', $page_form_set); $c->set('order_link', $str); return; } /** *********************************************************************** * labelをもとに、リストを表示 * * * ***************************************************************************/ if (isset($_GET['label'])) { $label = $_GET['label']; $cond = 'array_key_exists( "' . $label . '", array_flip(explode(",",$label)) )'; $order = $order_que == '' ? 'created desc' : $_GET['order'] . ' ' . $_GET['sort']; $total_cnt = $c->image->getCount($cond); $pagination->setLink('list.php?label=' . rawurlencode($label) . '&pn_page=##PN_PAGE##' . $order_que); $pagination->setPage($pn_page); $pagination->setSize($pn_size); $pagination->setTotalRecords($total_cnt); $limit = $pagination->getLimit(); $images = $c->image->find($cond, $order, $limit); $c->set('images', $images); $c->set('pagination_link', $pagination->create_links()); $label = $label == '' ? 'ラベルなし' : $label; $c->set('h2title', '「' . $label . '」ラベルのファイル一覧'); $skey = array('/%QUERY%/', '/%VALUE%/'); $rkey = array('label', rawurlencode($label)); $str = ''; foreach ($order_link as $key => $val) { $str .= $key . '['; foreach ($val as $k => $v) { $order_link[$key][$k] = preg_replace($skey, $rkey, $v); } $str .= implode(' , ', $order_link[$key]); $str .= '] '; } $c->set('order_link', $str); return; } /** *********************************************************************** * searchをもとに、リストを表示 * * * ***************************************************************************/ if (isset($_GET['search'])) { $search = $_GET['search']; $search_arr = explode(' ', $_GET['search']); //name , description , page_name , label を検索 $tmparr = array(); foreach (array('name', 'description', 'page_name', 'label') as $key) { //OR $arr = array(); foreach ($search_arr as $s) { //AND $arr[] = '(strpos(strtoupper($' . $key . '),"' . strtoupper($s) . '")!==false)'; } $tmparr[] = '(' . implode(' && ', $arr) . ')'; } $cond = implode(' || ', $tmparr); $order = $order_que == '' ? 'created desc' : $_GET['order'] . ' ' . $_GET['sort']; $total_cnt = $c->image->getCount($cond); $pagination->setLink('list.php?search=' . rawurlencode($search) . '&pn_page=##PN_PAGE##' . $order_que); $pagination->setPage($pn_page); $pagination->setSize($pn_size); $pagination->setTotalRecords($total_cnt); $limit = $pagination->getLimit(); $images = $c->image->find($cond, $order, $limit); $c->set('images', $images); $c->set('pagination_link', $pagination->create_links()); $c->set('h2title', '「' . $search . '」検索一覧'); $skey = array('/%QUERY%/', '/%VALUE%/'); $rkey = array('search', rawurlencode($search)); $str = ''; foreach ($order_link as $key => $val) { $str .= $key . '['; foreach ($val as $k => $v) { $order_link[$key][$k] = preg_replace($skey, $rkey, $v); } $str .= implode(' , ', $order_link[$key]); $str .= '] '; } $c->set('order_link', $str); return; } //削除 if (isset($_GET['delete'])) { $fname = $_GET['delete']; $img = $c->image->findone('$name=="' . $fname . '"'); $c->image->del('$id=="' . $img['id'] . '"'); if (file_exists(SWFU_DATA_DIR . $fname)) { unlink(SWFU_DATA_DIR . $fname); } $c->redirect('index.php'); } //ダウンロード if (isset($_GET['dl'])) { $fname = $_GET['dl']; $fp = fopen(SWFU_DATA_DIR . $fname, "rb"); header("Cache-Control: public"); header("Pragma: public"); header("Accept-Ranges: none"); header("Content-Transfer-Encoding: binary"); header("Content-Disposition: attachment; filename={$fname}"); header("Content-Type: application/octet-stream; name={$fname}"); fpassthru($fp); fclose($fp); exit; } }