dolibarr 19.0.3
browser.php
1<?php
2/* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2003-2010 Frederico Caldeira Knabben
4 *
5 * Source modified from part of fckeditor (http://www.fckeditor.net)
6 * retrieved as GPL v2 or later
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22//define('NOTOKENRENEWAL',1); // Disables token renewal
23//require '../../../../main.inc.php';
24require '../../connectors/php/config.inc.php'; // This include the define('NOTOKENRENEWAL',1) and the require main.in.php
25
26global $Config;
27
29
30?>
31<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
32<html>
33 <head>
34 <title><?php echo $langs->trans("MediaBrowser").' - '.$Config['UserFilesAbsolutePathRelative']; ?></title>
35 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
36<?php
37print '<!-- Includes CSS for Dolibarr theme -->'."\n";
38// Output style sheets (optioncss='print' or ''). Note: $conf->css looks like '/theme/eldy/style.css.php'
39$themepath = dol_buildpath($conf->css, 1);
40$themesubdir = '';
41if (!empty($conf->modules_parts['theme'])) { // This slow down
42 foreach ($conf->modules_parts['theme'] as $reldir) {
43 if (file_exists(dol_buildpath($reldir.$conf->css, 0))) {
44 $themepath = dol_buildpath($reldir.$conf->css, 1);
45 $themesubdir = $reldir;
46 break;
47 }
48 }
49}
50
51//print 'themepath='.$themepath.' themeparam='.$themeparam;exit;
52$themeparam = '';
53print '<link rel="stylesheet" type="text/css" href="'.$themepath.$themeparam.'">'."\n";
54?>
55 <script type="text/javascript" src="js/fckxml.js"></script>
56 <script type="text/javascript">
57// Automatically detect the correct document.domain (#1919).
58(function()
59{
60 var d = document.domain ;
61
62 while ( true )
63 {
64 // Test if we can access a parent property.
65 try
66 {
67 var test = window.opener.document.domain ;
68 break ;
69 }
70 catch( e )
71 {}
72
73 // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
74 d = d.replace( /.*?(?:\.|$)/, '' );
75
76 if ( d.length == 0 )
77 break ; // It was not able to detect the domain.
78
79 try
80 {
81 document.domain = d ;
82 }
83 catch (e)
84 {
85 break ;
86 }
87 }
88})();
89
90function GetUrlParam( paramName )
91{
92 var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' );
93 var oMatch = oRegex.exec( window.top.location.search );
94
95 if ( oMatch && oMatch.length > 1 )
96 return decodeURIComponent( oMatch[1] );
97 else
98 return '' ;
99}
100
101var oConnector = new Object();
102oConnector.CurrentFolder = '/' ;
103
104var sConnUrl = GetUrlParam( 'Connector' );
105
106// Gecko has some problems when using relative URLs (not starting with slash).
107if ( sConnUrl.substring(0,1) != '/' && sConnUrl.indexOf( '://' ) < 0 )
108 sConnUrl = window.location.href.replace( /browser.php.*$/, '' ) + sConnUrl ;
109
110oConnector.ConnectorUrl = sConnUrl + ( sConnUrl.indexOf('?') != -1 ? '&' : '?' );
111
112var sServerPath = GetUrlParam( 'ServerPath' );
113if ( sServerPath.length > 0 )
114 oConnector.ConnectorUrl += 'ServerPath=' + encodeURIComponent( sServerPath ) + '&' ;
115
116/* @CHANGE LDR Overwrite value coming from parameters for security purpose */
117oConnector.ConnectorUrl = '<?php echo DOL_URL_ROOT.'/core/filemanagerdol/connectors/php/connector.php?'; ?>';
118console.log('ConnectorUrl='+oConnector.ConnectorUrl);
119
120oConnector.ResourceType = GetUrlParam( 'Type' );
121oConnector.ShowAllTypes = ( oConnector.ResourceType.length == 0 );
122
123if ( oConnector.ShowAllTypes )
124 oConnector.ResourceType = 'File' ;
125
126oConnector.SendCommand = function( command, params, callBackFunction )
127{
128 var sUrl = this.ConnectorUrl + 'Command=' + command ;
129 sUrl += '&Type=' + this.ResourceType ;
130 sUrl += '&CurrentFolder=' + encodeURIComponent( this.CurrentFolder );
131
132 if ( params ) sUrl += '&' + params ;
133
134 // Add a random salt to avoid getting a cached version of the command execution
135 sUrl += '&uuid=' + new Date().getTime();
136
137 var oXML = new FCKXml();
138
139 if ( callBackFunction )
140 oXML.LoadUrl( sUrl, callBackFunction ); // Asynchronous load.
141 else
142 return oXML.LoadUrl( sUrl );
143
144 return null ;
145}
146
147oConnector.CheckError = function( responseXml )
148{
149 var iErrorNumber = 0 ;
150 var oErrorNode = responseXml.SelectSingleNode( 'Connector/Error' );
151
152 if ( oErrorNode )
153 {
154 iErrorNumber = parseInt( oErrorNode.attributes.getNamedItem('number').value, 10 );
155
156 switch ( iErrorNumber )
157 {
158 case 0:
159 break;
160 case 1: // Custom error. Message placed in the "text" attribute.
161 alert( oErrorNode.attributes.getNamedItem('text').value );
162 break;
163 case 101:
164 alert( 'Folder already exists' );
165 break;
166 case 102:
167 alert( 'Invalid folder name' );
168 break;
169 case 103:
170 alert( 'You have no permissions to create the folder' );
171 break;
172 case 110:
173 alert( 'Unknown error creating folder' );
174 break;
175 default:
176 alert( 'Error on your request. Error number: ' + iErrorNumber );
177 break;
178 }
179 }
180 return iErrorNumber ;
181}
182
183var oIcons = new Object();
184
185oIcons.AvailableIconsArray = [
186 'ai','avi','bmp','cs','dll','doc','exe','fla','gif','htm','html','jpg','js',
187 'mdb','mp3','pdf','png','ppt','rdp','swf','swt','txt','vsd','xls','xml','zip' ] ;
188
189oIcons.AvailableIcons = new Object();
190
191for ( var i = 0 ; i < oIcons.AvailableIconsArray.length ; i++ )
192 oIcons.AvailableIcons[ oIcons.AvailableIconsArray[i] ] = true ;
193
194oIcons.GetIcon = function( fileName )
195{
196 var sExtension = fileName.substr( fileName.lastIndexOf('.') + 1 ).toLowerCase();
197
198 if ( this.AvailableIcons[ sExtension ] == true )
199 return sExtension ;
200 else
201 return 'default.icon' ;
202}
203
204function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg )
205{
206 if (errorNumber == "1")
207 window.frames['frmUpload'].OnUploadCompleted( errorNumber, customMsg );
208 else
209 window.frames['frmUpload'].OnUploadCompleted( errorNumber, fileName );
210}
211
212 </script>
213 </head>
214 <frameset cols="200,*" framespacing="3" border="1" style="border: 2px solid #CCCCCC;">
215 <frame name="frmFolders" src="frmfolders.php" scrolling="auto" frameborder="1">
216 <frameset rows="50,*,70" framespacing="0">
217 <frame name="frmActualFolder" src="frmactualfolder.php" scrolling="no" frameborder="0">
218 <frame name="frmResourcesList" src="frmresourceslist.php" scrolling="auto" frameborder="0">
219 <frameset cols="200,*" framespacing="0" border="0">
220 <frame name="frmCreateFolder" src="frmcreatefolder.php" scrolling="no" frameborder="0">
221 <frame name="frmUpload" src="frmupload.php" scrolling="no" frameborder="0">
222 <frame name="frmUploadWorker" src="javascript:void(0)" scrolling="no" frameborder="0">
223 </frameset>
224 </frameset>
225 </frameset>
226</html>
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition repair.php:121
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:124