source: branches/unified_backend/backends/backend.php @ 546

Last change on this file since 546 was 121, checked in by yermol, 15 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: 3.2 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// This code is distributed under the the sames terms as Xinha
9// itself. (HTMLArea license based on the BSD license)
10//
11// Please read license.txt in this package for details.
12//
13// All software distributed under the Licenses is provided strictly on
14// an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR
15// IMPLIED, AND DTLINK LLC HEREBY DISCLAIMS ALL SUCH
16// WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
17// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT,
18// OR NON-INFRINGEMENT.
19// ------------------------------------------------------------------
20// NOSTRIP]
21
22/**
23* backend.php plugin request router.
24*
25* Unified backend single point of entry for the PHP backend.
26*
27* For each plugin identified by a __plugin argument, route the
28* request to the corresponding backend.php in that plugins
29* directory.
30*
31* @package xinha
32* @subpackage backend
33* @author Yermo Lamers http://www.formvista.com/contact.html
34* @copyright DTLink, LLC 2005
35*/
36
37// ----------------------------------------------------------------
38
39/**
40* backend configuration
41*
42* backend.php assumes the current working directory is xinha/backends.
43*/
44
45include_once( "./backend_conf.php" );
46
47/**
48* DDT simple debugging library.
49*/
50
51include_once( "../ddt/ddt.php" );
52
53// uncomment the following to turn on trace messages.
54//_ddtOn();
55
56// get the request variables.
57
58$formVars = empty($_POST) ? $_GET : $_POST;
59
60$plugin = @$formVars[ "__plugin" ];
61
62_ddt( __FILE__, __LINE__, "backend.php: plugin is '" . @$plugin . "'" );
63
64// if there is no __plugin variable we have an error.
65
66if ( $plugin == NULL )
67        {
68        die( "No __plugin variable" );
69        }
70
71// some sanity checking on the plugin name. Only alphanumeric characters
72// and underscores allowed.
73
74if ( ! preg_match( "/^[a-zA-Z0-9_]+$/", $plugin ) )
75        {
76        _ddt( __FILE__, __LINE__, "backend.php: plugin '$plugin' contains illegal characters" );
77        die( "No" );
78        }
79
80// based on the __plugin variable we pass the buck to the plugin
81// specific backend.php script, if one exists.
82//
83// XINHA_INSTALL_ROOT comes from the backends/backend_conf.php file.
84
85$backend_path = XINHA_INSTALL_ROOT . "/plugins/" . $plugin . "/backend.php";
86
87_ddt( __FILE__, __LINE__, "backend.php: plugin '$plugin' backend_path is '$backend_path'" );
88
89if ( ! file_exists( $backend_path ) )
90        {
91        die( "No backend for plugin '" . $plugin . "'" );
92        }
93
94// plugin backends assume the plugin directory itself is the current working
95// directory
96
97$plugin_dir = XINHA_INSTALL_ROOT . "/plugins/" . $plugin;
98
99_ddt( __FILE__, __LINE__, "backend.php: changing cwd to '$plugin_dir'" );
100
101chdir( $plugin_dir );
102
103_ddt( __FILE__, __LINE__, "backend.php: pulling in '$backend_path'" );
104
105include_once( $backend_path );
106
107// to allow for multiple backends to be pulled in simultaneously (in some future version)
108// form a plugin-unique callback name.
109
110$callback_name = $plugin . "_callback";
111
112_ddt( __FILE__, __LINE__, "backend.php: calling '$callback_name'" );
113
114$callback_name( $formVars );
115
116// END
117
118?>
Note: See TracBrowser for help on using the repository browser.