• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

コミットメタ情報

リビジョン3b2094784e7976cf0e053f71ff9ce76deee20221 (tree)
日時2017-01-07 16:24:06
作者Keishi Tanaka <kc@hoku...>
コミッターKeishi Tanaka

ログメッセージ

Add is_downloadable_file function.

変更サマリ

差分

--- a/plugin/dlexec.php
+++ b/plugin/dlexec.php
@@ -53,7 +53,6 @@ download($key);
5353
5454 function download($auth_key){
5555
56- global $downloadable_path;
5756 $qm = get_qm();
5857
5958 $filename = isset($_GET['filename']) ? $_GET['filename'] : '';
@@ -63,14 +62,12 @@ function download($auth_key){
6362 $page = isset($_GET['refer']) ? $_GET['refer'] : '';
6463
6564 $filename = urldecode($filename);
66- $pathinfo = pathinfo($filename);
67- $downloadable_path_array = explode(";", $downloadable_path);
6865
6966 //validate
7067 $wikifile = 'wiki/'. encode($page) . '.txt';
7168 $source = file_exists($wikifile) ? file_get_contents($wikifile) : '';
7269
73- if(! in_array($pathinfo['dirname'], $downloadable_path_array, true))
70+ if(! is_downloadable_file($filename))
7471 {
7572 header('HTTP/1.1 403 Forbidden');
7673 error_msg('Error : Invalid access');
@@ -130,6 +127,13 @@ function download($auth_key){
130127
131128 }
132129
130+function is_downloadable_file($filename){
131+ global $downloadable_path;
132+ $pathinfo = pathinfo($filename);
133+ $paths = explode(";", $downloadable_path);
134+ return in_array($pathinfo['dirname'], $paths, true);
135+}
136+
133137 function dl_sendmail($email, $filename, $title){
134138
135139 global $smtp_auth, $smtp_server, $google_apps, $google_apps_domain;
--- a/pukiwiki.ini.php
+++ b/pukiwiki.ini.php
@@ -160,7 +160,7 @@ $modifierlink = 'http://www.example.co.jp/'; // Site admin's Web page
160160 $googlemaps_apikey = 'ABQIAAAAiGS5xMxFoCjNEIdoMGiCBRSh3wgB-evfR4k_uhb9NTlXTFSqGRScvANPOtehBVz7qEVDLEwY4PlLng';
161161 // Fit videos to screen
162162 $enable_fitvids = true;
163-// Downloadable path
163+// Downloadable path delimitered semicolon (;)
164164 $downloadable_path = 'swfu/d;pub';
165165
166166