source: branches/unified_backend/Configure.php

Last change on this file was 121, checked in by yermol, 14 years ago

htmlarea.js

. more debugging messages added.
. added HTMLArea.Config.linkReplacementMode which can be either

fullyqualified (the old default behavior) or absolute.


When set to fullyqualified all absolute links (e.g. /somepath) will be changed to fullyqualified URLS (e.g. http://yoursite/somepth).


When set to absolute, all fullyqualified urls back to the current site
will be changed to absolute (e.g. httpyoursite/somepath to /somepath)
making the Xinha generated content portable between sites.


( see HTMLArea.prototype.outwardHtml() )


. bugfix - if plugin .js file has a parse error htmlarea will only try to load

it a configurable number of times before popping up an error message.


backends/backend.php

. initial unified backend created. Requests to this backend are routed

to the corresponding plugin specific backend.php file.


backends/backend_conf.php

. a central server side configuration file has been created for the use

of plugin serverside code.

. all backends hooked into this scheme must include the central config file.

ImageManager?

. modified the config to allow overriding default values.
. default image directory is now xinha/examples/images
. added debugging trace messages which are tagged with the ImageManager? name.
. now uses unified backend.

Linker

. includes central config.
. default directory is now the xinha/examples directory (to avoid scan.php security

problem)

. added debugging trace messages which are tagged with the Linker name.
. links selected from the tree are now displayed in absolute instead of fully qualified

fashion.

. on edit the link that was previously selected is highlighted.
. on edit the selected link is scrolled to if it's outside the viewable area.
. if scan.php returns some kind of error or invalid javascript Linker now pops up

a nice descriptive error message.


. bugfix - same pattern as in loading plugins. If there is some error in loading the directory listing Linker will only attempt it a few times before giving up and

displaying a nice error.


dTree.js

. added clear_s() method to clear the selection
. added getNodeElement() method to return the <a ..> element for a given node.

File size: 7.1 KB
Line 
1<?php
2
3// [NOSTRIP
4// -----------------------------------------------------------------
5// Copyright (C) DTLink, LLC.
6// http://www.dtlink.com and http://www.formvista.com
7// -----------------------------------------------------------------
8// Use of this code is granted by the sames terms as described in the
9// htmlArea License (based on BSD license). Please read license.txt
10// in this package for details.
11//
12// All software distributed under the Licenses is provided strictly on
13// an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR
14// IMPLIED, AND DTLINK LLC HEREBY DISCLAIMS ALL SUCH
15// WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
16// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT,
17// OR NON-INFRINGEMENT.
18// ------------------------------------------------------------------
19// NOSTRIP]
20
21/**
22* Simple Configure system ported from formVista
23*
24* @package Xinha
25* @subpackage configure
26* @author Yermo Lamers
27* @copyright DTLink, LLC
28* @see http://www.formvista.com
29*/
30
31// ---------------------------------------------------------------
32// REVISION HISTORY:
33//
34// 2005-04-15 YmL:
35// . ported from formVista.
36// . this version relicensed under HTMLArea license.
37//
38// 2005-05-01 YmL:
39//      .       now generates a backend config file containing install root.
40// ---------------------------------------------------------------
41
42// make sure we're not running in a webserver
43
44if ( @$_SERVER["HTTP_HOST"] != NULL )
45        {
46        die( "No\n" );
47        }
48
49// a hack that works with versions of PHP prior to 4.3
50
51$stdin = fopen("php://stdin","r");
52$stdout = fopen("php://stdout","r");
53$stderr = fopen("php://stderr","r");
54
55// a nice little banner.
56
57readfile( "./conf/banner.txt" );
58
59print( "Press any key to continue:" );
60
61$response = fgets( $stdin, 256 );
62
63/**
64* configure support library
65*/
66
67include_once( "./devutils/lib/install.php" );
68
69$dataExport = array();
70
71// ---------------------------------------------------------------
72// Prompts
73// ---------------------------------------------------------------
74
75while ( true )
76        {
77
78        print "\n";
79        print "---------------------------------------------------------\n";
80        print "\nFull Path to PHP command line interpreter:\n";
81        print "[" . @$dataExport["PHP"] . "]:";
82
83        $response = fgets( $stdin, 256 );
84                                                                                 
85   if ( preg_match( "/\S/", $response ) )
86                {
87                $response = trim($response);
88
89        $dataExport[ "PHP" ] = $response;
90
91                break;
92                }
93        else
94                {
95
96                // it's possible we've already looped through this
97
98                if ( preg_match( "/\S/", @$dataExport[ "PHP" ] ))
99                        break;
100
101                print( "\nPlease enter the path to PHP\n" );
102                }
103        }
104
105// path to perl (used by makedocs.pl script)
106
107while ( true )
108        {
109
110        print "\n";
111        print "---------------------------------------------------------\n";
112        print "\nPath to PERL:\n";
113        print "[" . @$dataExport["PERL"] . "]:";
114
115        $response = fgets( $stdin, 256 );
116                                                                                 
117   if ( preg_match( "/\S/", $response ) )
118                {
119                $response = trim($response);
120
121        $dataExport[ "PERL" ] = $response;
122
123                break;
124                }
125        else
126                {
127
128                // it's possible we've already looped through this
129
130                if ( preg_match( "/\S/", @$dataExport[ "PERL" ] ))
131                        break;
132
133                print( "\nPlease enter the path to Perl\n" );
134                }
135        }
136
137// URL to Xinha install
138
139while ( true )
140        {
141
142        print "\n";
143        print "---------------------------------------------------------\n";
144        print "Xinha needs to know what URL it's installed under.\n";
145        print "(e.g. /xinha or maybe http://some_site.com/somedir/xinha)\n";
146        print "\nURL of Xinha install:\n";
147        print "[" . @$dataExport["XINHA_INSTALL_URL"] . "]:";
148
149        $response = fgets( $stdin, 256 );
150                                                                                 
151   if ( preg_match( "/\S/", $response ) )
152                {
153                $response = trim($response);
154
155        $dataExport[ "XINHA_INSTALL_URL" ] = $response;
156
157                break;
158                }
159        else
160                {
161
162                // it's possible we've already looped through this
163
164                if ( preg_match( "/\S/", @$dataExport[ "XINHA_INSTALL_URL" ] ))
165                        break;
166
167                print( "\nPlease enter the url of your Xinha install.\n" );
168                }
169        }
170
171// We assume the current directory is the root of the Xinha install.
172
173$dataExport[ "XINHA_INSTALL_ROOT"] = getcwd();
174
175// ---------------------------------------------------------------
176//                      TEMPLATE EXPANSION
177// ---------------------------------------------------------------
178//
179// There are a number of utility configuration files and utility scripts
180// that need to have some of these settings embedded in them.
181
182// PHP kludge for taking a source file and turning it into an array.
183
184if (( $infile_list = file( "./conf/infile_list.txt" )) == NULL )
185        {
186        print( "ERROR - unable open '.in' files list in './conf/infile_list.txt'\n" );
187        return  false ;
188        }
189
190// now loop over each file in the list and expand it.
191
192foreach ( $infile_list as $offset => $source_line )
193        {
194
195        // is our source_line blank or does it mark a phpDocumentor docblock?
196
197        if (( preg_match( "/^\s$/", $source_line )) ||
198                ( substr( $source_line, 0, 3 ) == "/**" ) ||
199                ( substr( $source_line, 0, 1 ) == "*" ) ||
200                ( substr( $source_line, 0, 2 ) == "<?" ) ||
201                ( substr( $source_line, 0, 2 ) == "?>" ))
202                {
203
204                // blank line or phpDocumentor comment.
205
206                continue;
207                }
208
209        $source_line = rtrim( $source_line );
210
211        // lines in the file are source file, target permissions. (unix only)
212
213        list( $filename, $permissions ) = split( " ", $source_line );
214
215        $permissions = rtrim( $permissions );
216
217        // the target name is the source name minus '.in'.
218
219        $target_filename = str_replace( ".in", "", $filename );
220
221        // do variable replacement in the file.
222
223        process_template( $filename, $target_filename, $dataExport );
224
225        // nice little bug in chmod() call ...
226
227        $mode_oct = octdec($permissions);
228       
229        chmod( $target_filename, $mode_oct );
230       
231        print( "Generated '$target_filename' permissions '$permissions'\n" );
232
233        }
234
235// ---------------------------------------------------------------
236//              CHECKING PERMISSIONS
237// ---------------------------------------------------------------
238//
239// We've run into countless situations where directory and file
240// permissions get changed. Read in a list of files and directories
241// and change permission and ownership accordingly.
242
243// PHP kludge for taking a source file and turning it into an array.
244
245if (( $infile_list = file( "./conf/perms_list.txt" )) == NULL )
246        {
247        print( "ERROR - unable open perms list in './conf/perms_list.txt'\n" );
248        return  false ;
249        }
250
251// now loop over each file and directory in the list and expand it.
252
253foreach ( $infile_list as $offset => $source_line )
254        {
255
256        // is our source_line blank or does it mark a phpDocumentor docblock?
257
258        if (( preg_match( "/^\s$/", $source_line )) ||
259                ( substr( $source_line, 0, 3 ) == "/**" ) ||
260                ( substr( $source_line, 0, 1 ) == "*" ) ||
261                ( substr( $source_line, 0, 2 ) == "<?" ) ||
262                ( substr( $source_line, 0, 2 ) == "?>" ))
263                {
264
265                // blank line or phpDocumentor comment.
266
267                continue;
268                }
269
270        $source_line = rtrim( $source_line );
271
272        // lines in the file are source file or dir, permissions, owner. (unix only)
273        // where owner is either the web user or root.
274
275        list( $filename, $permissions, $owner ) = split( " ", $source_line );
276
277        $owner = rtrim( $owner );
278
279        // nice little bug in chmod() call ...
280
281        $mode_oct = octdec($permissions);
282       
283        chmod( $filename, $mode_oct );
284        chown( $filename, $owner );
285               
286        print( "Set '$filename' to perms '$permissions' owner '$owner'\n" );
287
288        }
289
290// END
291
292?>
Note: See TracBrowser for help on using the repository browser.