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