ckfinder在Web服务器上实现脱机存储

Windows 2008 R2 IIS7 下新建虚拟目录使用UNC共享文件夹(即:虚拟目录使用UNC共享文件夹)的方法
1、UNC路径:\\192.168.1.2\test\,假设连接该UNC路径的用户名为:web,密码为:123
2、在原web服务器(192.168.1.1)上新建一个用户(注意:新建的用户名和密码必须与连接192.168.1.2的用户名和密码完全相同。即:用户名也是:web,密码也是:123)
3、在原web服务器(192.168.1.1)上启用添加虚拟目录向导,填入别名(如:OLD),物理路径填入UNC路径及目录(如:\\192.168.1.2\test\123 ,注意:路径不能使用映射网络驱动器盘符),点击“连接为”按钮后选择“特定用户”再点击“设置”按钮,在弹出的对话框中输入第2步中新建的用户名和密码,最后点击全部“确定”按钮。
4、访问:http://192.168.1.1/OLD
5、OK!
一句话:就是在原web服务器上建一新用户,用户名和密码跟连接UNC路径时的用户名和密码相同。

 

附:ckfinder 的 config.php 配置文件, 注意 $baseDir 变量的值

 

  1 <?php
  2 session_start();
  3 /*
  4  * ### CKFinder : Configuration File - Basic Instructions
  5  *
  6  * In a generic usage case, the following tasks must be done to configure
  7  * CKFinder:
  8  *     1. Check the $baseUrl and $baseDir variables;
  9  *     2. If available, paste your license key in the "LicenseKey" setting;
 10  *     3. Create the CheckAuthentication() function that enables CKFinder for authenticated users;
 11  *
 12  * Other settings may be left with their default values, or used to control
 13  * advanced features of CKFinder.
 14  */
 15 
 16 /**
 17  * This function must check the user session to be sure that he/she is
 18  * authorized to upload and access files in the File Browser.
 19  *
 20  * @return boolean
 21  */
 22 function CheckAuthentication()
 23 {
 24     // WARNING : DO NOT simply return "true". By doing so, you are allowing
 25     // "anyone" to upload and list the files in your server. You must implement
 26     // some kind of session validation here. Even something very simple as...
 27 
 28     // return isset($_SESSION['IsAuthorized']) && $_SESSION['IsAuthorized'];
 29 
 30     // ... where $_SESSION['IsAuthorized'] is set to "true" as soon as the
 31     // user logs in your system. To be able to use session variables don't
 32     // forget to add session_start() at the top of this file.
 33 
 34     return true;
 35 }
 36 
 37 // LicenseKey : Paste your license key here. If left blank, CKFinder will be
 38 // fully functional, in demo mode.
 39 $config['LicenseName'] = 'localhost';
 40 $config['LicenseKey'] = '1AG35W3UPVFF5TVQTYPWWLR51F8APX5H';
 41 
 42 /*
 43  Uncomment lines below to enable PHP error reporting and displaying PHP errors.
 44  Do not do this on a production server. Might be helpful when debugging why CKFinder does not work as expected.
 45 */
 46 // error_reporting(E_ALL);
 47 // ini_set('display_errors', 1);
 48 
 49 /*
 50 To make it easy to configure CKFinder, the $baseUrl and $baseDir can be used.
 51 Those are helper variables used later in this config file.
 52 */
 53 
 54 /*
 55 $baseUrl : the base path used to build the final URL for the resources handled
 56 in CKFinder. If empty, the default value (/userfiles/) is used.
 57 
 58 Examples:
 59     $baseUrl = 'http://example.com/ckfinder/files/';
 60     $baseUrl = '/userfiles/';
 61 
 62 ATTENTION: The trailing slash is required.
 63 */
 64 $baseUrl = '/ckfinder/userfiles/' . $_SESSION['nodeFilesRoute'] . '/';
 65 // $baseDir = 'Z:/ckfinder/userfiles/' . $_SESSION['nodeFilesRoute'] . '/';
 66 $baseDir = '//A1/shared/ckfinder/userfiles/' . $_SESSION['nodeFilesRoute'] . '/';
 67 
 68 /*
 69 $baseDir : the path to the local directory (in the server) which points to the
 70 above $baseUrl URL. This is the path used by CKFinder to handle the files in
 71 the server. Full write permissions must be granted to this directory.
 72 
 73 Examples:
 74     // You may point it to a directory directly:
 75     $baseDir = '/home/login/public_html/ckfinder/files/';
 76     $baseDir = 'C:/SiteDir/CKFinder/userfiles/';
 77 
 78     // Or you may let CKFinder discover the path, based on $baseUrl.
 79     // WARNING: resolveUrl() *will not work* if $baseUrl does not start with a slash ("/"),
 80     // for example if $baseDir is set to  http://example.com/ckfinder/files/
 81     $baseDir = resolveUrl($baseUrl);
 82 
 83 ATTENTION: The trailing slash is required.
 84 */
 85 // $baseDir = resolveUrl($baseUrl);
 86 
 87 /*
 88  * ### Advanced Settings
 89  */
 90 
 91 /*
 92 Thumbnails : thumbnails settings. All thumbnails will end up in the same
 93 directory, no matter the resource type.
 94 */
 95 $config['Thumbnails'] = Array(
 96         'url' => $baseUrl . '_thumbs',
 97         'directory' => $baseDir . '_thumbs',
 98         'enabled' => true,
 99         'directAccess' => false,
100         'maxWidth' => 100,
101         'maxHeight' => 100,
102         'bmpSupported' => false,
103         'quality' => 100);
104 
105 /*
106 Set the maximum size of uploaded images. If an uploaded image is larger, it
107 gets scaled down proportionally. Set to 0 to disable this feature.
108 */
109 $config['Images'] = Array(
110         'maxWidth' => 1600,
111         'maxHeight' => 1200,
112         'quality' => 80);
113 
114 /*
115 RoleSessionVar : the session variable name that CKFinder must use to retrieve
116 the "role" of the current user. The "role", can be used in the "AccessControl"
117 settings (bellow in this page).
118 
119 To be able to use this feature, you must initialize the session data by
120 uncommenting the following "session_start()" call.
121 */
122 $config['RoleSessionVar'] = 'CKFinder_UserRole';
123 //session_start();
124 
125 /*
126 AccessControl : used to restrict access or features to specific folders.
127 
128 Many "AccessControl" entries can be added. All attributes are optional.
129 Subfolders inherit their default settings from their parents' definitions.
130 
131     - The "role" attribute accepts the special '*' value, which means
132       "everybody".
133     - The "resourceType" attribute accepts the special value '*', which
134       means "all resource types".
135 */
136 
137 $config['AccessControl'][] = Array(
138         'role' => '*',
139         'resourceType' => '*',
140         'folder' => '/',
141 
142         'folderView' => true,
143         'folderCreate' => true,
144         'folderRename' => true,
145         'folderDelete' => true,
146 
147         'fileView' => true,
148         'fileUpload' => true,
149         'fileRename' => true,
150         'fileDelete' => true);
151 
152 /*
153 For example, if you want to restrict the upload, rename or delete of files in
154 the "Logos" folder of the resource type "Images", you may uncomment the
155 following definition, leaving the above one:
156 
157 $config['AccessControl'][] = Array(
158         'role' => '*',
159         'resourceType' => 'Images',
160         'folder' => '/Logos',
161 
162         'folderView' => true,
163         'folderCreate' => true,
164         'folderRename' => true,
165         'folderDelete' => true,
166 
167         'fileView' => true,
168         'fileUpload' => false,
169         'fileRename' => false,
170         'fileDelete' => false);
171 */
172 
173 /*
174 ResourceType : defines the "resource types" handled in CKFinder. A resource
175 type is nothing more than a way to group files under different paths, each one
176 having different configuration settings.
177 
178 Each resource type name must be unique.
179 
180 When loading CKFinder, the "type" querystring parameter can be used to display
181 a specific type only. If "type" is omitted in the URL, the
182 "DefaultResourceTypes" settings is used (may contain the resource type names
183 separated by a comma). If left empty, all types are loaded.
184 
185 maxSize is defined in bytes, but shorthand notation may be also used.
186 Available options are: G, M, K (case insensitive).
187 1M equals 1048576 bytes (one Megabyte), 1K equals 1024 bytes (one Kilobyte), 1G equals one Gigabyte.
188 Example: 'maxSize' => "8M",
189 */
190 $config['DefaultResourceTypes'] = '';
191 
192 $config['ResourceType'][] = Array(
193         'name' => 'Files',                // Single quotes not allowed
194         'url' => $baseUrl . 'files',
195         'directory' => $baseDir . 'files',
196         'maxSize' => 0,
197         'allowedExtensions' => '7z,aiff,asf,avi,bmp,csv,doc,docx,fla,flv,gif,gz,gzip,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,ods,odt,pdf,png,ppt,pptx,pxd,qt,ram,rar,rm,rmi,rmvb,rtf,sdc,sitd,swf,sxc,sxw,tar,tgz,tif,tiff,txt,vsd,wav,wma,wmv,xls,xlsx,zip',
198         'deniedExtensions' => '');
199 
200 $config['ResourceType'][] = Array(
201         'name' => 'Images',
202         'url' => $baseUrl . 'images',
203         'directory' => $baseDir . 'images',
204         'maxSize' => 0,
205         'allowedExtensions' => 'bmp,gif,jpeg,jpg,png',
206         'deniedExtensions' => '');
207 
208 $config['ResourceType'][] = Array(
209         'name' => 'Flash',
210         'url' => $baseUrl . 'flash',
211         'directory' => $baseDir . 'flash',
212         'maxSize' => 0,
213         'allowedExtensions' => 'swf,flv',
214         'deniedExtensions' => '');
215 
216 /*
217  Due to security issues with Apache modules, it is recommended to leave the
218  following setting enabled.
219 
220  How does it work? Suppose the following:
221 
222     - If "php" is on the denied extensions list, a file named foo.php cannot be
223       uploaded.
224     - If "rar" (or any other) extension is allowed, one can upload a file named
225       foo.rar.
226     - The file foo.php.rar has "rar" extension so, in theory, it can be also
227       uploaded.
228 
229 In some conditions Apache can treat the foo.php.rar file just like any PHP
230 script and execute it.
231 
232 If CheckDoubleExtension is enabled, each part of the file name after a dot is
233 checked, not only the last part. In this way, uploading foo.php.rar would be
234 denied, because "php" is on the denied extensions list.
235 */
236 $config['CheckDoubleExtension'] = true;
237 
238 /*
239 If you have iconv enabled (visit http://php.net/iconv for more information),
240 you can use this directive to specify the encoding of file names in your
241 system. Acceptable values can be found at:
242     http://www.gnu.org/software/libiconv/
243 
244 Examples:
245     $config['FilesystemEncoding'] = 'CP1250';
246     $config['FilesystemEncoding'] = 'ISO-8859-2';
247 */
248 $config['FilesystemEncoding'] = 'UTF-8';
249 
250 /*
251 Perform additional checks for image files
252 if set to true, validate image size
253 */
254 $config['SecureImageUploads'] = true;
255 
256 /*
257 Indicates that the file size (maxSize) for images must be checked only
258 after scaling them. Otherwise, it is checked right after uploading.
259 */
260 $config['CheckSizeAfterScaling'] = true;
261 
262 /*
263 For security, HTML is allowed in the first Kb of data for files having the
264 following extensions only.
265 */
266 $config['HtmlExtensions'] = array('html', 'htm', 'xml', 'js');
267 
268 /*
269 Folders to not display in CKFinder, no matter their location.
270 No paths are accepted, only the folder name.
271 The * and ? wildcards are accepted.
272 */
273 $config['HideFolders'] = Array(".svn", "CVS");
274 
275 /*
276 Files to not display in CKFinder, no matter their location.
277 No paths are accepted, only the file name, including extension.
278 The * and ? wildcards are accepted.
279 */
280 $config['HideFiles'] = Array(".*");
281 
282 /*
283 After file is uploaded, sometimes it is required to change its permissions
284 so that it was possible to access it at the later time.
285 If possible, it is recommended to set more restrictive permissions, like 0755.
286 Set to 0 to disable this feature.
287 Note: not needed on Windows-based servers.
288 */
289 $config['ChmodFiles'] = 0777 ;
290 
291 /*
292 See comments above.
293 Used when creating folders that does not exist.
294 */
295 $config['ChmodFolders'] = 0755 ;
296 
297 /*
298 Force ASCII names for files and folders.
299 If enabled, characters with diactric marks, like å, ä, ö, ć, č, đ, š
300 will be automatically converted to ASCII letters.
301 */
302 $config['ForceAscii'] = false;
303 
304 
305 include_once "plugins/imageresize/plugin.php";
306 include_once "plugins/fileeditor/plugin.php";
307 
308 $config['plugin_imageresize']['smallThumb'] = '90x90';
309 $config['plugin_imageresize']['mediumThumb'] = '120x120';
310 $config['plugin_imageresize']['largeThumb'] = '180x180';

 

 

posted on 2013-07-11 07:18  redasurc  阅读(1624)  评论(0)    收藏  举报

导航