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