Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
<?php
3
/**
4
 * phpDocumentor :: docBuilder Web Interface
5
 *
6
 * Advanced Web Interface to phpDocumentor
7
 *
8
 * PHP versions 4 and 5
9
 *
10
 * Copyright (c) 2003-2006 Andrew Eddie, Greg Beaver
11
 *
12
 * LICENSE:
13
 *
14
 * This library is free software; you can redistribute it
15
 * and/or modify it under the terms of the GNU Lesser General
16
 * Public License as published by the Free Software Foundation;
17
 * either version 2.1 of the License, or (at your option) any
18
 * later version.
19
 *
20
 * This library is distributed in the hope that it will be useful,
21
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23
 * Lesser General Public License for more details.
24
 *
25
 * You should have received a copy of the GNU Lesser General Public
26
 * License along with this library; if not, write to the Free Software
27
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
 *
29
 * @package    phpDocumentor
30
 * @author     Andrew Eddie
31
 * @author     Greg Beaver <cellog@php.net>
32
 * @copyright  2003-2006 Andrew Eddie, Greg Beaver
33
 * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
34
 * @version    CVS: $Id: file_dialog.php 231860 2007-03-14 12:48:37Z ashnazg $
35
 * @filesource
36
 * @see phpdoc.php
37
 */
38
if (!function_exists( 'version_compare' )) {
39
    print "phpDocumentor requires PHP version 4.1.0 or greater to function";
40
    exit;
41
}
42
 
43
if ('/usr/share/php/data' != '@'.'WEB-DIR@')
44
{
45
    /**
46
    * common file information
47
    */
48
    require_once 'PhpDocumentor/phpDocumentor/common.inc.php';
49
    require_once 'PhpDocumentor/HTML_TreeMenu-1.1.2/TreeMenu.php';
50
    require_once( '/usr/share/php/data' . PATH_DELIMITER . 'PhpDocumentor/docbuilder/includes/utilities.php' );
51
 
52
    define(PHPDOC_WEBROOT_DIR, 'PhpDocumentor');
53
 
54
    // set up include path so we can find all files, no matter what
55
    $GLOBALS['_phpDocumentor_install_dir'] = PHPDOC_WEBROOT_DIR;
56
 
57
    // find the .ini directory by parsing phpDocumentor.ini and extracting _phpDocumentor_options[userdir]
58
    $ini = phpDocumentor_parse_ini_file('/usr/share/php/data' . PATH_DELIMITER . 'PhpDocumentor/phpDocumentor.ini', true);
59
    if (isset($ini['_phpDocumentor_options']['userdir'])) {
60
        $configdir = $ini['_phpDocumentor_options']['userdir'];
61
    } else {
62
        $configdir = '/usr/share/php/data' . PATH_DELIMITER . 'PhpDocumentor/user';
63
    }
64
} else {
65
 
66
    define(PHPDOC_WEBROOT_DIR, dirname(dirname(__FILE__)));
67
    /**
68
    * common file information
69
    */
70
    include_once(PHPDOC_WEBROOT_DIR . "/phpDocumentor/common.inc.php");
71
	include_once(PHPDOC_WEBROOT_DIR . "/HTML_TreeMenu-1.1.2/TreeMenu.php");
72
	include_once(PHPDOC_WEBROOT_DIR . "/docbuilder/includes/utilities.php" );
73
 
74
    // set up include path so we can find all files, no matter what
75
    $GLOBALS['_phpDocumentor_install_dir'] = dirname(dirname( realpath( __FILE__ ) ));
76
    // add my directory to the include path, and make it first, should fix any errors
77
    if (substr(PHP_OS, 0, 3) == 'WIN') {
78
    	ini_set('include_path',$GLOBALS['_phpDocumentor_install_dir'].';'.ini_get('include_path'));
79
    } else {
80
    	ini_set('include_path',$GLOBALS['_phpDocumentor_install_dir'].':'.ini_get('include_path'));
81
    }
82
 
83
    // find the .ini directory by parsing phpDocumentor.ini and extracting _phpDocumentor_options[userdir]
84
    $ini = phpDocumentor_parse_ini_file($_phpDocumentor_install_dir . PATH_DELIMITER . 'phpDocumentor.ini', true);
85
    if (isset($ini['_phpDocumentor_options']['userdir'])) {
86
        $configdir = $ini['_phpDocumentor_options']['userdir'];
87
    } else {
88
        $configdir = $_phpDocumentor_install_dir . '/user';
89
    }
90
}
91
 
92
// allow the user to change this at runtime
93
if (!empty( $_REQUEST['altuserdir'] )) {
94
	$configdir = $_REQUEST['altuserdir'];
95
}
96
?>
97
<html>
98
<head>
99
	<title>
100
		File browser
101
	</title>
102
	<style type="text/css">
103
		body, td, th, select, input {
104
			font-family: verdana,sans-serif;
105
			font-size: 9pt;
106
		}
107
		.text {
108
			font-family: verdana,sans-serif;
109
			font-size: 9pt;
110
			border: solid 1px #000000;
111
		}
112
		.button {
113
			border: solid 1px #000000;
114
		}
115
		.small {
116
			font-size: 7pt;
117
		}
118
	</style>
119
 
120
	<script src="../HTML_TreeMenu-1.1.2/TreeMenu.js" language="JavaScript" type="text/javascript"></script>
121
 
122
<?php
123
	set_time_limit(0);    // six minute timeout
124
	ini_set("memory_limit","256M");
125
 
126
	/**
127
	 * Directory Node
128
	 * @package HTML_TreeMenu
129
	 */
130
	class DirNode extends HTML_TreeNode
131
	{
132
		/**
133
		* full path to this node
134
		* @var string
135
		*/
136
		var $path;
137
 
138
		function DirNode($text = false, $link = false, $icon = false, $path, $events = array())
139
		{
140
			$this->path = $path;
141
			$options = array();
142
			if ($text) $options['text'] = $text;
143
			if ($link) $options['link'] = $link;
144
			if ($icon) $options['icon'] = $icon;
145
			HTML_TreeNode::HTML_TreeNode($options,$events);
146
		}
147
	}
148
 
149
 
150
	$menu  = new HTML_TreeMenu();
151
	$filename = '';
152
	if (isset($_GET) && isset($_GET['fileName'])) {
153
		$filename = $_GET['fileName'];
154
	}
155
	$filename = realpath($filename);
156
	$pd = (substr(PHP_OS, 0, 3) == 'WIN') ? '\\' : '/';
157
	$test = ($pd == '/') ? '/' : 'C:\\';
158
	if (empty($filename) || ($filename == $test)) {
159
		$filename = ($pd == '/') ? '/' : 'C:\\';
160
		$node = false;
161
        getDir($filename,$node);
162
    } else {
163
        flush();
164
//            if ($pd != '/') $pd = $pd.$pd;
165
        $anode = false;
166
        switchDirTree($filename,$anode);
167
//            recurseDir($filename,$anode);
168
        $node = new HTML_TreeNode(array('text' => "Click to view ".addslashes($filename),'link' => "",'icon' => 'branchtop.gif'));
169
        $node->addItem($anode);
170
    };
171
    $menu->addItem($node);
172
    if ('/usr/share/php/data' != '@'.'WEB-DIR@')
173
    {
174
    	$DHTMLmenu = &new HTML_TreeMenu_DHTML($menu,
175
                        array('images' => '../HTML_TreeMenu-1.1.2/images'));
176
    } else {
177
       $DHTMLmenu = &new HTML_TreeMenu_DHTML($menu,
178
                        array('images' => str_replace('/docbuilder/file_dialog.php','',$_SERVER['PHP_SELF']) .
179
                              '/HTML_TreeMenu-1.1.2/images'));
180
    }
181
?>
182
<script type="text/javascript" language="Javascript">
183
/**
184
   Creates some global variables
185
*/
186
function initializate() {
187
//
188
//The "platform independent" newLine
189
//
190
//Taken from http://developer.netscape.com/docs/manuals/communicator/jsref/brow1.htm#1010426
191
	if (navigator.appVersion.lastIndexOf( 'Win' ) != -1) {
192
		$pathdelim="\\";
193
		$newLine="\r\n";
194
	} else {
195
		$newLine="\n";
196
		$pathdelim="/";
197
	}
198
	/* for($a=0;$a<document.dataForm.elements.length;$a++) {
199
	 alert("The name is '"+document.dataForm.elements[$a].name+"' "+$a);
200
	 }
201
	*/
202
}
203
/** Sets the contents of the help box, and submits the form
204
*/
205
function setHelp( $str ) {
206
	document.helpForm.fileName.value = $str;
207
	document.helpForm.submit();
208
}
209
 
210
/** Sets the contents of the help box only
211
*/
212
function setHelpVal( $str ) {
213
	document.helpForm.fileName.value = $str;
214
}
215
/**Takes a given string and leaves it ready to add a new string
216
   That is, puts the comma and the new line if needed
217
*/
218
function prepareString($myString) {
219
 //First verify that a comma is not at the end
220
 if($myString.lastIndexOf(",") >= $myString.length-2) {
221
  //We have a comma at the end
222
  return $myString;
223
 }
224
 if($myString.length > 0) {
225
  $myString+=","+$newLine;
226
 }
227
 return $myString;
228
}
229
 
230
 
231
 function myReplace($string,$text,$by) {
232
 // Replaces text with by in string
233
     var $strLength = $string.length, $txtLength = $text.length;
234
     if (($strLength == 0) || ($txtLength == 0)) return $string;
235
 
236
     var $i = $string.indexOf($text);
237
     if ((!$i) && ($text != $string.substring(0,$txtLength))) return $string;
238
     if ($i == -1) return $string;
239
 
240
     var $newstr = $string.substring(0,$i) + $by;
241
 
242
     if ($i+$txtLength < $strLength)
243
         $newstr += myReplace($string.substring($i+$txtLength,$strLength),$text,$by);
244
 
245
     return $newstr;
246
 }
247
</script>
248
 
249
</head>
250
 
251
<body bgcolor="#ffffff" onload="javascript:initializate()">
252
<strong>Directory Browser</strong>
253
 
254
<table cellpadding="1" cellspacing="1" border="0" width="100%">
255
 
256
<form name="helpForm" action="<?php print $_SERVER['PHP_SELF']; ?>" method="get" enctype="multipart/form-data">
257
<tr>
258
	<td colspan="2" width="100%">
259
		Use this to find directories and files which can be used below:
260
	</td>
261
</tr>
262
<tr>
263
	<td align="right">
264
		<a href="javascript:document.helpForm.submit();" title="browse tree">
265
<?php
266
	echo showImage( 'images/rc-gui-install-24.png', '24', '24' );
267
?>
268
		</a>
269
	</td>
270
	<td>
271
		<input size="60" type="text" name="fileName" value="<?php print $filename;?>" class="text" />
272
	</td>
273
</tr>
274
<tr>
275
	<td>
276
		<input type="submit" name="helpdata" value="close" class="button" onclick="window.close();" />
277
	</td>
278
	<td align="right">
279
		<input type="submit" name="helpdata" value="accept" class="button" onclick="opener.setFile(document.helpForm.fileName.value);window.close();" />
280
	</td>
281
</tr>
282
<tr>
283
	<td colspan="2">
284
		<div id='menuLayer'></div>
285
		<?php $DHTMLmenu->printMenu(); ?>
286
	</td>
287
</tr>
288
</form>
289
 
290
</table>
291
 
292
</body>
293
</html>