Compare commits
42 Commits
RELEASE-1.
...
documentat
Author | SHA1 | Date | |
---|---|---|---|
|
88f3c8faa7 | ||
|
8c46ecf6c9 | ||
|
5080e204cf | ||
|
b46941f7fd | ||
|
03d1166103 | ||
|
676a675c7c | ||
|
4598d3ae39 | ||
|
2416230c61 | ||
|
d90fe5a6fa | ||
|
ec8902a223 | ||
|
2090e7c34a | ||
|
2393c5d5e3 | ||
|
efd1860a91 | ||
|
23a2da1f26 | ||
|
d4483f961f | ||
|
b1139658bf | ||
|
f8cacb7dd0 | ||
|
ee35f81ce5 | ||
|
088ebf4a2b | ||
|
a6dc80616b | ||
|
9196bb9e41 | ||
|
7121f560e9 | ||
|
e7466c948b | ||
|
f0a6d312ab | ||
|
d062308f32 | ||
|
352a87fee8 | ||
|
242d06673a | ||
|
a3ac658756 | ||
|
e83aba595c | ||
|
3ffe6878f3 | ||
|
02e9f8477a | ||
|
259179a1b3 | ||
|
96bad27d64 | ||
|
c69cd68fcb | ||
|
9cb27e3a70 | ||
|
52fbd24b2c | ||
|
f83a922589 | ||
|
3e446fddf4 | ||
|
bdb423d0d3 | ||
|
2c99cc9016 | ||
|
b93b92f430 | ||
|
26fa2ba2c5 |
@@ -6,6 +6,7 @@
|
||||
|
||||
/**
|
||||
* The phpLDAPadmin config file
|
||||
* See: http://phpldapadmin.sourceforge.net/wiki/index.php/Config.php
|
||||
*
|
||||
* This is where you can customise some of the phpLDAPadmin defaults
|
||||
* that are defined in config_default.php.
|
||||
@@ -39,7 +40,7 @@
|
||||
/* Useful important configuration overrides */
|
||||
/*********************************************/
|
||||
|
||||
/* If you are asked to put pla in debug mode, this is how you do it: */
|
||||
/* If you are asked to put PLA in debug mode, this is how you do it: */
|
||||
# $config->custom->debug['level'] = 255;
|
||||
# $config->custom->debug['syslog'] = true;
|
||||
# $config->custom->debug['file'] = '/tmp/pla_debug.log';
|
||||
@@ -92,7 +93,7 @@ $config->custom->commands['cmd'] = array(
|
||||
'entry_refresh' => true,
|
||||
'oslinks' => true,
|
||||
'switch_template' => true
|
||||
);
|
||||
);
|
||||
|
||||
$config->custom->commands['script'] = array(
|
||||
'add_attr_form' => true,
|
||||
@@ -258,6 +259,9 @@ $config->custom->appearance['friendly_attrs'] = array(
|
||||
/*********************************************/
|
||||
|
||||
$servers = new Datastore();
|
||||
|
||||
/* $servers->NewServer('ldap_pla') must be called before each new LDAP server
|
||||
declaration. */
|
||||
$servers->newServer('ldap_pla');
|
||||
|
||||
/* A convenient name that will appear in the tree viewer and throughout
|
||||
@@ -297,12 +301,12 @@ $servers->setValue('server','name','My LDAP Server');
|
||||
/* The DN of the user for phpLDAPadmin to bind with. For anonymous binds or
|
||||
'cookie' or 'session' auth_types, LEAVE THE LOGIN_DN AND LOGIN_PASS BLANK. If
|
||||
you specify a login_attr in conjunction with a cookie or session auth_type,
|
||||
then you can also specify the bind_dn/bind_pass here for searching the
|
||||
then you can also specify the bind_id/bind_pass here for searching the
|
||||
directory for users (ie, if your LDAP server does not allow anonymous binds. */
|
||||
// $servers->setValue('login','bind_id','');
|
||||
# $servers->setValue('login','bind_id','cn=Manager,dc=example,dc=com');
|
||||
|
||||
/* Your LDAP password. If you specified an empty bind_dn above, this MUST also
|
||||
/* Your LDAP password. If you specified an empty bind_id above, this MUST also
|
||||
be blank. */
|
||||
// $servers->setValue('login','bind_pass','');
|
||||
# $servers->setValue('login','bind_pass','secret');
|
||||
@@ -363,7 +367,7 @@ $servers->setValue('server','name','My LDAP Server');
|
||||
and log in as that user.
|
||||
Leave blank or specify 'dn' to use full DN for logging in. Note also that if
|
||||
your LDAP server requires you to login to perform searches, you can enter the
|
||||
DN to use when searching in 'bind_dn' and 'bind_pass' above.
|
||||
DN to use when searching in 'bind_id' and 'bind_pass' above.
|
||||
// $servers->setValue('login','attr','dn');
|
||||
|
||||
/* Base DNs to used for logins. If this value is not set, then the LDAP server
|
||||
|
@@ -164,7 +164,7 @@ if (get_request('meth','REQUEST') != 'ajax') {
|
||||
echo '<table class="entry" cellspacing="0" align="center" border=0>';
|
||||
echo '<td valign="top" align="center">';
|
||||
|
||||
printf('<select name="attr" onChange="displayAJ(\'%s\',\'cmd=add_value_form&server_id=%s&dn=%s&meth=ajax&attr=\'+this.value,\'%s\',\'append\');">',
|
||||
printf('<select name="attr" onChange="ajDISPLAY(\'%s\',\'cmd=add_value_form&server_id=%s&dn=%s&meth=ajax&attr=\'+this.value,\'%s\',\'append\');">',
|
||||
'ADDATTR',$app['server']->getIndex(),rawurlencode(get_request('dn','REQUEST')),_('Please Wait'));
|
||||
|
||||
printf('<option value="%s">%s</option>','','');
|
||||
|
@@ -160,6 +160,7 @@ if (get_request('meth','REQUEST') != 'ajax') {
|
||||
|
||||
echo '<table class="entry" cellspacing="0" align="center" border=0>';
|
||||
$request['page']->draw('Template',$attribute);
|
||||
$request['page']->draw('Javascript',$attribute);
|
||||
echo '</table>';
|
||||
|
||||
} else {
|
||||
|
@@ -12,6 +12,7 @@
|
||||
|
||||
require_once './common.php';
|
||||
|
||||
$www = array();
|
||||
$www['cmd'] = get_request('cmd','REQUEST');
|
||||
$www['meth'] = get_request('meth','REQUEST');
|
||||
|
||||
@@ -50,9 +51,12 @@ if (trim($www['cmd'])) {
|
||||
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
|
||||
|
||||
# If this command has been disabled by the config.
|
||||
if (! $_SESSION[APPCONFIG]->isCommandAvailable('script',$www['cmd']))
|
||||
if (! $_SESSION[APPCONFIG]->isCommandAvailable('script',$www['cmd'])) {
|
||||
system_message(array('title'=>_('Command disabled by the server configuration'),
|
||||
_('Error'),'body'=>sprintf('%s: <b>%s</b>.',_('The command could not be run'),$www['cmd']),'type'=>'error'),'index.php');
|
||||
|
||||
$app['script_cmd'] = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($app['script_cmd'])
|
||||
@@ -60,10 +64,10 @@ if ($app['script_cmd'])
|
||||
|
||||
# Refresh a frame - this is so that one frame can trigger another frame to be refreshed.
|
||||
if (isAjaxEnabled() && get_request('refresh','REQUEST') && get_request('refresh','REQUEST') != get_request('frame','REQUEST')) {
|
||||
printf("
|
||||
<script type=\"text/javascript\" language=\"javascript\">
|
||||
displayAJ('%s','cmd=refresh&server_id=%s&meth=ajax&noheader=%s','%s');
|
||||
</script>",get_request('refresh','REQUEST'),$app['server']->getIndex(),get_request('noheader','REQUEST',false,0),_('Auto refresh'));
|
||||
echo '<script type="text/javascript" language="javascript">';
|
||||
printf("ajDISPLAY('%s','cmd=refresh&server_id=%s&meth=ajax&noheader=%s','%s');",
|
||||
get_request('refresh','REQUEST'),$app['server']->getIndex(),get_request('noheader','REQUEST',false,0),_('Auto refresh'));
|
||||
echo '</script>';
|
||||
}
|
||||
|
||||
# Capture the output and put into the body of the page.
|
||||
|
@@ -28,6 +28,7 @@ $request['page']->accept();
|
||||
$request['page']->drawTitle(sprintf('%s <b>%s</b>',_('Compare another DN with'),get_rdn($request['dn'])));
|
||||
$request['page']->drawSubTitle();
|
||||
|
||||
printf('<script type="text/javascript" language="javascript" src="%sdnChooserPopup.js"></script>',JSDIR);
|
||||
echo '<center>';
|
||||
printf('%s <b>%s</b> %s<br />',_('Compare'),get_rdn($request['dn']),_('with '));
|
||||
|
||||
|
@@ -27,6 +27,7 @@ $request['page']->accept();
|
||||
$request['page']->drawTitle(sprintf('%s <b>%s</b>',_('Copy'),get_rdn($request['dn'])));
|
||||
$request['page']->drawSubTitle();
|
||||
|
||||
printf('<script type="text/javascript" language="javascript" src="%sdnChooserPopup.js"></script>',JSDIR);
|
||||
echo '<center>';
|
||||
printf('%s <b>%s</b> %s:<br /><br />',_('Copy'),get_rdn($request['dn']),_('to a new object'));
|
||||
|
||||
@@ -58,7 +59,7 @@ $request['children'] = $app['server']->getContainerContents($request['dn']);
|
||||
if (count($request['children']) > 0) {
|
||||
echo '<tr>';
|
||||
printf('<td><label for="recursive">%s</label>:</td>',_('Recursive copy'));
|
||||
echo '<td><input type="checkbox" id="recursive" name="recursive" onClick="toggle_disable_filter_field(this)" />';
|
||||
echo '<td><input type="checkbox" id="recursive" name="recursive" onClick="copy_field_toggle(this)" />';
|
||||
printf('<small>(%s)</small></td>',_('Recursively copy all children of this object as well.'));
|
||||
echo '</tr>';
|
||||
echo "\n";
|
||||
@@ -95,21 +96,6 @@ if ($_SESSION[APPCONFIG]->getValue('appearance','show_hints'))
|
||||
echo '</center>';
|
||||
|
||||
# Draw the javascrpt to enable/disable the filter field if this may be a recursive copy
|
||||
if (count($request['children']) > 0) {
|
||||
?>
|
||||
<script type="text/javascript" language="javascript">
|
||||
function toggle_disable_filter_field(recursive_checkbox)
|
||||
{
|
||||
if (recursive_checkbox.checked) {
|
||||
recursive_checkbox.form.remove.disabled = false;
|
||||
recursive_checkbox.form.filter.disabled = false;
|
||||
} else {
|
||||
recursive_checkbox.form.remove.disabled = true;
|
||||
recursive_checkbox.form.remove.checked = false;
|
||||
recursive_checkbox.form.filter.disabled = true;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
if (count($request['children']) > 0)
|
||||
printf('<script type="text/javascript" language="javascript" src="%sform_field_toggle_enable.js"></script>',JSDIR);
|
||||
?>
|
||||
|
@@ -36,9 +36,6 @@ if (! $request['container'])
|
||||
|
||||
$request['container'] = $tree->getEntry($request['template']->getContainer());
|
||||
|
||||
if ($request['container']->isLeaf())
|
||||
error(sprintf(_('The container (%s) is a leaf.'),$request['template']->getContainer()),'error','index.php');
|
||||
|
||||
# Check our RDN
|
||||
if (! count($request['template']->getRDNAttrs()))
|
||||
error(_('The were no attributes marked as an RDN attribute.'),'error','index.php');
|
||||
|
@@ -30,9 +30,6 @@ if (! $request['container'])
|
||||
|
||||
$request['container'] = $tree->getEntry($request['template']->getContainer());
|
||||
|
||||
if ($request['container']->isLeaf())
|
||||
error(sprintf(_('The container (%s) is a leaf.'),$request['template']->getContainer()),'error','index.php');
|
||||
|
||||
# Check our RDN
|
||||
if (! count($request['template']->getRDNAttrs()))
|
||||
error(_('The were no attributes marked as an RDN attribute.'),'error','index.php');
|
||||
|
@@ -364,6 +364,89 @@ table.tree span.dnicon img {
|
||||
padding-bottom: 0px;
|
||||
}
|
||||
|
||||
/* Tree */
|
||||
table.tree .treemenudiv {
|
||||
display: block;
|
||||
white-space: nowrap;
|
||||
padding-top: 1px;
|
||||
padding-bottom: 1px;
|
||||
}
|
||||
|
||||
table.tree .phplmnormal {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmnormal:hover {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
background-color: #fff0c0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplm:link {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplm:visited {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplm:hover {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #841212;
|
||||
background-color: #fff0c0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplm:active {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #ff0000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmselected:link {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #dd0000;
|
||||
background-color: #ffdd76;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmselected:visited {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #dd0000;
|
||||
background-color: #ffdd76;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmselected:hover {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #841212;
|
||||
background-color: #fff0c0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmselected:active {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #ff0000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* Standard Form */
|
||||
table.forminput {
|
||||
background-color: #F9F9FA;
|
||||
|
@@ -363,6 +363,89 @@ table.tree a:hover {
|
||||
color: #204A87;
|
||||
}
|
||||
|
||||
/* Tree */
|
||||
table.tree .treemenudiv {
|
||||
display: block;
|
||||
white-space: nowrap;
|
||||
padding-top: 1px;
|
||||
padding-bottom: 1px;
|
||||
}
|
||||
|
||||
table.tree .phplmnormal {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmnormal:hover {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
background-color: #fff0c0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplm:link {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplm:visited {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplm:hover {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #841212;
|
||||
background-color: #fff0c0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplm:active {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #ff0000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmselected:link {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #dd0000;
|
||||
background-color: #ffdd76;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmselected:visited {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #dd0000;
|
||||
background-color: #ffdd76;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmselected:hover {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #841212;
|
||||
background-color: #fff0c0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmselected:active {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #ff0000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* Standard Form */
|
||||
table.forminput {
|
||||
background-color: #EEEEEC;
|
||||
|
@@ -36,6 +36,9 @@ $available_scopes = array(
|
||||
$request['page'] = new PageRender($app['server']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['page']->drawTitle(sprintf('<b>%s</b>',_('Export')));
|
||||
|
||||
printf('<script type="text/javascript" language="javascript" src="%sdnChooserPopup.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" language="javascript" src="%sform_field_toggle_enable.js"></script>',JSDIR);
|
||||
|
||||
echo '<br />';
|
||||
echo '<center>';
|
||||
echo '<form name="export_form" action="cmd.php" method="post">';
|
||||
@@ -50,7 +53,7 @@ echo '<fieldset>';
|
||||
printf('<legend>%s</legend>',_('Export'));
|
||||
|
||||
echo '<table>';
|
||||
printf('<tr><td>%s</td><td>%s</td></tr>',_('Server'),server_select_list($app['server']->getIndex()));
|
||||
printf('<tr><td>%s</td><td>%s</td></tr>',_('Server'),$app['server']->getName());
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td style="white-space:nowrap">%s</td>',_('Base DN'));
|
||||
@@ -83,7 +86,7 @@ printf('<tr><td>%s</td><td><input type="text" name="attributes" style="width:300
|
||||
printf('<tr><td> </td><td><input type="checkbox" name="sys_attr" id="sys_attr" %s/> <label for="sys_attr">%s</label></td></tr>',
|
||||
$request['sys_attr'] ? 'checked="true" ' : '',_('Include system attributes'));
|
||||
|
||||
printf('<tr><td> </td><td><input type="checkbox" id="save_as_file" name="save_as_file" onclick="toggle_disable_field_saveas(this)" /> <label for="save_as_file">%s</label></td></tr>',
|
||||
printf('<tr><td> </td><td><input type="checkbox" id="save_as_file" name="save_as_file" onclick="export_field_toggle(this)" /> <label for="save_as_file">%s</label></td></tr>',
|
||||
_('Save as file'));
|
||||
|
||||
printf('<tr><td> </td><td><input type="checkbox" id="compress" name="compress" disabled /> <label for="compress">%s</label></td></tr>',
|
||||
@@ -208,15 +211,3 @@ function is_browser($type) {
|
||||
return false;
|
||||
}
|
||||
?>
|
||||
<script type="text/javascript" language="javascript">
|
||||
<!--
|
||||
function toggle_disable_field_saveas(id) {
|
||||
if (id.checked) {
|
||||
id.form.compress.disabled = false;
|
||||
} else {
|
||||
id.form.compress.disabled = true;
|
||||
id.form.compress.checked = false;
|
||||
}
|
||||
}
|
||||
-->
|
||||
</script>
|
||||
|
Before Width: | Height: | Size: 196 B After Width: | Height: | Size: 196 B |
Before Width: | Height: | Size: 196 B After Width: | Height: | Size: 196 B |
Before Width: | Height: | Size: 189 B After Width: | Height: | Size: 189 B |
Before Width: | Height: | Size: 194 B After Width: | Height: | Size: 194 B |
Before Width: | Height: | Size: 160 B After Width: | Height: | Size: 160 B |
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 197 B After Width: | Height: | Size: 197 B |
Before Width: | Height: | Size: 202 B After Width: | Height: | Size: 202 B |
Before Width: | Height: | Size: 247 B After Width: | Height: | Size: 247 B |
Before Width: | Height: | Size: 278 B After Width: | Height: | Size: 278 B |
Before Width: | Height: | Size: 207 B After Width: | Height: | Size: 207 B |
Before Width: | Height: | Size: 150 B After Width: | Height: | Size: 150 B |
Before Width: | Height: | Size: 160 B After Width: | Height: | Size: 160 B |
Before Width: | Height: | Size: 160 B After Width: | Height: | Size: 160 B |
Before Width: | Height: | Size: 156 B After Width: | Height: | Size: 156 B |
BIN
htdocs/images/tango/tree_collapse.png
Normal file
After Width: | Height: | Size: 196 B |
BIN
htdocs/images/tango/tree_collapse_corner.png
Normal file
After Width: | Height: | Size: 196 B |
BIN
htdocs/images/tango/tree_collapse_corner_first.png
Normal file
After Width: | Height: | Size: 189 B |
BIN
htdocs/images/tango/tree_collapse_first.png
Normal file
After Width: | Height: | Size: 194 B |
BIN
htdocs/images/tango/tree_corner.png
Normal file
After Width: | Height: | Size: 160 B |
BIN
htdocs/images/tango/tree_expand.png
Normal file
After Width: | Height: | Size: 204 B |
BIN
htdocs/images/tango/tree_expand_corner.png
Normal file
After Width: | Height: | Size: 204 B |
BIN
htdocs/images/tango/tree_expand_corner_first.png
Normal file
After Width: | Height: | Size: 197 B |
BIN
htdocs/images/tango/tree_expand_first.png
Normal file
After Width: | Height: | Size: 202 B |
BIN
htdocs/images/tango/tree_folder_closed.png
Normal file
After Width: | Height: | Size: 247 B |
BIN
htdocs/images/tango/tree_folder_open.png
Normal file
After Width: | Height: | Size: 278 B |
BIN
htdocs/images/tango/tree_leaf.png
Normal file
After Width: | Height: | Size: 207 B |
BIN
htdocs/images/tango/tree_space.png
Normal file
After Width: | Height: | Size: 150 B |
BIN
htdocs/images/tango/tree_split.png
Normal file
After Width: | Height: | Size: 160 B |
BIN
htdocs/images/tango/tree_split_first.png
Normal file
After Width: | Height: | Size: 160 B |
BIN
htdocs/images/tango/tree_vertline.png
Normal file
After Width: | Height: | Size: 156 B |
@@ -131,16 +131,35 @@ if (! preg_match('/^([0-9]+\.?)+/',app_version())) {
|
||||
|
||||
if (count($_SESSION[APPCONFIG]->untested()))
|
||||
system_message(array(
|
||||
'title'=>'Untested configuration paramaters',
|
||||
'title'=>'Untested configuration parameters',
|
||||
'body'=>sprintf('The following parameters have not been tested. If you have configured these parameters, and they are working as expected, please let the developers know, so that they can be removed from this message.<br/><small>%s</small>',implode(', ',$_SESSION[APPCONFIG]->untested())),
|
||||
'type'=>'info','special'=>true));
|
||||
|
||||
$server = $_SESSION[APPCONFIG]->getServer(get_request('server_id','REQUEST'));
|
||||
if (count($server->untested()))
|
||||
system_message(array(
|
||||
'title'=>'Untested server configuration paramaters',
|
||||
'title'=>'Untested server configuration parameters',
|
||||
'body'=>sprintf('The following parameters have not been tested. If you have configured these parameters, and they are working as expected, please let the developers know, so that they can be removed from this message.<br/><small>%s</small>',implode(', ',$server->untested())),
|
||||
'type'=>'info','special'=>true));
|
||||
|
||||
if (count($server->undocumented()) || count($_SESSION[APPCONFIG]->undocumented())) {
|
||||
$body = '';
|
||||
|
||||
$site = 'http://phpldapadmin.sourceforge.net/wiki/index.php';
|
||||
foreach ($server->undocumented() as $param)
|
||||
$body .= sprintf('<a href="%s/Ldapserver:%s">%s</a>, ',$site,preg_replace('/\./',':',$param),$param);
|
||||
|
||||
$body = preg_replace('/, $/','',$body);
|
||||
$body .= '<br/><br/>';
|
||||
foreach ($_SESSION[APPCONFIG]->undocumented() as $param)
|
||||
$body .= sprintf('<a href="%s/config:%s">%s</a>, ',$site,preg_replace('/\./',':',$param),$param);
|
||||
|
||||
$body = preg_replace('/, $/','',$body);
|
||||
system_message(array(
|
||||
'title'=>'Undocumented PLA configuration parameters',
|
||||
'body'=>sprintf('The following parameters need to be documented:<br/><small>%s</small>',$body),
|
||||
'type'=>'info','special'=>true));
|
||||
}
|
||||
}
|
||||
|
||||
include './cmd.php';
|
||||
|
22
htdocs/js/CheckAll.js
Normal file
@@ -0,0 +1,22 @@
|
||||
function CheckAll(setbgcolor,form,index) {
|
||||
htmlform = document.getElementById(form+index);
|
||||
|
||||
for (var i=0;i<htmlform.elements.length;i++) {
|
||||
var e = htmlform.elements[i];
|
||||
|
||||
if (e.type == 'checkbox' && e.name != 'allbox') {
|
||||
e.checked = htmlform.allbox.checked;
|
||||
|
||||
if (!document.layers && setbgcolor) {
|
||||
var tr = document.getElementById('tr_'+e.id);
|
||||
|
||||
if (e.checked) {
|
||||
tr.style.backgroundColor='#DDDDFF';
|
||||
} else {
|
||||
var id = e.id.substr(3);
|
||||
tr.style.backgroundColor= id%2 ? '#E0E0E0' : '#F0F0F0';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
192
htdocs/js/ajax_functions.js
Normal file
@@ -0,0 +1,192 @@
|
||||
/**
|
||||
* @package phpLDAPadmin
|
||||
* @author The phpLDAPadmin development team
|
||||
* @author Xavier Bruyet
|
||||
*/
|
||||
|
||||
// current request
|
||||
var http_div = '';
|
||||
var http_request = null;
|
||||
var http_request_success_callback = '';
|
||||
var http_request_error_callback = '';
|
||||
|
||||
function ajDISPLAY(div,urlParameters,display) {
|
||||
var pageDiv = getDiv(div);
|
||||
|
||||
if (pageDiv)
|
||||
includeHTML(pageDiv,'<img src="images/ajax-progress.gif"><br><small>'+display+'...</small>');
|
||||
else
|
||||
return true;
|
||||
|
||||
makeHttpRequest('cmd.php',urlParameters+'&meth=ajax','GET','alertAJ','cancelAJ',div);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function ajJUMP(url,title,index,prefix) {
|
||||
var attr = prefix ? document.getElementById(prefix+index).value : index;
|
||||
|
||||
if (attr)
|
||||
url += '&viewvalue='+attr;
|
||||
|
||||
return ajDISPLAY('BODY',url,'Loading '+title);
|
||||
}
|
||||
|
||||
function ajSHOWTHIS(key,except,ctl) {
|
||||
select = document.getElementById(key+except);
|
||||
|
||||
if (select.style.display == '')
|
||||
return false;
|
||||
|
||||
hideall(key,except,ctl);
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
function ajSHOWSCHEMA(type,key,value) {
|
||||
select = document.getElementById(type);
|
||||
|
||||
if (value != null) {
|
||||
except = value;
|
||||
select.value = value;
|
||||
} else {
|
||||
except = select.value;
|
||||
}
|
||||
|
||||
if (! except) {
|
||||
showall(key);
|
||||
} else {
|
||||
objectclass = document.getElementById(key+except);
|
||||
objectclass.style.display = '';
|
||||
hideall(key,except);
|
||||
};
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
function hideall(key,except,ctl) {
|
||||
items = items();
|
||||
|
||||
for (x in items) {
|
||||
if (! isNaN(x) && except != items[x]) {
|
||||
item = document.getElementById(key+items[x]);
|
||||
item.style.display = 'none';
|
||||
|
||||
if (ctl && (item = document.getElementById(ctl+items[x]))) {
|
||||
item.style.background = '#E0E0E0';
|
||||
}
|
||||
|
||||
} else if (! isNaN(x) && except == items[x]) {
|
||||
item = document.getElementById(key+items[x]);
|
||||
item.style.display = '';
|
||||
|
||||
if (ctl && (item = document.getElementById(ctl+items[x]))) {
|
||||
item.style.background = '#F0F0F0';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showall(key) {
|
||||
items = items();
|
||||
|
||||
for (x in items) {
|
||||
if (! isNaN(x)) {
|
||||
item = document.getElementById(key+items[x]);
|
||||
item.style.display = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// include html into a component
|
||||
function includeHTML(component,html) {
|
||||
if (typeof(component) != 'object' || typeof(html) != 'string') return;
|
||||
component.innerHTML = html;
|
||||
|
||||
var scripts = component.getElementsByTagName('script');
|
||||
if (!scripts) return;
|
||||
|
||||
// load scripts
|
||||
for (var i = 0; i < scripts.length; i++) {
|
||||
var scriptclone = document.createElement('script');
|
||||
if (scripts[i].attributes.length > 0) {
|
||||
for (var j in scripts[i].attributes) {
|
||||
if (typeof(scripts[i].attributes[j]) != 'undefined'
|
||||
&& typeof(scripts[i].attributes[j].nodeName) != 'undefined'
|
||||
&& scripts[i].attributes[j].nodeValue != null
|
||||
&& scripts[i].attributes[j].nodeValue != '') {
|
||||
scriptclone.setAttribute(scripts[i].attributes[j].nodeName,scripts[i].attributes[j].nodeValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
scriptclone.text = scripts[i].text;
|
||||
scripts[i].parentNode.replaceChild(scriptclone,scripts[i]);
|
||||
eval(scripts[i].innerHTML);
|
||||
}
|
||||
}
|
||||
|
||||
// callback function
|
||||
function alertHttpRequest() {
|
||||
if (http_request && (http_request.readyState == 4)) {
|
||||
if (http_request.status == 200 || http_request.status == 401) {
|
||||
response = http_request.responseText;
|
||||
http_request = null;
|
||||
//alert(response);
|
||||
if (http_request_success_callback) {
|
||||
eval(http_request_success_callback + '(response,http_div)');
|
||||
}
|
||||
} else {
|
||||
alert('There was a problem with the request.');
|
||||
cancelHttpRequest();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function cancelHttpRequest() {
|
||||
if (http_request) {
|
||||
http_request = null;
|
||||
if (http_request_error_callback) {
|
||||
eval(http_request_error_callback + '(http_div)');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function makeHttpRequest(url,parameters,meth,successCallbackFunctionName,errorCallbackFunctionName,div) {
|
||||
cancelHttpRequest(div);
|
||||
|
||||
http_request_success_callback = successCallbackFunctionName;
|
||||
http_request_error_callback = errorCallbackFunctionName;
|
||||
http_div = div;
|
||||
|
||||
if (window.XMLHttpRequest) { // Mozilla, Safari,...
|
||||
http_request = new XMLHttpRequest();
|
||||
if (http_request.overrideMimeType) {
|
||||
http_request.overrideMimeType('text/html');
|
||||
}
|
||||
|
||||
} else if (window.ActiveXObject) { // IE
|
||||
try {
|
||||
http_request = new ActiveXObject('Msxml2.XMLHTTP');
|
||||
} catch (e) {
|
||||
try {
|
||||
http_request = new ActiveXObject('Microsoft.XMLHTTP');
|
||||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
|
||||
if (!http_request) {
|
||||
alert('Cannot create XMLHTTP instance.');
|
||||
return false;
|
||||
}
|
||||
|
||||
http_request.onreadystatechange = window['alertHttpRequest'];
|
||||
if (meth == 'GET') url = url + '?' + parameters;
|
||||
http_request.open(meth,url,true);
|
||||
|
||||
http_request.setRequestHeader('Content-type','application/x-www-form-urlencoded');
|
||||
http_request.setRequestHeader('Content-length',parameters.length);
|
||||
http_request.setRequestHeader('Connection','close');
|
||||
|
||||
if (meth == 'GET') parameters = null;
|
||||
http_request.send(parameters);
|
||||
}
|
@@ -63,7 +63,7 @@ function alertTreeNodeContents(html) {
|
||||
updateNewStyle();
|
||||
}
|
||||
|
||||
function opencloseTreeNode(nodeid, params) {
|
||||
function opencloseTreeNode(nodeid,params,imgdir) {
|
||||
cancelHttpRequest(); // cancel last request
|
||||
|
||||
// get the node element
|
||||
@@ -81,29 +81,29 @@ function opencloseTreeNode(nodeid, params) {
|
||||
oldstyle = sonLayer.style.display;
|
||||
oldimg = nodeLayer.src;
|
||||
var action = 0; // (action = 1) => expand ; (action = 2) => collapse
|
||||
if (oldimg.indexOf('js/phplayersmenu/menuimages/tree_expand.png') > -1) {
|
||||
newimg = 'js/phplayersmenu/menuimages/tree_collapse.png';
|
||||
if (oldimg.indexOf(imgdir+'/tree_expand.png') > -1) {
|
||||
newimg = imgdir+'/tree_collapse.png';
|
||||
action = 1;
|
||||
} else if (oldimg.indexOf('js/phplayersmenu/menuimages/tree_expand_first.png') > -1) {
|
||||
newimg = 'js/phplayersmenu/menuimages/tree_collapse_first.png';
|
||||
} else if (oldimg.indexOf(imgdir+'/tree_expand_first.png') > -1) {
|
||||
newimg = imgdir+'/tree_collapse_first.png';
|
||||
action = 1;
|
||||
} else if (oldimg.indexOf('js/phplayersmenu/menuimages/tree_expand_corner.png') > -1) {
|
||||
newimg = 'js/phplayersmenu/menuimages/tree_collapse_corner.png';
|
||||
} else if (oldimg.indexOf(imgdir+'/tree_expand_corner.png') > -1) {
|
||||
newimg = imgdir+'/tree_collapse_corner.png';
|
||||
action = 1;
|
||||
} else if (oldimg.indexOf('js/phplayersmenu/menuimages/tree_expand_corner_first.png') > -1) {
|
||||
newimg = 'js/phplayersmenu/menuimages/tree_collapse_corner_first.png';
|
||||
} else if (oldimg.indexOf(imgdir+'/tree_expand_corner_first.png') > -1) {
|
||||
newimg = imgdir+'/tree_collapse_corner_first.png';
|
||||
action = 1;
|
||||
} else if (oldimg.indexOf('js/phplayersmenu/menuimages/tree_collapse.png') > -1) {
|
||||
newimg = 'js/phplayersmenu/menuimages/tree_expand.png';
|
||||
} else if (oldimg.indexOf(imgdir+'/tree_collapse.png') > -1) {
|
||||
newimg = imgdir+'/tree_expand.png';
|
||||
action = 2;
|
||||
} else if (oldimg.indexOf('js/phplayersmenu/menuimages/tree_collapse_first.png') > -1) {
|
||||
newimg = 'js/phplayersmenu/menuimages/tree_expand_first.png';
|
||||
} else if (oldimg.indexOf(imgdir+'/tree_collapse_first.png') > -1) {
|
||||
newimg = imgdir+'/tree_expand_first.png';
|
||||
action = 2;
|
||||
} else if (oldimg.indexOf('js/phplayersmenu/menuimages/tree_collapse_corner.png') > -1) {
|
||||
newimg = 'js/phplayersmenu/menuimages/tree_expand_corner.png';
|
||||
} else if (oldimg.indexOf(imgdir+'/tree_collapse_corner.png') > -1) {
|
||||
newimg = imgdir+'/tree_expand_corner.png';
|
||||
action = 2;
|
||||
} else if (oldimg.indexOf('js/phplayersmenu/menuimages/tree_collapse_corner_first.png') > -1) {
|
||||
newimg = 'js/phplayersmenu/menuimages/tree_expand_corner_first.png';
|
||||
} else if (oldimg.indexOf(imgdir+'/tree_collapse_corner_first.png') > -1) {
|
||||
newimg = imgdir+'/tree_expand_corner_first.png';
|
||||
action = 2;
|
||||
}
|
||||
nodeLayer.src = 'images/ajax-spinner.gif';
|
||||
@@ -116,7 +116,7 @@ function opencloseTreeNode(nodeid, params) {
|
||||
} else if (action == 1) {
|
||||
newstyle = 'block';
|
||||
if (sonLayer.innerHTML == '') {
|
||||
makeGETRequest('cmd.php', params+'&cmd=draw_tree_node&action=1', 'alertTreeNodeContents', 'cancelNewStyle');
|
||||
makeHttpRequest('cmd.php',params+'&cmd=draw_tree_node&action=1','GET','alertTreeNodeContents','cancelNewStyle');
|
||||
} else {
|
||||
updateNewStyle();
|
||||
}
|
||||
@@ -143,21 +143,28 @@ function cancelAJ(div) {
|
||||
if (pageDiv) includeHTML(pageDiv, '');
|
||||
}
|
||||
|
||||
function displayAJ(div,urlParameters,display) {
|
||||
var pageDiv = getDiv(div);
|
||||
if (pageDiv)
|
||||
includeHTML(pageDiv, '<img src="images/ajax-progress.gif"><br><small>'+display+'...</small>');
|
||||
else
|
||||
return true;
|
||||
|
||||
makeGETRequest('cmd.php', urlParameters+'&meth=ajax', 'alertAJ', 'cancelAJ',div);
|
||||
return false;
|
||||
}
|
||||
|
||||
// close initial collapsed nodes
|
||||
// Cant figure out why, but this runs twice in AJAX mode when using "refresh".
|
||||
// Causing the collapsedNodes to be incorrect.
|
||||
readCollapsedNodes();
|
||||
for (k = 0; k < collapsedNodes.length; k++) {
|
||||
opencloseTreeNode(collapsedNodes[k], '#');
|
||||
opencloseTreeNode(collapsedNodes[k],'#','images/default');
|
||||
}
|
||||
|
||||
var current;
|
||||
|
||||
function tree_unhide(whichLayer,old) {
|
||||
if (current == null) current = old;
|
||||
|
||||
var oldtree = document.getElementById('ajSID_'+current).style;
|
||||
oldtree.display = 'none';
|
||||
|
||||
if (document.getElementById) {
|
||||
// this is the way the standards work
|
||||
var newtree = document.getElementById(whichLayer).value;
|
||||
var newtree_div = document.getElementById('ajSID_'+newtree).style;
|
||||
newtree_div.display = 'block';
|
||||
}
|
||||
|
||||
current = newtree;
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
function dateSelector(id) {
|
||||
var el = document.getElementById('f_date_'+id);
|
||||
var el = document.getElementById('new_values_'+id);
|
||||
var format = gettype(el.id);
|
||||
var epoch;
|
||||
var parse = false;
|
||||
|
51
htdocs/js/form_field_toggle_enable.js
Normal file
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* This function will provide a enable/disable toggle for a HTML form field
|
||||
*/
|
||||
function form_field_toggle_enable(field,disable,focus,rev) {
|
||||
var i;
|
||||
var result;
|
||||
var element;
|
||||
|
||||
switch (field.type) {
|
||||
case 'checkbox':
|
||||
if (field.checked)
|
||||
result = rev ? false : true;
|
||||
else
|
||||
result = rev ? true : false;
|
||||
|
||||
for (i=0;i<disable.length;i++) {
|
||||
element = disable[i];
|
||||
field.form[element].disabled = result;
|
||||
|
||||
if (focus && (disable[i] == focus))
|
||||
field.form[element].focus();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
alert('field: '+field.type+' disable: '+disable.length+' focus: '+focus);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by the copy form to enable/disable the recursive copy and delete
|
||||
*/
|
||||
function copy_field_toggle(field) {
|
||||
var disable = ['remove','filter'];
|
||||
var clear = 'remove';
|
||||
|
||||
form_field_toggle_enable(field,disable,'filter',true);
|
||||
field.form[clear].checked = field.form[clear].checked && field.checked ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by the export form to enable/disable compression
|
||||
*/
|
||||
function export_field_toggle(field) {
|
||||
var disable = ['compress'];
|
||||
var clear = 'compress';
|
||||
|
||||
form_field_toggle_enable(field,disable,'compress',true);
|
||||
field.form[clear].checked = field.form[clear].checked && field.checked ? true : false;
|
||||
}
|
@@ -1,21 +0,0 @@
|
||||
function trim(inputString) {
|
||||
// Removes leading and trailing spaces from the passed string. Also removes
|
||||
// consecutive spaces and replaces it with one space. If something besides
|
||||
// a string is passed in (null, custom object, etc.) then return the input.
|
||||
if (typeof inputString != "string") { return inputString; }
|
||||
var retValue = inputString;
|
||||
var ch = retValue.substring(0, 1);
|
||||
while (ch == " ") { // Check for spaces at the beginning of the string
|
||||
retValue = retValue.substring(1, retValue.length);
|
||||
ch = retValue.substring(0, 1);
|
||||
}
|
||||
ch = retValue.substring(retValue.length-1, retValue.length);
|
||||
while (ch == " ") { // Check for spaces at the end of the string
|
||||
retValue = retValue.substring(0, retValue.length-1);
|
||||
ch = retValue.substring(retValue.length-1, retValue.length);
|
||||
}
|
||||
while (retValue.indexOf(" ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
|
||||
retValue = retValue.substring(0, retValue.indexOf(" ")) + retValue.substring(retValue.indexOf(" ")+1, retValue.length); // Again, there are two spaces in each of the strings
|
||||
}
|
||||
return retValue; // Return the trimmed string back to the user
|
||||
}
|
@@ -1,29 +0,0 @@
|
||||
function fixIEPNG( img )
|
||||
{
|
||||
img.style.filter =
|
||||
"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"
|
||||
+ img.src + "', enabled=true)";
|
||||
img.src="blank.gif";
|
||||
}
|
||||
|
||||
function checkPNGs()
|
||||
{
|
||||
// test to see if the browser is IE
|
||||
var agent = navigator.userAgent.toLowerCase();
|
||||
var is_ie = (( agent.indexOf("msie") != -1 ) &&
|
||||
( agent.indexOf("opera") == -1 ));
|
||||
|
||||
// if IE, use DirectX to correctly display a PNG
|
||||
if ( !is_ie ) return;
|
||||
|
||||
// go through each image in the page and fix them
|
||||
for ( var i = 0; i < document.images.length; i++ )
|
||||
{
|
||||
// only if the image is a png
|
||||
var img = document.images[ i ];
|
||||
if ( img.src.indexOf( "png" ) != -1 )
|
||||
fixIEPNG( img );
|
||||
}
|
||||
}
|
||||
|
||||
checkPNGs();
|
46
htdocs/js/layersmenu-browser_detection.js
Normal file
@@ -0,0 +1,46 @@
|
||||
// PHP Layers Menu 3.2.0-rc (C) 2001-2004 Marco Pratesi - http://www.marcopratesi.it/
|
||||
// PHPLM v. 4.0.0 (C) 2007 Andreas Kasenides andreas@kasenides.org
|
||||
// PHPLM v. 4.0.4 (C) 2008 Andreas Kasenides andreas@kasenides.org, Brett Zamir
|
||||
/**
|
||||
* @version 4.0.4
|
||||
* @author PHPLM v. 4.0.4 (C) 2008 Andreas Kasenides andreas@kasenides.org
|
||||
* @author PHP Layers Menu 3.2.0-rc (C) 2001-2004 Marco Pratesi - http://www.marcopratesi.it/
|
||||
* @author Brett Zamir
|
||||
*/
|
||||
|
||||
var DOM = (document.getElementById) ? 1 : 0;
|
||||
var NS4 = (document.layers) ? 1 : 0;
|
||||
|
||||
// We need to explicitly detect Konqueror
|
||||
// because Konqueror 3 sets IE = 1 ... AAAAAAAAAARGHHH!!!
|
||||
var Konqueror = (navigator.userAgent.indexOf('Konqueror') > -1) ? 1 : 0;
|
||||
// We need to detect Konqueror 2.2 as it does not handle the window.onresize event
|
||||
var Konqueror22 = (navigator.userAgent.indexOf('Konqueror 2.2') > -1 || navigator.userAgent.indexOf('Konqueror/2.2') > -1) ? 1 : 0;
|
||||
var Konqueror30 =
|
||||
(
|
||||
navigator.userAgent.indexOf('Konqueror 3.0') > -1
|
||||
|| navigator.userAgent.indexOf('Konqueror/3.0') > -1
|
||||
|| navigator.userAgent.indexOf('Konqueror 3;') > -1
|
||||
|| navigator.userAgent.indexOf('Konqueror/3;') > -1
|
||||
|| navigator.userAgent.indexOf('Konqueror 3)') > -1
|
||||
|| navigator.userAgent.indexOf('Konqueror/3)') > -1
|
||||
)
|
||||
? 1 : 0;
|
||||
var Konqueror31 = (navigator.userAgent.indexOf('Konqueror 3.1') > -1 || navigator.userAgent.indexOf('Konqueror/3.1') > -1) ? 1 : 0;
|
||||
// We need to detect Konqueror 3.2 and 3.3 as they are affected by the see-through effect only for 2 form elements
|
||||
var Konqueror32 = (navigator.userAgent.indexOf('Konqueror 3.2') > -1 || navigator.userAgent.indexOf('Konqueror/3.2') > -1) ? 1 : 0;
|
||||
var Konqueror33 = (navigator.userAgent.indexOf('Konqueror 3.3') > -1 || navigator.userAgent.indexOf('Konqueror/3.3') > -1) ? 1 : 0;
|
||||
|
||||
var Opera = (navigator.userAgent.indexOf('Opera') > -1) ? 1 : 0;
|
||||
var Opera5 = (navigator.userAgent.indexOf('Opera 5') > -1 || navigator.userAgent.indexOf('Opera/5') > -1) ? 1 : 0;
|
||||
var Opera6 = (navigator.userAgent.indexOf('Opera 6') > -1 || navigator.userAgent.indexOf('Opera/6') > -1) ? 1 : 0;
|
||||
var Opera56 = Opera5 || Opera6;
|
||||
var Opera7 = (navigator.userAgent.indexOf('Opera 7') > -1 || navigator.userAgent.indexOf('Opera/7') > -1) ? 1 : 0;
|
||||
var Opera8 = (navigator.userAgent.indexOf('Opera 8') > -1 || navigator.userAgent.indexOf('Opera/8') > -1) ? 1 : 0;
|
||||
var Opera9 = (navigator.userAgent.indexOf('Opera 9') > -1 || navigator.userAgent.indexOf('Opera/9') > -1) ? 1 : 0;
|
||||
|
||||
var IE = (navigator.userAgent.indexOf('MSIE') > -1) ? 1 : 0;
|
||||
IE = IE && !Opera;
|
||||
var IE5 = IE && DOM;
|
||||
var IE4 = (document.all) ? 1 : 0;
|
||||
IE4 = IE4 && IE && !DOM;
|
@@ -1,27 +1,18 @@
|
||||
/* This function submits the form
|
||||
* when Save Changes button is pressed.
|
||||
* see modify_member_form.php
|
||||
*/
|
||||
function submitForm(formId) {
|
||||
var formObj = document.getElementById(formId);
|
||||
formObj.submit();
|
||||
}
|
||||
var m1 = document.member.notmembers;
|
||||
var m2 = document.member.members;
|
||||
|
||||
/* This function generates hidden input array from new group members
|
||||
* when submit button is pressed.
|
||||
* see modify_member_form.php
|
||||
*/
|
||||
function update_new_values(memberattr,formId) {
|
||||
function update_new_values(memberattr) {
|
||||
el = document.getElementById("dnu");
|
||||
|
||||
for (i=0;i<m2.length;i++) {
|
||||
el.innerHTML =
|
||||
el.innerHTML +
|
||||
"<input type='hidden' name='new_values[" + memberattr + "][" +
|
||||
i + "]' value='" + m2.options[i].text + "' />";
|
||||
"<input type='hidden' name='new_values[" + memberattr + "][" + i + "]' value='" + m2.options[i].text + "' />";
|
||||
}
|
||||
|
||||
submitForm(formId);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +20,8 @@ function update_new_values(memberattr,formId) {
|
||||
* see modify_member_form.php
|
||||
*/
|
||||
function one2two() {
|
||||
|
||||
m1len = m1.length ;
|
||||
|
||||
for (i=0;i<m1len;i++) {
|
||||
if (m1.options[i].selected == true) {
|
||||
m2len = m2.length;
|
||||
@@ -49,8 +40,8 @@ function one2two() {
|
||||
* see modify_member_form.php
|
||||
*/
|
||||
function two2one() {
|
||||
|
||||
m2len = m2.length ;
|
||||
|
||||
for (i=0;i<m2len;i++){
|
||||
if (m2.options[i].selected == true) {
|
||||
m1len = m1.length;
|
||||
@@ -69,8 +60,8 @@ function two2one() {
|
||||
* see modify_member_form.php
|
||||
*/
|
||||
function all2two() {
|
||||
|
||||
m1len = m1.length ;
|
||||
|
||||
for (i=0;i<m1len;i++) {
|
||||
m2len = m2.length;
|
||||
m2.options[m2len]= new Option(m1.options[i].text);
|
||||
@@ -85,8 +76,8 @@ function all2two() {
|
||||
* see modify_member_form.php
|
||||
*/
|
||||
function all2one() {
|
||||
|
||||
m2len = m2.length ;
|
||||
|
||||
for (i=0;i<m2len;i++) {
|
||||
m1len = m1.length;
|
||||
m1.options[m1len]= new Option(m2.options[i].text);
|
||||
|
@@ -1,504 +0,0 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
@@ -1,24 +0,0 @@
|
||||
|
||||
Copyright (C) 2001-2004 Marco Pratesi
|
||||
|
||||
PHP Layers Menu is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
PHP Layers Menu is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
A copy of version 2.1 of the GNU Lesser General Public License
|
||||
is available in the file COPYING.
|
||||
|
||||
Marco Pratesi
|
||||
http://www.marcopratesi.it/
|
||||
|
||||
This is taken from phplayersmenu-3.2.0-rc
|
@@ -1,81 +0,0 @@
|
||||
table.tree .treemenudiv {
|
||||
display: block;
|
||||
white-space: nowrap;
|
||||
padding-top: 1px;
|
||||
padding-bottom: 1px;
|
||||
}
|
||||
|
||||
table.tree .phplmnormal {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmnormal:hover {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
background-color: #fff0c0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplm:link {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplm:visited {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplm:hover {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #841212;
|
||||
background-color: #fff0c0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplm:active {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #ff0000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmselected:link {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #dd0000;
|
||||
background-color: #ffdd76;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmselected:visited {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #dd0000;
|
||||
background-color: #ffdd76;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmselected:hover {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #841212;
|
||||
background-color: #fff0c0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmselected:active {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #ff0000;
|
||||
text-decoration: none;
|
||||
}
|
@@ -1,567 +0,0 @@
|
||||
<?php
|
||||
// vim: set expandtab tabstop=4 shiftwidth=4:
|
||||
// This code that was derived from the original PHPLIB Template class
|
||||
// is copyright by Kristian Koehntopp, NetUSE AG and was released
|
||||
// under the LGPL.
|
||||
//
|
||||
// Authors: Kristian Koehntopp <kris@koehntopp.de> (original from PHPLIB)
|
||||
// Bjoern Schotte <bjoern@rent-a-phpwizard.de> (PEARification)
|
||||
// Martin Jansen <mj@php.net> (PEAR conformance)
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
|
||||
//require_once "PEAR.php";
|
||||
|
||||
/**
|
||||
* Converted PHPLIB Template class
|
||||
*
|
||||
* For those who want to use PHPLIB's fine template class,
|
||||
* here's a PEAR conforming class with the original PHPLIB
|
||||
* template code from phplib-stable CVS. Original author
|
||||
* was Kristian Koehntopp <kris@koehntopp.de>
|
||||
*
|
||||
* @author Bjoern Schotte <bjoern@rent-a-phpwizard.de>
|
||||
* @author Martin Jansen <mj@php.net> (PEAR conformance)
|
||||
* @version 1.0
|
||||
*/
|
||||
class Template_PHPLIB
|
||||
{
|
||||
/**
|
||||
* If set, echo assignments
|
||||
* @var bool
|
||||
*/
|
||||
public $debug = false;
|
||||
|
||||
/**
|
||||
* $file[handle] = "filename";
|
||||
* @var array
|
||||
*/
|
||||
public $file = array();
|
||||
|
||||
/**
|
||||
* fallback paths that should be defined in a child class
|
||||
* @var array
|
||||
*/
|
||||
public $file_fallbacks = array();
|
||||
|
||||
/**
|
||||
* Relative filenames are relative to this pathname
|
||||
* @var string
|
||||
*/
|
||||
public $root = "";
|
||||
|
||||
/*
|
||||
* $_varKeys[key] = "key"
|
||||
* @var array
|
||||
*/
|
||||
public $_varKeys = array();
|
||||
|
||||
/**
|
||||
* $_varVals[key] = "value";
|
||||
* @var array
|
||||
*/
|
||||
public $_varVals = array();
|
||||
|
||||
/**
|
||||
* "remove" => remove undefined variables
|
||||
* "comment" => replace undefined variables with comments
|
||||
* "keep" => keep undefined variables
|
||||
* @var string
|
||||
*/
|
||||
public $unknowns = "remove";
|
||||
|
||||
/**
|
||||
* "yes" => halt, "report" => report error, continue, "no" => ignore error quietly
|
||||
* @var string
|
||||
*/
|
||||
public $haltOnError = "report";
|
||||
|
||||
/**
|
||||
* The last error message is retained here
|
||||
* @var string
|
||||
* @see halt
|
||||
*/
|
||||
public $_lastError = "";
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access public
|
||||
* @param string template root directory
|
||||
* @param string how to handle unknown variables
|
||||
* @param array fallback paths
|
||||
*/
|
||||
function Template_PHPLIB($root = ".", $unknowns = "remove", $fallback="")
|
||||
{
|
||||
$this->setRoot($root);
|
||||
$this->setUnknowns($unknowns);
|
||||
if (is_array($fallback)) $this->file_fallbacks = $fallback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the template directory
|
||||
*
|
||||
* @access public
|
||||
* @param string new template directory
|
||||
* @return bool
|
||||
*/
|
||||
function setRoot($root)
|
||||
{
|
||||
if (!is_dir($root)) {
|
||||
$this->halt("setRoot: $root is not a directory.");
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->root = $root;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* What to do with unknown variables
|
||||
*
|
||||
* three possible values:
|
||||
*
|
||||
* - "remove" will remove unknown variables
|
||||
* (don't use this if you define CSS in your page)
|
||||
* - "comment" will replace undefined variables with comments
|
||||
* - "keep" will keep undefined variables as-is
|
||||
*
|
||||
* @access public
|
||||
* @param string unknowns
|
||||
*/
|
||||
function setUnknowns($unknowns = "keep")
|
||||
{
|
||||
$this->unknowns = $unknowns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set appropriate template files
|
||||
*
|
||||
* With this method you set the template files you want to use.
|
||||
* Either you supply an associative array with key/value pairs
|
||||
* where the key is the handle for the filname and the value
|
||||
* is the filename itself, or you define $handle as the file name
|
||||
* handle and $filename as the filename if you want to define only
|
||||
* one template.
|
||||
*
|
||||
* @access public
|
||||
* @param mixed handle for a filename or array with handle/name value pairs
|
||||
* @param string name of template file
|
||||
* @return bool
|
||||
*/
|
||||
function setFile($handle, $filename = "")
|
||||
{
|
||||
if (!is_array($handle)) {
|
||||
|
||||
if ($filename == "") {
|
||||
$this->halt("setFile: For handle $handle filename is empty.");
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->file[$handle] = $this->_filename($filename);
|
||||
|
||||
} else {
|
||||
|
||||
reset($handle);
|
||||
while (list($h, $f) = each($handle)) {
|
||||
$this->file[$h] = $this->_filename($f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a block in the appropriate template handle
|
||||
*
|
||||
* By setting a block like that:
|
||||
*
|
||||
* <!-- BEGIN blockname -->
|
||||
* html code
|
||||
* <!-- END blockname -->
|
||||
*
|
||||
* you can easily do repeating HTML code, i.e. output
|
||||
* database data nice formatted into a HTML table where
|
||||
* each DB row is placed into a HTML table row which is
|
||||
* defined in this block.
|
||||
* It extracts the template $handle from $parent and places
|
||||
* variable {$name} instead.
|
||||
*
|
||||
* @access public
|
||||
* @param string parent handle
|
||||
* @param string block name handle
|
||||
* @param string variable substitution name
|
||||
*/
|
||||
function setBlock($parent, $handle, $name = "")
|
||||
{
|
||||
if (!$this->_loadFile($parent)) {
|
||||
$this->halt("setBlock: unable to load $parent.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($name == "") {
|
||||
$name = $handle;
|
||||
}
|
||||
|
||||
$str = $this->getVar($parent);
|
||||
$reg = "/[ \t]*<!--\s+BEGIN $handle\s+-->\s*?\n?(\s*.*?\n?)\s*<!--\s+END $handle\s+-->\s*?\n?/sm";
|
||||
preg_match_all($reg, $str, $m);
|
||||
$str = preg_replace($reg, "{" . "$name}", $str);
|
||||
|
||||
if (isset($m[1][0])) $this->setVar($handle, $m[1][0]);
|
||||
$this->setVar($parent, $str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set corresponding substitutions for placeholders
|
||||
*
|
||||
* @access public
|
||||
* @param string name of a variable that is to be defined or an array of variables with value substitution as key/value pairs
|
||||
* @param string value of that variable
|
||||
* @param boolean if true, the value is appended to the variable's existing value
|
||||
*/
|
||||
function setVar($varname, $value = "", $append = false)
|
||||
{
|
||||
if (!is_array($varname)) {
|
||||
|
||||
if (!empty($varname))
|
||||
if ($this->debug) print "scalar: set *$varname* to *$value*<br>\n";
|
||||
|
||||
$this->_varKeys[$varname] = $this->_varname($varname);
|
||||
($append) ? $this->_varVals[$varname] .= $value : $this->_varVals[$varname] = $value;
|
||||
|
||||
} else {
|
||||
reset($varname);
|
||||
|
||||
while (list($k, $v) = each($varname)) {
|
||||
if (!empty($k))
|
||||
if ($this->debug) print "array: set *$k* to *$v*<br>\n";
|
||||
|
||||
$this->_varKeys[$k] = $this->_varname($k);
|
||||
($append) ? $this->_varVals[$k] .= $v : $this->_varVals[$k] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Substitute variables in handle $handle
|
||||
*
|
||||
* @access public
|
||||
* @param string name of handle
|
||||
* @return mixed string substituted content of handle
|
||||
*/
|
||||
function subst($handle)
|
||||
{
|
||||
if (!$this->_loadFile($handle)) {
|
||||
$this->halt("subst: unable to load $handle.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return @str_replace($this->_varKeys, $this->_varVals, $this->getVar($handle));
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as subst but printing the result
|
||||
*
|
||||
* @access public
|
||||
* @brother subst
|
||||
* @param string handle of template
|
||||
* @return bool always false
|
||||
*/
|
||||
function pSubst($handle)
|
||||
{
|
||||
print $this->subst($handle);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse handle into target
|
||||
*
|
||||
* Parses handle $handle into $target, eventually
|
||||
* appending handle at $target if $append is defined
|
||||
* as TRUE.
|
||||
*
|
||||
* @access public
|
||||
* @param string target handle to parse into
|
||||
* @param string which handle should be parsed
|
||||
* @param boolean append it to $target or not?
|
||||
* @return string parsed handle
|
||||
*/
|
||||
function parse($target, $handle, $append = false)
|
||||
{
|
||||
if (!is_array($handle)) {
|
||||
$str = $this->subst($handle);
|
||||
|
||||
($append) ? $this->setVar($target, $this->getVar($target) . $str) : $this->setVar($target, $str);
|
||||
} else {
|
||||
reset($handle);
|
||||
|
||||
while (list(, $h) = each($handle)) {
|
||||
$str = $this->subst($h);
|
||||
$this->setVar($target, $str);
|
||||
}
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as parse, but printing it.
|
||||
*
|
||||
* @access public
|
||||
* @brother parse
|
||||
* @param string target to parse into
|
||||
* @param string handle which should be parsed
|
||||
* @param should $handle be appended to $target?
|
||||
* @return bool
|
||||
*/
|
||||
function pParse($target, $handle, $append = false)
|
||||
{
|
||||
print $this->finish($this->parse($target, $handle, $append));
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all defined variables and their values
|
||||
*
|
||||
* @access public
|
||||
* @return array with all defined variables and their values
|
||||
*/
|
||||
function getVars()
|
||||
{
|
||||
reset($this->_varKeys);
|
||||
|
||||
while (list($k, ) = each($this->_varKeys)) {
|
||||
$result[$k] = $this->getVar($k);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return one or more specific variable(s) with their values.
|
||||
*
|
||||
* @access public
|
||||
* @param mixed array with variable names or one variable name as a string
|
||||
* @return mixed array of variable names with their values or value of one specific variable
|
||||
*/
|
||||
function getVar($varname)
|
||||
{
|
||||
if (!is_array($varname)) {
|
||||
if (isset($this->_varVals[$varname])) {
|
||||
return $this->_varVals[$varname];
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
} else {
|
||||
reset($varname);
|
||||
|
||||
while (list($k, ) = each($varname)) {
|
||||
$result[$k] = (isset($this->_varVals[$k])) ? $this->_varVals[$k] : "";
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get undefined values of a handle
|
||||
*
|
||||
* @access public
|
||||
* @param string handle name
|
||||
* @return mixed false if an error occured or the undefined values
|
||||
*/
|
||||
function getUndefined($handle)
|
||||
{
|
||||
if (!$this->_loadFile($handle)) {
|
||||
$this->halt("getUndefined: unable to load $handle.");
|
||||
return false;
|
||||
}
|
||||
|
||||
preg_match_all("/{([^ \t\r\n}]+)}/", $this->getVar($handle), $m);
|
||||
$m = $m[1];
|
||||
if (!is_array($m)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
reset($m);
|
||||
while (list(, $v) = each($m)) {
|
||||
if (!isset($this->_varKeys[$v])) {
|
||||
$result[$v] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($result) && count($result)) {
|
||||
return $result;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finish string
|
||||
*
|
||||
* @access public
|
||||
* @param string string to finish
|
||||
* @return finished, i.e. substituted string
|
||||
*/
|
||||
function finish($str)
|
||||
{
|
||||
switch ($this->unknowns) {
|
||||
case "remove":
|
||||
$str = preg_replace('/{[^ \t\r\n}]+}/', "", $str);
|
||||
break;
|
||||
|
||||
case "comment":
|
||||
$str = preg_replace('/{([^ \t\r\n}]+)}/', "<!-- Template $handle: Variable \\1 undefined -->", $str);
|
||||
break;
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print variable to the browser
|
||||
*
|
||||
* @access public
|
||||
* @param string name of variable to print
|
||||
*/
|
||||
function p($varname)
|
||||
{
|
||||
print $this->finish($this->getVar($varname));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get finished variable
|
||||
*
|
||||
* @access public public
|
||||
* @param string variable to get
|
||||
* @return string string with finished variable
|
||||
*/
|
||||
function get($varname)
|
||||
{
|
||||
return $this->finish($this->getVar($varname));
|
||||
}
|
||||
|
||||
/**
|
||||
* Complete filename
|
||||
*
|
||||
* Complete filename, i.e. testing it for slashes
|
||||
*
|
||||
* @access private
|
||||
* @param string filename to be completed
|
||||
* @return string completed filename
|
||||
*/
|
||||
function _filename($filename)
|
||||
{
|
||||
// if (substr($filename, 0, 1) != "/") {
|
||||
// $filename = $this->root."/".$filename;
|
||||
// }
|
||||
|
||||
if (file_exists($filename)) return $filename;
|
||||
if (is_array($this->file_fallbacks) && count($this->file_fallbacks) > 0) {
|
||||
reset($this->file_fallbacks);
|
||||
while (list(,$v) = each($this->file_fallbacks)) {
|
||||
if (file_exists($v.basename($filename))) return $v.basename($filename);
|
||||
}
|
||||
$this->halt(sprintf("filename: file %s does not exist in the fallback paths %s.",$filename,implode(",",$this->file_fallbacks)));
|
||||
return false;
|
||||
} else {
|
||||
$this->halt(sprintf("filename: file %s does not exist.",$filename));
|
||||
return false;
|
||||
}
|
||||
|
||||
return $filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protect a replacement variable
|
||||
*
|
||||
* @access private
|
||||
* @param string name of replacement variable
|
||||
* @return string replaced variable
|
||||
*/
|
||||
function _varname($varname)
|
||||
{
|
||||
return "{".$varname."}";
|
||||
}
|
||||
|
||||
/**
|
||||
* load file defined by handle if it is not loaded yet
|
||||
*
|
||||
* @access private
|
||||
* @param string handle
|
||||
* @return bool FALSE if error, true if all is ok
|
||||
*/
|
||||
function _loadFile($handle)
|
||||
{
|
||||
if (isset($this->_varKeys[$handle]) and !empty($this->_varVals[$handle])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!isset($this->file[$handle])) {
|
||||
$this->halt("loadfile: $handle is not a valid handle.");
|
||||
return false;
|
||||
}
|
||||
|
||||
$filename = $this->file[$handle];
|
||||
if (function_exists("file_get_contents")) {
|
||||
$str = file_get_contents($filename);
|
||||
} else {
|
||||
if (!$fp = @fopen($filename,"r")) {
|
||||
$this->halt("loadfile: couldn't open $filename");
|
||||
return false;
|
||||
}
|
||||
|
||||
$str = fread($fp,filesize($filename));
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
if ($str=='') {
|
||||
$this->halt("loadfile: While loading $handle, $filename does not exist or is empty.");
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->setVar($handle, $str);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Error function. Halt template system with message to show
|
||||
*
|
||||
* @access public
|
||||
* @param string message to show
|
||||
* @return bool
|
||||
*/
|
||||
function halt($msg)
|
||||
{
|
||||
$this->_lastError = $msg;
|
||||
|
||||
if ($this->haltOnError != "no") {
|
||||
// return $this->haltMsg($msg);
|
||||
$this->haltMsg($msg);
|
||||
}
|
||||
|
||||
if ($this->haltOnError == "yes") {
|
||||
die("<b>Halted.</b>");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* printf error message to show
|
||||
*
|
||||
* @access public
|
||||
* @param string message to show
|
||||
* @return object PEAR error object
|
||||
*/
|
||||
function haltMsg($msg)
|
||||
{
|
||||
// PEAR::raiseError(sprintf("<b>Template Error:</b> %s<br>\n", $msg));
|
||||
printf("<b>Template Error:</b> %s<br>\n", $msg);
|
||||
}
|
||||
}
|
||||
?>
|
@@ -1,959 +0,0 @@
|
||||
<?php
|
||||
// PHP Layers Menu 3.2.0-rc (C) 2001-2004 Marco Pratesi - http://www.marcopratesi.it/
|
||||
|
||||
/**
|
||||
* This file contains the code of the LayersMenuCommon class.
|
||||
* @package PHPLayersMenu
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is the "common" class of the PHP Layers Menu library.
|
||||
*
|
||||
* You need to include PEAR.php and DB.php if (and only if) you want to use the DB support provided by ths class.
|
||||
*
|
||||
* @version 3.2.0-rc
|
||||
* @package PHPLayersMenu
|
||||
*/
|
||||
class LayersMenuCommon
|
||||
{
|
||||
|
||||
/**
|
||||
* The name of the package
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
public $_packageName;
|
||||
/**
|
||||
* The version of the package
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
public $version;
|
||||
/**
|
||||
* The copyright of the package
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
public $copyright;
|
||||
/**
|
||||
* The author of the package
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
public $author;
|
||||
|
||||
/**
|
||||
* URL to be prepended to the menu hrefs
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
public $prependedUrl = '';
|
||||
/**
|
||||
* Do you want that code execution halts on error?
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
public $haltOnError = 'yes';
|
||||
|
||||
/**
|
||||
* The base directory where the package is installed
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
public $dirroot;
|
||||
/**
|
||||
* The "libjs" directory of the package
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
public $libjsdir;
|
||||
/**
|
||||
* The directory where images related to the menu can be found
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
public $imgdir;
|
||||
/**
|
||||
* The http path corresponding to imgdir
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
public $imgwww;
|
||||
/**
|
||||
* The directory where icons of menu items can be found
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
public $icondir;
|
||||
/**
|
||||
* The http path corresponding to icondir
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
public $iconwww;
|
||||
/**
|
||||
* This array may contain width and height of all icons
|
||||
* @access private
|
||||
* @var integer
|
||||
*/
|
||||
public $iconsize = array();
|
||||
/**
|
||||
* If this var is false, width and height of icons have to be detected; if this var is true, width and height of icons are not detected and are retrieved from the iconsize array
|
||||
* @access private
|
||||
* @var boolean
|
||||
*/
|
||||
public $issetIconsize = false;
|
||||
/**
|
||||
* The directory where templates can be found
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
public $tpldir;
|
||||
/**
|
||||
* The string containing the menu structure
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
public $menuStructure;
|
||||
|
||||
/**
|
||||
* It counts nodes for all menus
|
||||
* @access private
|
||||
* @var integer
|
||||
*/
|
||||
public $_nodesCount;
|
||||
/**
|
||||
* A multi-dimensional array to store informations for each menu entry
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
public $tree;
|
||||
/**
|
||||
* A multi-dimensional array used only with the DB support; for each $menu_name, it stores the $cnt associated to each item id
|
||||
*
|
||||
* This array is needed for selection of the current item
|
||||
* through the corresponding id (see the DB table structure)
|
||||
* as, internally, items are stored, sorted and addressed in terms of $cnt
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
public $treecnt;
|
||||
/**
|
||||
* The maximum hierarchical level of menu items
|
||||
* @access private
|
||||
* @var integer
|
||||
*/
|
||||
public $_maxLevel;
|
||||
/**
|
||||
* An array that counts the number of first level items for each menu
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
public $_firstLevelCnt;
|
||||
/**
|
||||
* An array containing the number identifying the first item of each menu
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
public $_firstItem;
|
||||
/**
|
||||
* An array containing the number identifying the last item of each menu
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
public $_lastItem;
|
||||
|
||||
/**
|
||||
* Data Source Name: the connection string for PEAR DB
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
public $dsn = 'pgsql://dbuser:dbpass@dbhost/dbname';
|
||||
/**
|
||||
* DB connections are either persistent or not persistent
|
||||
* @access private
|
||||
* @var boolean
|
||||
*/
|
||||
public $persistent = false;
|
||||
/**
|
||||
* Name of the table storing data describing the menu
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
public $tableName = 'phplayersmenu';
|
||||
/**
|
||||
* Name of the i18n table corresponding to $tableName
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
public $tableName_i18n = 'phplayersmenu_i18n';
|
||||
/**
|
||||
* Names of fields of the table storing data describing the menu
|
||||
*
|
||||
* default field names correspond to the same field names foreseen
|
||||
* by the menu structure format
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
public $tableFields = array(
|
||||
'id' => 'id',
|
||||
'parent_id' => 'parent_id',
|
||||
'text' => 'text',
|
||||
'href' => 'href',
|
||||
'title' => 'title',
|
||||
'icon' => 'icon',
|
||||
'target' => 'target',
|
||||
'orderfield' => 'orderfield',
|
||||
'expanded' => 'expanded'
|
||||
);
|
||||
/**
|
||||
* Names of fields of the i18n table corresponding to $tableName
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
public $tableFields_i18n = array(
|
||||
'language' => 'language',
|
||||
'id' => 'id',
|
||||
'text' => 'text',
|
||||
'title' => 'title'
|
||||
);
|
||||
/**
|
||||
* A temporary array to store data retrieved from the DB and to perform the depth-first search
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
public $_tmpArray = array();
|
||||
|
||||
/**
|
||||
* The constructor method; it initializates the menu system
|
||||
* @return void
|
||||
*/
|
||||
function LayersMenuCommon()
|
||||
{
|
||||
$this->_packageName = 'PHP Layers Menu';
|
||||
$this->version = '3.2.0-rc';
|
||||
$this->copyright = '(C) 2001-2004';
|
||||
$this->author = 'Marco Pratesi - http://www.marcopratesi.it/';
|
||||
|
||||
$this->prependedUrl = '';
|
||||
|
||||
$this->dirroot = './';
|
||||
$this->libjsdir = './libjs/';
|
||||
$this->imgdir = './menuimages/';
|
||||
$this->imgwww = 'menuimages/';
|
||||
$this->icondir = './menuicons/';
|
||||
$this->iconwww = 'menuicons/';
|
||||
$this->tpldir = './templates/';
|
||||
$this->menuStructure = '';
|
||||
$this->separator = '|';
|
||||
|
||||
$this->_nodesCount = 0;
|
||||
$this->tree = array();
|
||||
$this->treecnt = array();
|
||||
$this->_maxLevel = array();
|
||||
$this->_firstLevelCnt = array();
|
||||
$this->_firstItem = array();
|
||||
$this->_lastItem = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* The method to set the prepended URL
|
||||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
function setPrependedUrl($prependedUrl)
|
||||
{
|
||||
// We do not perform any check
|
||||
$this->prependedUrl = $prependedUrl;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method to set the dirroot directory
|
||||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
function setDirrootCommon($dirroot)
|
||||
{
|
||||
if (!is_dir($dirroot)) {
|
||||
$this->error("setDirroot: $dirroot is not a directory.");
|
||||
return false;
|
||||
}
|
||||
if (substr($dirroot, -1) != '/') {
|
||||
$dirroot .= '/';
|
||||
}
|
||||
$oldlength = strlen($this->dirroot);
|
||||
$foobar = strpos($this->libjsdir, $this->dirroot);
|
||||
if (!($foobar === false || $foobar != 0)) {
|
||||
$this->libjsdir = $dirroot . substr($this->libjsdir, $oldlength);
|
||||
}
|
||||
$foobar = strpos($this->imgdir, $this->dirroot);
|
||||
if (!($foobar === false || $foobar != 0)) {
|
||||
$this->imgdir = $dirroot . substr($this->imgdir, $oldlength);
|
||||
}
|
||||
$foobar = strpos($this->icondir, $this->dirroot);
|
||||
if (!($foobar === false || $foobar != 0)) {
|
||||
$this->icondir = $dirroot . substr($this->icondir, $oldlength);
|
||||
}
|
||||
$foobar = strpos($this->tpldir, $this->dirroot);
|
||||
if (!($foobar === false || $foobar != 0)) {
|
||||
$this->tpldir = $dirroot . substr($this->tpldir, $oldlength);
|
||||
}
|
||||
$this->dirroot = $dirroot;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method to set the libjsdir directory
|
||||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
function setLibjsdir($libjsdir)
|
||||
{
|
||||
if ($libjsdir != '' && substr($libjsdir, -1) != '/') {
|
||||
$libjsdir .= '/';
|
||||
}
|
||||
if ($libjsdir == '' || (substr($libjsdir, 0, 1) != '/' && substr($libjsdir, 1, 1) != ':')) {
|
||||
// libjsdir != /.../...
|
||||
// and libjsdir != C:\...\...
|
||||
$foobar = strpos($libjsdir, $this->dirroot);
|
||||
if ($foobar === false || $foobar != 0) {
|
||||
$libjsdir = $this->dirroot . $libjsdir;
|
||||
}
|
||||
}
|
||||
if (!is_dir($libjsdir)) {
|
||||
$this->error("setLibjsdir: $libjsdir is not a directory.");
|
||||
return false;
|
||||
}
|
||||
$this->libjsdir = $libjsdir;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method to set the imgdir directory
|
||||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
function setImgdir($imgdir)
|
||||
{
|
||||
if ($imgdir != '' && substr($imgdir, -1) != '/') {
|
||||
$imgdir .= '/';
|
||||
}
|
||||
if ($imgdir == '' || (substr($imgdir, 0, 1) != '/' && substr($imgdir, 1, 1) != ':')) {
|
||||
$foobar = strpos($imgdir, $this->dirroot);
|
||||
if ($foobar === false || $foobar != 0) {
|
||||
$imgdir = $this->dirroot . $imgdir;
|
||||
}
|
||||
}
|
||||
if (!is_dir($imgdir)) {
|
||||
$this->error("setImgdir: $imgdir is not a directory.");
|
||||
return false;
|
||||
}
|
||||
$this->imgdir = $imgdir;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method to set imgwww
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function setImgwww($imgwww)
|
||||
{
|
||||
if ($imgwww != '' && substr($imgwww, -1) != '/') {
|
||||
$imgwww .= '/';
|
||||
}
|
||||
$this->imgwww = $imgwww;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method to set the icondir directory
|
||||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
function setIcondir($icondir)
|
||||
{
|
||||
if ($icondir != '' && substr($icondir, -1) != '/') {
|
||||
$icondir .= '/';
|
||||
}
|
||||
if ($icondir == '' || (substr($icondir, 0, 1) != '/' && substr($icondir, 1, 1) != ':')) {
|
||||
$foobar = strpos($icondir, $this->dirroot);
|
||||
if ($foobar === false || $foobar != 0) {
|
||||
$icondir = $this->dirroot . $icondir;
|
||||
}
|
||||
}
|
||||
if (!is_dir($icondir)) {
|
||||
$this->error("setIcondir: $icondir is not a directory.");
|
||||
return false;
|
||||
}
|
||||
$this->icondir = $icondir;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method to set iconwww
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function setIconwww($iconwww)
|
||||
{
|
||||
if ($iconwww != '' && substr($iconwww, -1) != '/') {
|
||||
$iconwww .= '/';
|
||||
}
|
||||
$this->iconwww = $iconwww;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method to set the iconsize array
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function setIconsize($width, $height)
|
||||
{
|
||||
$this->iconsize['width'] = ($width == (int) $width) ? $width : 0;
|
||||
$this->iconsize['height'] = ($height == (int) $height) ? $height : 0;
|
||||
$this->issetIconsize = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method to unset the iconsize array
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function unsetIconsize()
|
||||
{
|
||||
unset($this->iconsize['width']);
|
||||
unset($this->iconsize['height']);
|
||||
$this->issetIconsize = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method to set the tpldir directory
|
||||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
function setTpldirCommon($tpldir)
|
||||
{
|
||||
if ($tpldir != '' && substr($tpldir, -1) != '/') {
|
||||
$tpldir .= '/';
|
||||
}
|
||||
if ($tpldir == '' || (substr($tpldir, 0, 1) != '/' && substr($tpldir, 1, 1) != ':')) {
|
||||
$foobar = strpos($tpldir, $this->dirroot);
|
||||
if ($foobar === false || $foobar != 0) {
|
||||
$tpldir = $this->dirroot . $tpldir;
|
||||
}
|
||||
}
|
||||
if (!is_dir($tpldir)) {
|
||||
$this->error("setTpldir: $tpldir is not a directory.");
|
||||
return false;
|
||||
}
|
||||
$this->tpldir = $tpldir;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method to read the menu structure from a file
|
||||
* @access public
|
||||
* @param string $tree_file the menu structure file
|
||||
* @return boolean
|
||||
*/
|
||||
function setMenuStructureFile($tree_file)
|
||||
{
|
||||
if (!($fd = fopen($tree_file, 'r'))) {
|
||||
$this->error("setMenuStructureFile: unable to open file $tree_file.");
|
||||
return false;
|
||||
}
|
||||
$this->menuStructure = '';
|
||||
while ($buffer = fgets($fd, 4096)) {
|
||||
$buffer = ereg_replace(chr(13), '', $buffer); // Microsoft Stupidity Suppression
|
||||
$this->menuStructure .= $buffer;
|
||||
}
|
||||
fclose($fd);
|
||||
if ($this->menuStructure == '') {
|
||||
$this->error("setMenuStructureFile: $tree_file is empty.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method to set the menu structure passing it through a string
|
||||
* @access public
|
||||
* @param string $tree_string the menu structure string
|
||||
* @return boolean
|
||||
*/
|
||||
function setMenuStructureString($tree_string)
|
||||
{
|
||||
$this->menuStructure = ereg_replace(chr(13), '', $tree_string); // Microsoft Stupidity Suppression
|
||||
if ($this->menuStructure == '') {
|
||||
$this->error('setMenuStructureString: empty string.');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method to set the value of separator
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function setSeparator($separator)
|
||||
{
|
||||
$this->separator = $separator;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method to set parameters for the DB connection
|
||||
* @access public
|
||||
* @param string $dns Data Source Name: the connection string for PEAR DB
|
||||
* @param bool $persistent DB connections are either persistent or not persistent
|
||||
* @return boolean
|
||||
*/
|
||||
function setDBConnParms($dsn, $persistent=false)
|
||||
{
|
||||
if (!is_string($dsn)) {
|
||||
$this->error('initdb: $dsn is not an string.');
|
||||
return false;
|
||||
}
|
||||
if (!is_bool($persistent)) {
|
||||
$this->error('initdb: $persistent is not a boolean.');
|
||||
return false;
|
||||
}
|
||||
$this->dsn = $dsn;
|
||||
$this->persistent = $persistent;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method to set the name of the table storing data describing the menu
|
||||
* @access public
|
||||
* @param string
|
||||
* @return boolean
|
||||
*/
|
||||
function setTableName($tableName)
|
||||
{
|
||||
if (!is_string($tableName)) {
|
||||
$this->error('setTableName: $tableName is not a string.');
|
||||
return false;
|
||||
}
|
||||
$this->tableName = $tableName;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method to set the name of the i18n table corresponding to $tableName
|
||||
* @access public
|
||||
* @param string
|
||||
* @return boolean
|
||||
*/
|
||||
function setTableName_i18n($tableName_i18n)
|
||||
{
|
||||
if (!is_string($tableName_i18n)) {
|
||||
$this->error('setTableName_i18n: $tableName_i18n is not a string.');
|
||||
return false;
|
||||
}
|
||||
$this->tableName_i18n = $tableName_i18n;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method to set names of fields of the table storing data describing the menu
|
||||
* @access public
|
||||
* @param array
|
||||
* @return boolean
|
||||
*/
|
||||
function setTableFields($tableFields)
|
||||
{
|
||||
if (!is_array($tableFields)) {
|
||||
$this->error('setTableFields: $tableFields is not an array.');
|
||||
return false;
|
||||
}
|
||||
if (count($tableFields) == 0) {
|
||||
$this->error('setTableFields: $tableFields is a zero-length array.');
|
||||
return false;
|
||||
}
|
||||
reset ($tableFields);
|
||||
while (list($key, $value) = each($tableFields)) {
|
||||
$this->tableFields[$key] = ($value == '') ? "''" : $value;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method to set names of fields of the i18n table corresponding to $tableName
|
||||
* @access public
|
||||
* @param array
|
||||
* @return boolean
|
||||
*/
|
||||
function setTableFields_i18n($tableFields_i18n)
|
||||
{
|
||||
if (!is_array($tableFields_i18n)) {
|
||||
$this->error('setTableFields_i18n: $tableFields_i18n is not an array.');
|
||||
return false;
|
||||
}
|
||||
if (count($tableFields_i18n) == 0) {
|
||||
$this->error('setTableFields_i18n: $tableFields_i18n is a zero-length array.');
|
||||
return false;
|
||||
}
|
||||
reset ($tableFields_i18n);
|
||||
while (list($key, $value) = each($tableFields_i18n)) {
|
||||
$this->tableFields_i18n[$key] = ($value == '') ? "''" : $value;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method to parse the current menu structure and correspondingly update related variables
|
||||
* @access public
|
||||
* @param string $menu_name the name to be attributed to the menu
|
||||
* whose structure has to be parsed
|
||||
* @return void
|
||||
*/
|
||||
function parseStructureForMenu(
|
||||
$menu_name = '' // non consistent default...
|
||||
)
|
||||
{
|
||||
$this->_maxLevel[$menu_name] = 0;
|
||||
$this->_firstLevelCnt[$menu_name] = 0;
|
||||
$this->_firstItem[$menu_name] = $this->_nodesCount + 1;
|
||||
$cnt = $this->_firstItem[$menu_name];
|
||||
$menuStructure = $this->menuStructure;
|
||||
|
||||
/* *********************************************** */
|
||||
/* Partially based on a piece of code taken from */
|
||||
/* TreeMenu 1.1 - Bjorge Dijkstra (bjorge@gmx.net) */
|
||||
/* *********************************************** */
|
||||
|
||||
while ($menuStructure != '') {
|
||||
$before_cr = strcspn($menuStructure, "\n");
|
||||
$buffer = substr($menuStructure, 0, $before_cr);
|
||||
$menuStructure = substr($menuStructure, $before_cr+1);
|
||||
if (substr($buffer, 0, 1) == '#') {
|
||||
continue; // commented item line...
|
||||
}
|
||||
$tmp = rtrim($buffer);
|
||||
$node = explode($this->separator, $tmp);
|
||||
for ($i=count($node); $i<=7; $i++) {
|
||||
$node[$i] = '';
|
||||
}
|
||||
$this->tree[$cnt]['level'] = strlen($node[0]);
|
||||
$this->tree[$cnt]['text'] = $node[1];
|
||||
$this->tree[$cnt]['href'] = $node[2];
|
||||
$this->tree[$cnt]['title'] = $node[3];
|
||||
$this->tree[$cnt]['icon'] = $node[4];
|
||||
$this->tree[$cnt]['target'] = $node[5];
|
||||
$this->tree[$cnt]['expanded'] = $node[6];
|
||||
$this->tree[$cnt]['children'] = $node[7];
|
||||
$cnt++;
|
||||
}
|
||||
|
||||
/* *********************************************** */
|
||||
|
||||
$this->_lastItem[$menu_name] = count($this->tree);
|
||||
$this->_nodesCount = $this->_lastItem[$menu_name];
|
||||
$this->tree[$this->_lastItem[$menu_name]+1]['level'] = 0;
|
||||
$this->_postParse($menu_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* The method to parse the current menu table and correspondingly update related variables
|
||||
* @access public
|
||||
* @param string $menu_name the name to be attributed to the menu
|
||||
* whose structure has to be parsed
|
||||
* @param string $language i18n language; either omit it or pass
|
||||
* an empty string ('') if you do not want to use any i18n table
|
||||
* @return void
|
||||
*/
|
||||
function scanTableForMenu(
|
||||
$menu_name = '', // non consistent default...
|
||||
$language = ''
|
||||
)
|
||||
{
|
||||
$this->_maxLevel[$menu_name] = 0;
|
||||
$this->_firstLevelCnt[$menu_name] = 0;
|
||||
unset($this->tree[$this->_nodesCount+1]);
|
||||
$this->_firstItem[$menu_name] = $this->_nodesCount + 1;
|
||||
/* BEGIN BENCHMARK CODE
|
||||
$time_start = $this->_getmicrotime();
|
||||
/* END BENCHMARK CODE */
|
||||
$db = DB::connect($this->dsn, $this->persistent);
|
||||
if (DB::isError($db)) {
|
||||
$this->error('scanTableForMenu: ' . $db->getMessage());
|
||||
}
|
||||
$dbresult = $db->query('
|
||||
SELECT ' .
|
||||
$this->tableFields['id'] . ' AS id, ' .
|
||||
$this->tableFields['parent_id'] . ' AS parent_id, ' .
|
||||
$this->tableFields['text'] . ' AS text, ' .
|
||||
$this->tableFields['href'] . ' AS href, ' .
|
||||
$this->tableFields['title'] . ' AS title, ' .
|
||||
$this->tableFields['icon'] . ' AS icon, ' .
|
||||
$this->tableFields['target'] . ' AS target, ' .
|
||||
$this->tableFields['expanded'] . ' AS expanded
|
||||
FROM ' . $this->tableName . '
|
||||
WHERE ' . $this->tableFields['id'] . ' <> 1
|
||||
ORDER BY ' . $this->tableFields['orderfield'] . ', ' . $this->tableFields['text'] . ' ASC
|
||||
');
|
||||
$this->_tmpArray = array();
|
||||
while ($dbresult->fetchInto($row, DB_FETCHMODE_ASSOC)) {
|
||||
$this->_tmpArray[$row['id']]['parent_id'] = $row['parent_id'];
|
||||
$this->_tmpArray[$row['id']]['text'] = $row['text'];
|
||||
$this->_tmpArray[$row['id']]['href'] = $row['href'];
|
||||
$this->_tmpArray[$row['id']]['title'] = $row['title'];
|
||||
$this->_tmpArray[$row['id']]['icon'] = $row['icon'];
|
||||
$this->_tmpArray[$row['id']]['target'] = $row['target'];
|
||||
$this->_tmpArray[$row['id']]['expanded'] = $row['expanded'];
|
||||
}
|
||||
if ($language != '') {
|
||||
$dbresult = $db->query('
|
||||
SELECT ' .
|
||||
$this->tableFields_i18n['id'] . ' AS id, ' .
|
||||
$this->tableFields_i18n['text'] . ' AS text, ' .
|
||||
$this->tableFields_i18n['title'] . ' AS title
|
||||
FROM ' . $this->tableName_i18n . '
|
||||
WHERE ' . $this->tableFields_i18n['id'] . ' <> 1
|
||||
AND ' . $this->tableFields_i18n['language'] . ' = ' . "'$language'" . '
|
||||
');
|
||||
while ($dbresult->fetchInto($row, DB_FETCHMODE_ASSOC)) {
|
||||
if (isset($this->_tmpArray[$row['id']])) {
|
||||
$this->_tmpArray[$row['id']]['text'] = $row['text'];
|
||||
$this->_tmpArray[$row['id']]['title'] = $row['title'];
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($dbresult);
|
||||
unset($row);
|
||||
$this->_depthFirstSearch($menu_name, $this->_tmpArray, 1, 1);
|
||||
/* BEGIN BENCHMARK CODE
|
||||
$time_end = $this->_getmicrotime();
|
||||
$time = $time_end - $time_start;
|
||||
print "TIME ELAPSED = $time\n<br>";
|
||||
/* END BENCHMARK CODE */
|
||||
$this->_lastItem[$menu_name] = count($this->tree);
|
||||
$this->_nodesCount = $this->_lastItem[$menu_name];
|
||||
$this->tree[$this->_lastItem[$menu_name]+1]['level'] = 0;
|
||||
$this->_postParse($menu_name);
|
||||
}
|
||||
|
||||
function _getmicrotime()
|
||||
{
|
||||
list($usec, $sec) = explode(' ', microtime());
|
||||
return ((float) $usec + (float) $sec);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursive method to perform the depth-first search of the tree data taken from the current menu table
|
||||
* @access private
|
||||
* @param string $menu_name the name to be attributed to the menu
|
||||
* whose structure has to be parsed
|
||||
* @param array $tmpArray the temporary array that stores data to perform
|
||||
* the depth-first search
|
||||
* @param integer $parent_id id of the item whose children have
|
||||
* to be searched for
|
||||
* @param integer $level the hierarchical level of children to be searched for
|
||||
* @return void
|
||||
*/
|
||||
function _depthFirstSearch($menu_name, $tmpArray, $parent_id=1, $level=1)
|
||||
{
|
||||
reset ($tmpArray);
|
||||
while (list($id, $foobar) = each($tmpArray)) {
|
||||
if ($foobar['parent_id'] == $parent_id) {
|
||||
unset($tmpArray[$id]);
|
||||
unset($this->_tmpArray[$id]);
|
||||
$cnt = count($this->tree) + 1;
|
||||
$this->tree[$cnt]['level'] = $level;
|
||||
$this->tree[$cnt]['text'] = $foobar['text'];
|
||||
$this->tree[$cnt]['href'] = $foobar['href'];
|
||||
$this->tree[$cnt]['title'] = $foobar['title'];
|
||||
$this->tree[$cnt]['icon'] = $foobar['icon'];
|
||||
$this->tree[$cnt]['target'] = $foobar['target'];
|
||||
$this->tree[$cnt]['expanded'] = $foobar['expanded'];
|
||||
$this->tree[$cnt]['children'] = $foobar['children'];
|
||||
$this->treecnt[$menu_name][$id] = $cnt;
|
||||
unset($foobar);
|
||||
if ($id != $parent_id) {
|
||||
$this->_depthFirstSearch($menu_name, $this->_tmpArray, $id, $level+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A method providing parsing needed after both file/string parsing and DB table parsing
|
||||
* @access private
|
||||
* @param string $menu_name the name of the menu for which the parsing
|
||||
* has to be performed
|
||||
* @return void
|
||||
*/
|
||||
function _postParse(
|
||||
$menu_name = '' // non consistent default...
|
||||
)
|
||||
{
|
||||
for ($cnt=$this->_firstItem[$menu_name]; $cnt<=$this->_lastItem[$menu_name]; $cnt++) { // this counter scans all nodes of the new menu
|
||||
$this->tree[$cnt]['child_of_root_node'] = ($this->tree[$cnt]['level'] == 1);
|
||||
$this->tree[$cnt]['parsed_text'] = stripslashes($this->tree[$cnt]['text']);
|
||||
$this->tree[$cnt]['parsed_href'] = (ereg_replace(' ', '', $this->tree[$cnt]['href']) == '') ? '#' : $this->prependedUrl . $this->tree[$cnt]['href'];
|
||||
$this->tree[$cnt]['parsed_title'] = ($this->tree[$cnt]['title'] == '') ? '' : ' title="' . stripslashes($this->tree[$cnt]['title']) . '"';
|
||||
$fooimg = $this->icondir . $this->tree[$cnt]['icon'];
|
||||
if ($this->tree[$cnt]['icon'] != '' && (substr($this->tree[$cnt]['icon'], 0, 7) == 'http://' || substr($this->tree[$cnt]['icon'], 0, 8) == 'https://')) {
|
||||
$this->tree[$cnt]['parsed_icon'] = $this->tree[$cnt]['icon'];
|
||||
if ($this->issetIconsize) {
|
||||
$this->tree[$cnt]['iconwidth'] = $this->iconsize['width'];
|
||||
$this->tree[$cnt]['iconheight'] = $this->iconsize['height'];
|
||||
} else {
|
||||
$foobar = getimagesize($this->tree[$cnt]['icon']);
|
||||
$this->tree[$cnt]['iconwidth'] = $foobar[0];
|
||||
$this->tree[$cnt]['iconheight'] = $foobar[1];
|
||||
}
|
||||
} elseif ($this->tree[$cnt]['icon'] != '' && file_exists($fooimg)) {
|
||||
$this->tree[$cnt]['parsed_icon'] = $this->iconwww . $this->tree[$cnt]['icon'];
|
||||
if ($this->issetIconsize) {
|
||||
$this->tree[$cnt]['iconwidth'] = $this->iconsize['width'];
|
||||
$this->tree[$cnt]['iconheight'] = $this->iconsize['height'];
|
||||
} else {
|
||||
$foobar = getimagesize($fooimg);
|
||||
$this->tree[$cnt]['iconwidth'] = $foobar[0];
|
||||
$this->tree[$cnt]['iconheight'] = $foobar[1];
|
||||
}
|
||||
} else {
|
||||
$this->tree[$cnt]['parsed_icon'] = '';
|
||||
}
|
||||
$this->tree[$cnt]['parsed_target'] = ($this->tree[$cnt]['target'] == '') ? '' : ' target="' . $this->tree[$cnt]['target'] . '"';
|
||||
// $this->tree[$cnt]['expanded'] = ($this->tree[$cnt]['expanded'] == '') ? 0 : $this->tree[$cnt]['expanded'];
|
||||
$this->_maxLevel[$menu_name] = max($this->_maxLevel[$menu_name], $this->tree[$cnt]['level']);
|
||||
if ($this->tree[$cnt]['level'] == 1) {
|
||||
$this->_firstLevelCnt[$menu_name]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A method to replace strings in all URLs (hrefs) of a menu
|
||||
* @access public
|
||||
* @param string $menu_name the name of the menu for which the replacement
|
||||
* has to be performed
|
||||
* @param string $string the string to be replaced
|
||||
* @param string $value the replacement string
|
||||
* @return void
|
||||
*/
|
||||
function replaceStringInUrls($menu_name, $string, $value)
|
||||
{
|
||||
for ($cnt=$this->_firstItem[$menu_name]; $cnt<=$this->_lastItem[$menu_name]; $cnt++) { // this counter scans all nodes of the new menu
|
||||
$this->tree[$cnt]['parsed_href'] = str_replace($string, $value, $this->tree[$cnt]['parsed_href']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A method to set the same target for all links of a menu
|
||||
* @access public
|
||||
* @param string $menu_name the name of the menu for which the targets
|
||||
* have to be set
|
||||
* @param string $target the target to be set for all links
|
||||
* of the $menu_name menu
|
||||
* @return void
|
||||
*/
|
||||
function setLinksTargets($menu_name, $target)
|
||||
{
|
||||
for ($cnt=$this->_firstItem[$menu_name]; $cnt<=$this->_lastItem[$menu_name]; $cnt++) { // this counter scans all nodes of the new menu
|
||||
$this->tree[$cnt]['parsed_target'] = ' target="' . $target . '"';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A method to select the current item of $menu_name in terms of $cnt, i.e., very likely, in terms of its line number in the corresponding menu structure file (excluding from the count commented out lines, if any)
|
||||
* @access public
|
||||
* @param string $menu_name the name of the menu for which the current item
|
||||
* has to be selected
|
||||
* @param integer $count the line number of the current item
|
||||
* in the corresponding menu structure file
|
||||
* (excluding from the count commented out lines, if any)
|
||||
* @return void
|
||||
*/
|
||||
function setSelectedItemByCount($menu_name, $count)
|
||||
{
|
||||
if ($count < 1) {
|
||||
$this->error("setSelectedItemByCount: the \$count argument is $count, but \$count can not be lower than 1");
|
||||
return;
|
||||
}
|
||||
if ($count > $this->_lastItem[$menu_name] - $this->_firstItem[$menu_name] + 1) {
|
||||
$this->error("setSelectedItemByCount: the \$count argument is $count and is larger than the number of items of the '$menu_name' menu");
|
||||
return;
|
||||
}
|
||||
$cnt = $this->_firstItem[$menu_name] + $count - 1;
|
||||
$this->tree[$cnt]['selected'] = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* A method to select the current item of $menu_name in terms of the corresponding id (see the DB table structure); obviously, this method can be used only together with the DB support
|
||||
* @access public
|
||||
* @param string $menu_name the name of the menu for which the current item
|
||||
* has to be selected
|
||||
* @param integer $id the id of the current item in the corresponding DB table
|
||||
* @return void
|
||||
*/
|
||||
function setSelectedItemById($menu_name, $id)
|
||||
{
|
||||
if (!isset($this->treecnt[$menu_name][$id])) {
|
||||
$this->error("setSelectedItemById: there is not any item with \$id = $id in the '$menu_name' menu");
|
||||
return;
|
||||
}
|
||||
$cnt = $this->treecnt[$menu_name][$id];
|
||||
$this->tree[$cnt]['selected'] = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* A method to select the current item of $menu_name specifying a string that occurs in the current URL
|
||||
* @access public
|
||||
* @param string $menu_name the name of the menu for which the current item
|
||||
* has to be selected
|
||||
* @param string $url a string that occurs in the current URL
|
||||
* @return void
|
||||
*/
|
||||
function setSelectedItemByUrl($menu_name, $url)
|
||||
{
|
||||
for ($cnt=$this->_firstItem[$menu_name]; $cnt<=$this->_lastItem[$menu_name]; $cnt++) { // this counter scans all nodes of the new menu
|
||||
if (!(strpos($this->tree[$cnt]['parsed_href'], $url) === false)) {
|
||||
$this->tree[$cnt]['selected'] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A method to select the current item of $menu_name specifying a regular expression that matches (a substring of) the current URL; just the same as the setSelectedItemByUrl() method, but using eregi() instead of strpos()
|
||||
* @access public
|
||||
* @param string $menu_name the name of the menu for which the current item
|
||||
* has to be selected
|
||||
* @param string $url_eregi the regular expression that matches
|
||||
* (a substring of) the current URL
|
||||
* @return void
|
||||
*/
|
||||
function setSelectedItemByUrlEregi($menu_name, $url_eregi)
|
||||
{
|
||||
for ($cnt=$this->_firstItem[$menu_name]; $cnt<=$this->_lastItem[$menu_name]; $cnt++) { // this counter scans all nodes of the new menu
|
||||
if (eregi($url_eregi, $this->tree[$cnt]['parsed_href'])) {
|
||||
$this->tree[$cnt]['selected'] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to handle errors
|
||||
* @access private
|
||||
* @param string $errormsg the error message
|
||||
* @return void
|
||||
*/
|
||||
function error($errormsg)
|
||||
{
|
||||
print "<b>LayersMenu Error:</b> $errormsg<br />\n";
|
||||
if ($this->haltOnError == 'yes') {
|
||||
die("<b>Halted.</b><br />\n");
|
||||
}
|
||||
}
|
||||
|
||||
} /* END OF CLASS */
|
||||
|
||||
?>
|
@@ -1,398 +0,0 @@
|
||||
<?php
|
||||
// PHP Layers Menu 3.2.0-rc (C) 2001-2004 Marco Pratesi - http://www.marcopratesi.it/
|
||||
|
||||
/**
|
||||
* This file contains the code of the TreeMenu class.
|
||||
* @package PHPLayersMenu
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is the TreeMenu class of the PHP Layers Menu library.
|
||||
*
|
||||
* This class depends on the LayersMenuCommon class and on the PEAR conforming version of the PHPLib Template class, i.e. on HTML_Template_PHPLIB
|
||||
*
|
||||
* @version 3.2.0-rc
|
||||
* @package PHPLayersMenu
|
||||
*/
|
||||
class TreeMenu extends LayersMenuCommon
|
||||
{
|
||||
|
||||
/**
|
||||
* Type of images used for the Tree Menu
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
public $treeMenuImagesType;
|
||||
/**
|
||||
* Prefix for filenames of images of a theme
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
public $treeMenuTheme;
|
||||
/**
|
||||
* An array where we store the Tree Menu code for each menu
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
public $_treeMenu;
|
||||
|
||||
/**
|
||||
* The constructor method; it initializates the menu system
|
||||
* @return void
|
||||
*/
|
||||
function TreeMenu()
|
||||
{
|
||||
$this->LayersMenuCommon();
|
||||
|
||||
$this->treeMenuImagesType = 'png';
|
||||
$this->treeMenuTheme = '';
|
||||
$this->_treeMenu = array();
|
||||
|
||||
$this->_nodesCount = 0;
|
||||
$this->tree = array();
|
||||
$this->_maxLevel = array();
|
||||
$this->_firstLevelCnt = array();
|
||||
$this->_firstItem = array();
|
||||
$this->_lastItem = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* The method to set the dirroot directory
|
||||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
function setDirroot($dirroot)
|
||||
{
|
||||
return $this->setDirrootCommon($dirroot);
|
||||
}
|
||||
|
||||
/**
|
||||
* The method to set the type of images used for the Tree Menu
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function setTreeMenuImagesType($treeMenuImagesType)
|
||||
{
|
||||
$this->treeMenuImagesType = $treeMenuImagesType;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method to set the prefix for filenames of images of a theme
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function setTreeMenuTheme($treeMenuTheme)
|
||||
{
|
||||
$this->treeMenuTheme = $treeMenuTheme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to prepare a new Tree Menu.
|
||||
*
|
||||
* This method processes items of a menu to prepare and return
|
||||
* the corresponding Tree Menu code.
|
||||
*
|
||||
* @access public
|
||||
* @param string $menu_name the name of the menu whose items have to be processed
|
||||
* @return string
|
||||
*/
|
||||
function newTreeMenu(
|
||||
$menu_name = '' // non consistent default...
|
||||
)
|
||||
{
|
||||
|
||||
/* If cookies were disabled, build the url parameter for the session id.
|
||||
It will be append to the url to be redirect */
|
||||
$id_session_param = '';
|
||||
if (SID != '')
|
||||
$id_session_param = sprintf('&%s=%s',session_name(),session_id());
|
||||
global $ldapserver;
|
||||
|
||||
if (!isset($this->_firstItem[$menu_name]) || !isset($this->_lastItem[$menu_name])) {
|
||||
$this->error("newTreeMenu: the first/last item of the menu '$menu_name' is not defined; please check if you have parsed its menu data.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
$this->_treeMenu[$menu_name] = '';
|
||||
|
||||
$img_collapse = $this->imgwww . $this->treeMenuTheme . 'tree_collapse.' . $this->treeMenuImagesType;
|
||||
$alt_collapse = '--';
|
||||
$img_collapse_corner = $this->imgwww . $this->treeMenuTheme . 'tree_collapse_corner.' . $this->treeMenuImagesType;
|
||||
$alt_collapse_corner = '--';
|
||||
$img_collapse_corner_first = $this->imgwww . $this->treeMenuTheme . 'tree_collapse_corner_first.' . $this->treeMenuImagesType;
|
||||
$alt_collapse_corner_first = '--';
|
||||
$img_collapse_first = $this->imgwww . $this->treeMenuTheme . 'tree_collapse_first.' . $this->treeMenuImagesType;
|
||||
$alt_collapse_first = '--';
|
||||
$img_corner = $this->imgwww . $this->treeMenuTheme . 'tree_corner.' . $this->treeMenuImagesType;
|
||||
$alt_corner = '`-';
|
||||
$img_expand = $this->imgwww . $this->treeMenuTheme . 'tree_expand.' . $this->treeMenuImagesType;
|
||||
$alt_expand = '+-';
|
||||
$img_expand_corner = $this->imgwww . $this->treeMenuTheme . 'tree_expand_corner.' . $this->treeMenuImagesType;
|
||||
$alt_expand_corner = '+-';
|
||||
$img_expand_corner_first = $this->imgwww . $this->treeMenuTheme . 'tree_expand_corner_first.' . $this->treeMenuImagesType;
|
||||
$alt_expand_corner_first = '+-';
|
||||
$img_expand_first = $this->imgwww . $this->treeMenuTheme . 'tree_expand_first.' . $this->treeMenuImagesType;
|
||||
$alt_expand_first = '+-';
|
||||
$img_folder_closed = $this->imgwww . $this->treeMenuTheme . 'tree_folder_closed.' . $this->treeMenuImagesType;
|
||||
$alt_folder_closed = '->';
|
||||
$img_folder_open = $this->imgwww . $this->treeMenuTheme . 'tree_folder_open.' . $this->treeMenuImagesType;
|
||||
$alt_folder_open = '->';
|
||||
$img_leaf = $this->imgwww . $this->treeMenuTheme . 'tree_leaf.' . $this->treeMenuImagesType;
|
||||
$alt_leaf = '->';
|
||||
$img_space = $this->imgwww . $this->treeMenuTheme . 'tree_space.' . $this->treeMenuImagesType;
|
||||
$alt_space = ' ';
|
||||
$img_split = $this->imgwww . $this->treeMenuTheme . 'tree_split.' . $this->treeMenuImagesType;
|
||||
$alt_split = '|-';
|
||||
$img_split_first = $this->imgwww . $this->treeMenuTheme . 'tree_split_first.' . $this->treeMenuImagesType;
|
||||
$alt_split_first = '|-';
|
||||
$img_vertline = $this->imgwww . $this->treeMenuTheme . 'tree_vertline.' . $this->treeMenuImagesType;
|
||||
$alt_vertline = '| ';
|
||||
|
||||
for ($i=0; $i<=$this->_maxLevel[$menu_name]; $i++) {
|
||||
$levels[$i] = 0;
|
||||
}
|
||||
|
||||
// Find last nodes of subtrees
|
||||
$last_level = $this->_maxLevel[$menu_name];
|
||||
for ($i=$this->_lastItem[$menu_name]; $i>=$this->_firstItem[$menu_name]; $i--) {
|
||||
if ($this->tree[$i]['level'] < $last_level) {
|
||||
for ($j=$this->tree[$i]['level']+1; $j<=$this->_maxLevel[$menu_name]; $j++) {
|
||||
$levels[$j] = 0;
|
||||
}
|
||||
}
|
||||
if ($levels[$this->tree[$i]['level']] == 0) {
|
||||
$levels[$this->tree[$i]['level']] = 1;
|
||||
$this->tree[$i]['last_item'] = 1;
|
||||
} else {
|
||||
$this->tree[$i]['last_item'] = 0;
|
||||
}
|
||||
$last_level = $this->tree[$i]['level'];
|
||||
}
|
||||
|
||||
$toggle = '';
|
||||
$toggle_function_name = 'toggle' . $menu_name;
|
||||
|
||||
for ($cnt=$this->_firstItem[$menu_name]; $cnt<=$this->_lastItem[$menu_name]; $cnt++) {
|
||||
if ($this->tree[$cnt]['text'] == '---') {
|
||||
continue; // separators are significant only for layers-based menus
|
||||
}
|
||||
|
||||
if (isset($this->tree[$cnt]['selected']) && $this->tree[$cnt]['selected']) {
|
||||
$linkstyle = 'phplmselected';
|
||||
} else {
|
||||
$linkstyle = 'phplm';
|
||||
}
|
||||
|
||||
$this->_treeMenu[$menu_name] .= '<div id="jt' . $cnt . '" class="treemenudiv">' . "\n";
|
||||
|
||||
// vertical lines from higher levels
|
||||
for ($i=0; $i<$this->tree[$cnt]['level']-1; $i++) {
|
||||
if ($levels[$i] == 1) {
|
||||
$img = $img_vertline;
|
||||
$alt = $alt_vertline;
|
||||
} else {
|
||||
$img = $img_space;
|
||||
$alt = $alt_space;
|
||||
}
|
||||
$this->_treeMenu[$menu_name] .= '<img align="top" border="0" class="imgs" src="' . $img . '" alt="' . $alt . '" />';
|
||||
}
|
||||
|
||||
$not_a_leaf = ($cnt<$this->_lastItem[$menu_name] && $this->tree[$cnt+1]['level']>$this->tree[$cnt]['level']) || (isset($this->tree[$cnt]['children']) && $this->tree[$cnt]['children']);
|
||||
|
||||
if ($this->tree[$cnt]['last_item'] == 1) {
|
||||
// corner at end of subtree or t-split
|
||||
if ($not_a_leaf) {
|
||||
if ($cnt == $this->_firstItem[$menu_name]) {
|
||||
if ($this->tree[$cnt]['last_item'] && $this->tree[$cnt]['children']) {
|
||||
// Xavier Bruyet : 2006.09.28
|
||||
// Display for the first time the tree without the root node expanded
|
||||
$img = $img_expand_corner_first;
|
||||
$alt = $alt_expand_corner_first;
|
||||
// @todo: nasty hack, should really do this better.
|
||||
$parsed_href = preg_replace('/template_engine/','expand',$this->tree[$cnt]['parsed_href']);
|
||||
$this->_treeMenu[$menu_name] .= '<a href="' . $parsed_href . '"><img align="top" border="0" class="imgs" id="jt' . $cnt . 'node" src="' . $img . '" alt="' . $alt . '" /></a>';
|
||||
} else {
|
||||
$img = $img_collapse_corner_first;
|
||||
$alt = $alt_collapse_corner_first;
|
||||
$this->_treeMenu[$menu_name] .= '<a onmousedown="' . $toggle_function_name . "('" . $cnt . "')" . '"><img align="top" border="0" class="imgs" id="jt' . $cnt . 'node" src="' . $img . '" alt="' . $alt . '" /></a>';
|
||||
}
|
||||
} else {
|
||||
if ($this->tree[$cnt]['last_item'] && $this->tree[$cnt]['children']) {
|
||||
$img = $img_expand_corner;
|
||||
$alt = $alt_expand_corner;
|
||||
// @todo: nasty hack, should really do this better.
|
||||
$parsed_href = preg_replace('/template_engine/','expand',$this->tree[$cnt]['parsed_href']);
|
||||
$this->_treeMenu[$menu_name] .= '<a href="' . $parsed_href . '"><img align="top" border="0" class="imgs" id="jt' . $cnt . 'node" src="' . $img . '" alt="' . $alt . '" /></a>';
|
||||
} else {
|
||||
$img = $img_collapse_corner;
|
||||
$alt = $alt_collapse_corner;
|
||||
$this->_treeMenu[$menu_name] .= '<a onmousedown="' . $toggle_function_name . "('" . $cnt . "')" . '"><img align="top" border="0" class="imgs" id="jt' . $cnt . 'node" src="' . $img . '" alt="' . $alt . '" /></a>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->_treeMenu[$menu_name] .= '<img align="top" border="0" class="imgs" src="' . $img_corner . '" alt="' . $alt_corner . '" />';
|
||||
}
|
||||
$levels[$this->tree[$cnt]['level']-1] = 0;
|
||||
} else {
|
||||
if ($not_a_leaf) {
|
||||
if ($cnt == $this->_firstItem[$menu_name]) {
|
||||
$img = $img_collapse_first;
|
||||
$alt = $alt_collapse_first;
|
||||
|
||||
$this->_treeMenu[$menu_name] .= '<a onmousedown="' . $toggle_function_name . "('" . $cnt . "');" . '"><img align="top" border="0" class="imgs" id="jt' . $cnt . 'node" src="' . $img . '" alt="' . $alt . '" /></a>';
|
||||
} else {
|
||||
if (! $this->tree[$cnt]['last_item'] && $this->tree[$cnt]['children']) {
|
||||
$img = $img_expand;
|
||||
$alt = $alt_expand;
|
||||
// @todo: nasty hack, should really do this better.
|
||||
$parsed_href = preg_replace('/template_engine/','expand',$this->tree[$cnt]['parsed_href']);
|
||||
|
||||
$this->_treeMenu[$menu_name] .= '<a href="' . $parsed_href . '"><img align="top" border="0" class="imgs" id="jt' . $cnt . 'node" src="' . $img . '" alt="' . $alt . '" /></a>';
|
||||
} else {
|
||||
$img = $img_collapse;
|
||||
$alt = $alt_collapse;
|
||||
|
||||
$this->_treeMenu[$menu_name] .= '<a onmousedown="' . $toggle_function_name . "('" . $cnt . "');" . '"><img align="top" border="0" class="imgs" id="jt' . $cnt . 'node" src="' . $img . '" alt="' . $alt . '" /></a>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($cnt == $this->_firstItem[$menu_name]) {
|
||||
$img = $img_split_first;
|
||||
$alt = $alt_split_first;
|
||||
} else {
|
||||
$img = $img_split;
|
||||
$alt = $alt_split;
|
||||
}
|
||||
$this->_treeMenu[$menu_name] .= '<img align="top" border="0" class="imgs" id="jt' . $cnt . 'node" src="' . $img . '" alt="' . $alt . '" />';
|
||||
}
|
||||
$levels[$this->tree[$cnt]['level']-1] = 1;
|
||||
}
|
||||
|
||||
if ($this->tree[$cnt]['parsed_href'] == '' || $this->tree[$cnt]['parsed_href'] == '#') {
|
||||
$a_href_open_img = '';
|
||||
$a_href_close_img = '';
|
||||
$a_href_open = '<a class="phplmnormal">';
|
||||
$a_href_close = '</a>';
|
||||
} else {
|
||||
$a_href_open_img = '<a href="' . $this->tree[$cnt]['parsed_href'] . '"' . $this->tree[$cnt]['parsed_title'] . $this->tree[$cnt]['parsed_target'] . '>';
|
||||
$a_href_close_img = '</a>';
|
||||
$a_href_open = '<a name="' . sprintf('%s_%s%s',$ldapserver->server_id,rawurlencode($this->tree[$cnt]['title']),$id_session_param) . '" href="' . $this->tree[$cnt]['parsed_href'] . '"' . $this->tree[$cnt]['parsed_title'] . $this->tree[$cnt]['parsed_target'] . ' class="' . $linkstyle . '">';
|
||||
$a_href_close = '</a>';
|
||||
}
|
||||
|
||||
if ($not_a_leaf) {
|
||||
// $this->_treeMenu[$menu_name] .= $a_href_open_img . '<img align="top" border="0" class="imgs" id="jt' . $cnt . 'folder" src="' . $img_folder_open . '" alt="' . $alt_folder_open . '" />' . $a_href_close_img;
|
||||
$this->_treeMenu[$menu_name] .= $a_href_open_img . '<img align="top" border="0" class="imgs" id="jt' . $cnt . 'folder" src="' . ($this->tree[$cnt]['parsed_icon'] ? $this->tree[$cnt]['parsed_icon'] : $img_folder_open) . '" alt="' . $alt_folder_open . '" />' . $a_href_close_img;
|
||||
} else {
|
||||
if ($this->tree[$cnt]['parsed_icon'] != '') {
|
||||
// $this->_treeMenu[$menu_name] .= $a_href_open_img . '<img align="top" border="0" src="' . $this->tree[$cnt]['parsed_icon'] . '" width="' . $this->tree[$cnt]['iconwidth'] . '" height="' . $this->tree[$cnt]['iconheight'] . '" alt="' . $alt_leaf . '" />' . $a_href_close_img;
|
||||
$this->_treeMenu[$menu_name] .= $a_href_open_img . '<img align="top" border="0" src="' . $this->tree[$cnt]['parsed_icon'] . '" alt="' . $alt_leaf . '" />' . $a_href_close_img;
|
||||
} else {
|
||||
$this->_treeMenu[$menu_name] .= $a_href_open_img . '<img align="top" border="0" class="imgs" src="' . $img_leaf . '" alt="' . $alt_leaf . '" />' . $a_href_close_img;
|
||||
}
|
||||
}
|
||||
$this->_treeMenu[$menu_name] .= ' ' . $a_href_open . $this->tree[$cnt]['text'] . $a_href_close . "\n";
|
||||
$this->_treeMenu[$menu_name] .= '</div>' . "\n";
|
||||
|
||||
if ($cnt<$this->_lastItem[$menu_name] && $this->tree[$cnt]['level']<$this->tree[$cnt+1]['level']) {
|
||||
$this->_treeMenu[$menu_name] .= '<div id="jt' . $cnt . 'son" class="treemenudiv">' . "\n";
|
||||
if ($this->tree[$cnt]['expanded'] != 1) {
|
||||
$toggle .= 'if (phplm_expand[' . $cnt . '] != 1) ' . $toggle_function_name . "('" . $cnt . "');\n";
|
||||
} else {
|
||||
$toggle .= 'if (phplm_collapse[' . $cnt . '] == 1) ' . $toggle_function_name . "('" . $cnt . "');\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ($cnt>$this->_firstItem[$menu_name] && $this->tree[$cnt]['level']>$this->tree[$cnt+1]['level']) {
|
||||
for ($i=max(1, $this->tree[$cnt+1]['level']); $i<$this->tree[$cnt]['level']; $i++) {
|
||||
$this->_treeMenu[$menu_name] .= '</div>' . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
$this->_treeMenu[$menu_name] =
|
||||
'<div class="phplmnormal">' . "\n" .
|
||||
$this->_treeMenu[$menu_name] .
|
||||
'</div>' . "\n";
|
||||
*/
|
||||
// Some (old) browsers do not support the "white-space: nowrap;" CSS property...
|
||||
$this->_treeMenu[$menu_name] =
|
||||
'<table cellspacing="0" cellpadding="0" border="0">' . "\n" .
|
||||
'<tr>' . "\n" .
|
||||
'<td class="phplmnormal" nowrap="nowrap">' . "\n" .
|
||||
$this->_treeMenu[$menu_name] .
|
||||
'</td>' . "\n" .
|
||||
'</tr>' . "\n" .
|
||||
'</table>' . "\n";
|
||||
|
||||
$t = new Template_PHPLIB();
|
||||
$t->setFile('tplfile', $this->libjsdir . 'layerstreemenu.ijs');
|
||||
$t->setVar(array(
|
||||
'toggle_function_name' => $toggle_function_name,
|
||||
'img_collapse' => $img_collapse,
|
||||
'img_collapse_corner' => $img_collapse_corner,
|
||||
'img_collapse_corner_first' => $img_collapse_corner_first,
|
||||
'img_collapse_first' => $img_collapse_first,
|
||||
'img_expand' => $img_expand,
|
||||
'img_expand_corner' => $img_expand_corner,
|
||||
'img_expand_corner_first' => $img_expand_corner_first,
|
||||
'img_expand_first' => $img_expand_first,
|
||||
'img_folder_closed' => $img_folder_closed,
|
||||
'img_folder_open' => $img_folder_open
|
||||
));
|
||||
|
||||
$inc = '<!-- # PHP layers menu. -->
|
||||
<script type="text/javascript" language="javascript" src="js/phplayersmenu/libjs/layersmenu-browser_detection.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="js/phplayersmenu/libjs/layerstreemenu-cookies.js"></script>';
|
||||
|
||||
$toggle_function = $t->parse('out', 'tplfile');
|
||||
$toggle_function =
|
||||
'<script language="JavaScript" type="text/javascript">' . "\n" .
|
||||
'<!--' . "\n" .
|
||||
$toggle_function .
|
||||
'// -->' . "\n" .
|
||||
'</script>' . "\n";
|
||||
|
||||
$toggle =
|
||||
'<script language="JavaScript" type="text/javascript">' . "\n" .
|
||||
'<!--' . "\n" .
|
||||
'if ((DOM && !Opera56 && !Konqueror22) || IE4) {' . "\n" .
|
||||
$toggle .
|
||||
'}' . "\n" .
|
||||
'if (NS4) alert("Only the accessibility is provided to Netscape 4 on the JavaScript Tree Menu.\nWe *strongly* suggest you to upgrade your browser.");' . "\n" .
|
||||
'// -->' . "\n" .
|
||||
'</script>' . "\n";
|
||||
|
||||
$this->_treeMenu[$menu_name] = $inc . "\n" . $toggle_function . "\n" . $this->_treeMenu[$menu_name] . "\n" . $toggle;
|
||||
|
||||
return $this->_treeMenu[$menu_name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Method that returns the code of the requested Tree Menu
|
||||
* @access public
|
||||
* @param string $menu_name the name of the menu whose Tree Menu code
|
||||
* has to be returned
|
||||
* @return string
|
||||
*/
|
||||
function getTreeMenu($menu_name)
|
||||
{
|
||||
return $this->_treeMenu[$menu_name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Method that prints the code of the requested Tree Menu
|
||||
* @access public
|
||||
* @param string $menu_name the name of the menu whose Tree Menu code
|
||||
* has to be printed
|
||||
* @return void
|
||||
*/
|
||||
function printTreeMenu($menu_name)
|
||||
{
|
||||
print $this->_treeMenu[$menu_name];
|
||||
}
|
||||
|
||||
} /* END OF CLASS */
|
||||
|
||||
?>
|
@@ -1,33 +0,0 @@
|
||||
// PHP Layers Menu 3.2.0-rc (C) 2001-2004 Marco Pratesi - http://www.marcopratesi.it/
|
||||
|
||||
DOM = (document.getElementById) ? 1 : 0;
|
||||
NS4 = (document.layers) ? 1 : 0;
|
||||
// We need to explicitly detect Konqueror
|
||||
// because Konqueror 3 sets IE = 1 ... AAAAAAAAAARGHHH!!!
|
||||
Konqueror = (navigator.userAgent.indexOf('Konqueror') > -1) ? 1 : 0;
|
||||
// We need to detect Konqueror 2.2 as it does not handle the window.onresize event
|
||||
Konqueror22 = (navigator.userAgent.indexOf('Konqueror 2.2') > -1 || navigator.userAgent.indexOf('Konqueror/2.2') > -1) ? 1 : 0;
|
||||
Konqueror30 =
|
||||
(
|
||||
navigator.userAgent.indexOf('Konqueror 3.0') > -1
|
||||
|| navigator.userAgent.indexOf('Konqueror/3.0') > -1
|
||||
|| navigator.userAgent.indexOf('Konqueror 3;') > -1
|
||||
|| navigator.userAgent.indexOf('Konqueror/3;') > -1
|
||||
|| navigator.userAgent.indexOf('Konqueror 3)') > -1
|
||||
|| navigator.userAgent.indexOf('Konqueror/3)') > -1
|
||||
)
|
||||
? 1 : 0;
|
||||
Konqueror31 = (navigator.userAgent.indexOf('Konqueror 3.1') > -1 || navigator.userAgent.indexOf('Konqueror/3.1') > -1) ? 1 : 0;
|
||||
// We need to detect Konqueror 3.2 and 3.3 as they are affected by the see-through effect only for 2 form elements
|
||||
Konqueror32 = (navigator.userAgent.indexOf('Konqueror 3.2') > -1 || navigator.userAgent.indexOf('Konqueror/3.2') > -1) ? 1 : 0;
|
||||
Konqueror33 = (navigator.userAgent.indexOf('Konqueror 3.3') > -1 || navigator.userAgent.indexOf('Konqueror/3.3') > -1) ? 1 : 0;
|
||||
Opera = (navigator.userAgent.indexOf('Opera') > -1) ? 1 : 0;
|
||||
Opera5 = (navigator.userAgent.indexOf('Opera 5') > -1 || navigator.userAgent.indexOf('Opera/5') > -1) ? 1 : 0;
|
||||
Opera6 = (navigator.userAgent.indexOf('Opera 6') > -1 || navigator.userAgent.indexOf('Opera/6') > -1) ? 1 : 0;
|
||||
Opera56 = Opera5 || Opera6;
|
||||
IE = (navigator.userAgent.indexOf('MSIE') > -1) ? 1 : 0;
|
||||
IE = IE && !Opera;
|
||||
IE5 = IE && DOM;
|
||||
IE4 = (document.all) ? 1 : 0;
|
||||
IE4 = IE4 && IE && !DOM;
|
||||
|
@@ -1,70 +0,0 @@
|
||||
// PHP Layers Menu 3.2.0-rc (C) 2001-2004 Marco Pratesi - http://www.marcopratesi.it/
|
||||
|
||||
function setLMCookie(name, value)
|
||||
{
|
||||
document.cookie = name + '=' + value + ';path=/';
|
||||
}
|
||||
|
||||
function getLMCookie(name)
|
||||
{
|
||||
foobar = document.cookie.split(name + '=');
|
||||
if (foobar.length < 2) {
|
||||
return null;
|
||||
}
|
||||
tempString = foobar[1];
|
||||
if (tempString.indexOf(';') == -1) {
|
||||
return tempString;
|
||||
}
|
||||
yafoobar = tempString.split(';');
|
||||
return yafoobar[0];
|
||||
}
|
||||
|
||||
function parseExpandString()
|
||||
{
|
||||
expandString = getLMCookie('phplm_expand');
|
||||
phplm_expand = new Array();
|
||||
if (expandString) {
|
||||
expanded = expandString.split('|');
|
||||
for (i=0; i<expanded.length-1; i++) {
|
||||
phplm_expand[expanded[i]] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function parseCollapseString()
|
||||
{
|
||||
collapseString = getLMCookie('phplm_collapse');
|
||||
phplm_collapse = new Array();
|
||||
if (collapseString) {
|
||||
collapsed = collapseString.split('|');
|
||||
for (i=0; i<collapsed.length-1; i++) {
|
||||
phplm_collapse[collapsed[i]] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
parseExpandString();
|
||||
parseCollapseString();
|
||||
|
||||
function saveExpandString()
|
||||
{
|
||||
expandString = '';
|
||||
for (i=0; i<phplm_expand.length; i++) {
|
||||
if (phplm_expand[i] == 1) {
|
||||
expandString += i + '|';
|
||||
}
|
||||
}
|
||||
setLMCookie('phplm_expand', expandString);
|
||||
}
|
||||
|
||||
function saveCollapseString()
|
||||
{
|
||||
collapseString = '';
|
||||
for (i=0; i<phplm_collapse.length; i++) {
|
||||
if (phplm_collapse[i] == 1) {
|
||||
collapseString += i + '|';
|
||||
}
|
||||
}
|
||||
setLMCookie('phplm_collapse', collapseString);
|
||||
}
|
||||
|
@@ -1,52 +0,0 @@
|
||||
// PHP Layers Menu 3.2.0-rc (C) 2001-2004 Marco Pratesi - http://www.marcopratesi.it/
|
||||
|
||||
function {toggle_function_name}(nodeid)
|
||||
{
|
||||
if ((!DOM || Opera56 || Konqueror22) && !IE4) {
|
||||
return;
|
||||
}
|
||||
layersMoved = 0;
|
||||
parseExpandString();
|
||||
parseCollapseString();
|
||||
if (!IE4) {
|
||||
sonLayer = document.getElementById('jt' + nodeid + 'son');
|
||||
nodeLayer = document.getElementById('jt' + nodeid + 'node');
|
||||
//folderLayer = document.getElementById('jt' + nodeid + 'folder');
|
||||
} else {
|
||||
sonLayer = document.all('jt' + nodeid + 'son');
|
||||
nodeLayer = document.all('jt' + nodeid + 'node');
|
||||
//folderLayer = document.all('jt' + nodeid + 'folder');
|
||||
}
|
||||
if (sonLayer.style.display == 'none') {
|
||||
sonLayer.style.display = 'block';
|
||||
if (nodeLayer.src.indexOf('{img_expand}') > -1) {
|
||||
nodeLayer.src = '{img_collapse}';
|
||||
} else if (nodeLayer.src.indexOf('{img_expand_first}') > -1) {
|
||||
nodeLayer.src = '{img_collapse_first}';
|
||||
} else if (nodeLayer.src.indexOf('{img_expand_corner}') > -1) {
|
||||
nodeLayer.src = '{img_collapse_corner}';
|
||||
} else {
|
||||
nodeLayer.src = '{img_collapse_corner_first}';
|
||||
}
|
||||
//folderLayer.src = '{img_folder_open}';
|
||||
phplm_expand[nodeid] = 1;
|
||||
phplm_collapse[nodeid] = 0;
|
||||
} else {
|
||||
sonLayer.style.display = 'none';
|
||||
if (nodeLayer.src.indexOf('{img_collapse}') > -1) {
|
||||
nodeLayer.src = '{img_expand}';
|
||||
} else if (nodeLayer.src.indexOf('{img_collapse_first}') > -1) {
|
||||
nodeLayer.src = '{img_expand_first}';
|
||||
} else if (nodeLayer.src.indexOf('{img_collapse_corner}') > -1) {
|
||||
nodeLayer.src = '{img_expand_corner}';
|
||||
} else {
|
||||
nodeLayer.src = '{img_expand_corner_first}';
|
||||
}
|
||||
//folderLayer.src = '{img_folder_closed}';
|
||||
phplm_expand[nodeid] = 0;
|
||||
phplm_collapse[nodeid] = 1;
|
||||
}
|
||||
saveExpandString();
|
||||
saveCollapseString();
|
||||
}
|
||||
|
@@ -1,114 +0,0 @@
|
||||
/**
|
||||
* @package phpLDAPadmin
|
||||
* @author The phpLDAPadmin development team
|
||||
* @author Xavier Bruyet
|
||||
*/
|
||||
|
||||
// current request
|
||||
var http_div = '';
|
||||
var http_request = null;
|
||||
var http_request_success_callback = '';
|
||||
var http_request_error_callback = '';
|
||||
|
||||
// include html into a component
|
||||
function includeHTML(component, html) {
|
||||
if (typeof(component) != 'object' || typeof(html) != 'string') return;
|
||||
component.innerHTML = html;
|
||||
|
||||
var scripts = component.getElementsByTagName('script');
|
||||
if (!scripts) return;
|
||||
|
||||
// load scripts
|
||||
for (var i = 0; i < scripts.length; i++) {
|
||||
var scriptclone = document.createElement('script');
|
||||
if (scripts[i].attributes.length > 0) {
|
||||
for (var j in scripts[i].attributes) {
|
||||
if (typeof(scripts[i].attributes[j]) != 'undefined'
|
||||
&& typeof(scripts[i].attributes[j].nodeName) != 'undefined'
|
||||
&& scripts[i].attributes[j].nodeValue != null
|
||||
&& scripts[i].attributes[j].nodeValue != '') {
|
||||
scriptclone.setAttribute(scripts[i].attributes[j].nodeName, scripts[i].attributes[j].nodeValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
scriptclone.text = scripts[i].text;
|
||||
scripts[i].parentNode.replaceChild(scriptclone, scripts[i]);
|
||||
eval(scripts[i].innerHTML);
|
||||
}
|
||||
}
|
||||
|
||||
// callback function
|
||||
function alertHttpRequest() {
|
||||
if (http_request && (http_request.readyState == 4)) {
|
||||
if (http_request.status == 200 || http_request.status == 401) {
|
||||
response = http_request.responseText;
|
||||
http_request = null;
|
||||
//alert(response);
|
||||
if (http_request_success_callback) {
|
||||
eval(http_request_success_callback + '(response,http_div)');
|
||||
}
|
||||
} else {
|
||||
alert('There was a problem with the request.');
|
||||
cancelHttpRequest();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function cancelHttpRequest() {
|
||||
if (http_request) {
|
||||
http_request = null;
|
||||
if (http_request_error_callback) {
|
||||
eval(http_request_error_callback + '(http_div)');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// request
|
||||
function makeGETRequest(url,parameters,successCallbackFunctionName,errorCallbackFunctionName,div) {
|
||||
makeHttpRequest(url,parameters,'GET',successCallbackFunctionName,errorCallbackFunctionName,div);
|
||||
}
|
||||
|
||||
function makePOSTRequest(url,parameters,successCallbackFunctionName,errorCallbackFunctionName,div) {
|
||||
makeHttpRequest(url,parameters,'POST',successCallbackFunctionName,errorCallbackFunctionName,div);
|
||||
}
|
||||
|
||||
function makeHttpRequest(url,parameters,meth,successCallbackFunctionName,errorCallbackFunctionName,div) {
|
||||
cancelHttpRequest(div);
|
||||
|
||||
http_request_success_callback = successCallbackFunctionName;
|
||||
http_request_error_callback = errorCallbackFunctionName;
|
||||
http_div = div;
|
||||
|
||||
if (window.XMLHttpRequest) { // Mozilla, Safari,...
|
||||
http_request = new XMLHttpRequest();
|
||||
if (http_request.overrideMimeType) {
|
||||
http_request.overrideMimeType('text/html');
|
||||
}
|
||||
|
||||
} else if (window.ActiveXObject) { // IE
|
||||
try {
|
||||
http_request = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch (e) {
|
||||
try {
|
||||
http_request = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
|
||||
if (!http_request) {
|
||||
alert('Cannot create XMLHTTP instance.');
|
||||
return false;
|
||||
}
|
||||
|
||||
http_request.onreadystatechange = window['alertHttpRequest'];
|
||||
if (meth == 'GET') url = url + '?' + parameters;
|
||||
http_request.open(meth, url, true);
|
||||
|
||||
http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||
http_request.setRequestHeader("Content-length", parameters.length);
|
||||
http_request.setRequestHeader("Connection", "close");
|
||||
|
||||
if (meth == 'GET') parameters = null;
|
||||
http_request.send(parameters);
|
||||
}
|
||||
|
0
htdocs/js/to_ascii.js → htdocs/js/toAscii.js
Executable file → Normal file
@@ -1,27 +0,0 @@
|
||||
var current;
|
||||
|
||||
function tree_unhide(whichLayer,old) {
|
||||
if (current == null) current = old;
|
||||
var oldtree = document.getElementById('ajSID_'+current).style;
|
||||
oldtree.display = 'none';
|
||||
|
||||
if (document.getElementById) {
|
||||
// this is the way the standards work
|
||||
var newtree = document.getElementById(whichLayer).value;
|
||||
var newtree_div = document.getElementById('ajSID_'+newtree).style;
|
||||
newtree_div.display = 'block';
|
||||
|
||||
/*
|
||||
} else if (document.all) {
|
||||
// this is the way old msie versions work
|
||||
var style2 = document.all[whichLayer].style;
|
||||
style2.display = style2.display ? '':'block';
|
||||
|
||||
} else if (document.layers) {
|
||||
// this is the way nn4 works
|
||||
var style2 = document.layers[whichLayer].style;
|
||||
style2.display = style2.display ? '':'block';
|
||||
*/
|
||||
}
|
||||
current = newtree;
|
||||
}
|
@@ -78,7 +78,7 @@ if ($app['server']->getAuthType() == 'http') {
|
||||
|
||||
# If Anon bind allowed, then disable the form if the user choose to bind anonymously.
|
||||
if ($app['server']->isAnonBindAllowed())
|
||||
printf('<tr><td colspan="2"><small><b>%s</b></small> <input type="checkbox" name="anonymous_bind" onclick="toggle_disable_login_fields(this)" id="anonymous_bind_checkbox" /></td></tr>',
|
||||
printf('<tr><td colspan="2"><small><b>%s</b></small> <input type="checkbox" name="anonymous_bind" onclick="form_field_toggle_enable(this,[\'login\',\'password\'],\'login\')" id="anonymous_bind_checkbox" /></td></tr>',
|
||||
_('Anonymous'));
|
||||
|
||||
printf('<tr><td colspan="2"><center><input type="submit" name="submit" value="%s" /></center></td></tr>',
|
||||
@@ -90,23 +90,9 @@ if ($app['server']->getAuthType() == 'http') {
|
||||
|
||||
echo '<br/>';
|
||||
|
||||
echo '<script type="text/javascript" language="javascript">document.getElementById(\'login\').focus()</script>';
|
||||
echo '<script type="text/javascript" language="javascript">document.getElementById("login").focus()</script>';
|
||||
|
||||
if ($app['server']->isAnonBindAllowed() ) {
|
||||
?>
|
||||
<script type="text/javascript" language="javascript">
|
||||
function toggle_disable_login_fields(anon_checkbox) {
|
||||
if (anon_checkbox.checked) {
|
||||
anon_checkbox.form.login.disabled = true;
|
||||
anon_checkbox.form.password.disabled = true;
|
||||
} else {
|
||||
anon_checkbox.form.login.disabled = false;
|
||||
anon_checkbox.form.login.focus();
|
||||
anon_checkbox.form.password.disabled = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
if ($app['server']->isAnonBindAllowed())
|
||||
printf('<script type="text/javascript" language="javascript" src="%sform_field_toggle_enable.js"></script>',JSDIR);
|
||||
}
|
||||
?>
|
||||
|
@@ -78,6 +78,8 @@ usort($possible_members,'pla_compare_dns');
|
||||
# Modifications will be sent to update_confirm which takes care of rest of the processing
|
||||
echo '<br />';
|
||||
echo '<br />';
|
||||
|
||||
printf('<script type="text/javascript" language="javascript" src="%smodify_member.js"></script>',JSDIR);
|
||||
echo '<form action="cmd.php" method="post" class="add_value" name="member">';
|
||||
if ($_SESSION[APPCONFIG]->getValue('confirm','update'))
|
||||
echo '<input type="hidden" name="cmd" value="update_confirm" />';
|
||||
@@ -147,18 +149,10 @@ printf('<input type="hidden" name="new_values[%s][]" value="" />',htmlspecialcha
|
||||
echo '</div>';
|
||||
|
||||
# Submit values to update_confirm.php and when clicked, run addSelected
|
||||
printf('<input type="submit" name="save" value="%s" onClick="update_new_values(\'%s\',\'modifymember\')" />',_('Save changes'),$request['attr']);
|
||||
printf('<input type="submit" name="save" value="%s" onClick="update_new_values(\'%s\')" />',_('Save changes'),$request['attr']);
|
||||
echo '</td></tr>';
|
||||
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
|
||||
# Variables for Javascript function that moves members from left to right
|
||||
echo '<script type="text/javascript" language="javascript">';
|
||||
echo 'var m1 = document.member.notmembers;';
|
||||
echo 'var m2 = document.member.members;';
|
||||
echo '</script>';
|
||||
printf('<script type="text/javascript" src="%smodify_member.js"></script>',JSDIR);
|
||||
|
||||
echo '</body></html>';
|
||||
?>
|
||||
|
@@ -45,9 +45,14 @@ foreach (array(
|
||||
'cn=Overlays,cn=Monitor' => 'cn=Overlay %s,%s'
|
||||
) as $dn => $child) {
|
||||
|
||||
$description = implode(' ',$results[$dn]['description']);
|
||||
if (isset($results[$dn]['description'])) {
|
||||
$description = implode(' ',$results[$dn]['description']);
|
||||
|
||||
$description = preg_replace('/"/','\'',$description);
|
||||
} else {
|
||||
$description = '';
|
||||
}
|
||||
|
||||
$description = preg_replace('/"/','\'',$description);
|
||||
printf('<tr class="list_item"><td class="heading" rowspan=2><acronym title="%s">%s</acronym></td></tr>',$description,$dn);
|
||||
echo '<tr class="list_item"><td class="value">';
|
||||
echo '<table class="result"><tr><td>';
|
||||
|
@@ -69,8 +69,8 @@ echo '</form>';
|
||||
# Pull our password from the form that opened this window.
|
||||
if ($request['componentid']) {
|
||||
echo '<script type="text/javascript">';
|
||||
printf('var c = window.opener.document.getElementById(\'%s\');',$request['componentid']);
|
||||
printf('var h = document.getElementById(\'%s\');','hash');
|
||||
printf('var c = window.opener.document.getElementById("%s");',$request['componentid']);
|
||||
printf('var h = document.getElementById("%s");','hash');
|
||||
echo 'if (c && h) { h.value = c.value; }';
|
||||
echo '</script>';
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@ if (get_request('purge','REQUEST')) {
|
||||
$entry = $tree->getEntry($value);
|
||||
}
|
||||
|
||||
$tree->readChildren($value);
|
||||
$tree->readChildren($value,true);
|
||||
$entry->open();
|
||||
}
|
||||
|
||||
|
@@ -57,7 +57,7 @@ foreach ($entry['schema_types'] as $item => $value) {
|
||||
|
||||
} else {
|
||||
if (isAjaxEnabled())
|
||||
printf('<a href="cmd.php?%s" onClick="return displayAJ(\'BODY\',\'%s\',\'Loading %s\');" title="Loading %s">%s</a>',
|
||||
printf('<a href="cmd.php?%s" onClick="return ajDISPLAY(\'BODY\',\'%s\',\'Loading %s\');" title="Loading %s">%s</a>',
|
||||
htmlspecialchars($entry['href'][$item]),htmlspecialchars($entry['href'][$item]),$value,$value,$value);
|
||||
else
|
||||
printf('<a href="cmd.php?%s">%s</a>',htmlspecialchars($entry['href'][$item]),_($value));
|
||||
@@ -67,64 +67,6 @@ foreach ($entry['schema_types'] as $item => $value) {
|
||||
echo '</center>';
|
||||
echo '<br />';
|
||||
|
||||
if (isAjaxEnabled()) {
|
||||
echo '<script type="text/javascript" language="javascript">'."\n";
|
||||
echo "function showthis(type,key,value) {
|
||||
select = document.getElementById(type);
|
||||
if (value != null) {
|
||||
attr = value;
|
||||
select.value = value;
|
||||
} else {
|
||||
attr = select.value;
|
||||
}
|
||||
|
||||
if (! attr) {
|
||||
showall(key);
|
||||
} else {
|
||||
objectclass = document.getElementById(key+attr);
|
||||
objectclass.style.display = '';
|
||||
hideall(key,attr);
|
||||
};
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
function showall(key) {
|
||||
items = items();
|
||||
for (x in items) {
|
||||
if (! isNaN(x)) {
|
||||
item = document.getElementById(key+items[x]);
|
||||
item.style.display = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function hideall(key,except) {
|
||||
items = items();
|
||||
for (x in items) {
|
||||
if (! isNaN(x) && except != items[x]) {
|
||||
item = document.getElementById(key+items[x]);
|
||||
item.style.display = 'none';
|
||||
|
||||
} else if (! isNaN(x) && except == items[x]) {
|
||||
item = document.getElementById(key+items[x]);
|
||||
item.style.display = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function ajJump(html,title,index,prefix) {
|
||||
if (prefix)
|
||||
attr = document.getElementById('vv'+index).value;
|
||||
else
|
||||
attr = index;
|
||||
if (attr)
|
||||
html = html+'&viewvalue='+attr;
|
||||
return displayAJ('BODY',html,'Loading '+title);
|
||||
}";
|
||||
echo '</script>';
|
||||
}
|
||||
|
||||
switch($entry['view']) {
|
||||
case 'syntaxes':
|
||||
$highlight_oid = get_request('highlight_oid','GET',false,false);
|
||||
@@ -188,19 +130,8 @@ switch($entry['view']) {
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
|
||||
if (isAjaxEnabled()) {
|
||||
echo '<script type="text/javascript" language="javascript">'."\n";
|
||||
echo "function items() {
|
||||
var \$items = new Array();";
|
||||
$counter = 0;
|
||||
foreach ($sattrs as $attr) {
|
||||
printf(' items[%s] = "%s";',$counter++,$attr->getName());
|
||||
echo "\n";
|
||||
}
|
||||
echo '
|
||||
return items;
|
||||
}';
|
||||
echo '</script>';
|
||||
echo '<select name="viewvalue" onChange="showthis(\'attributes\',\'at\')" id="attributes">';
|
||||
drawJSItems($sattrs);
|
||||
echo '<select name="viewvalue" onChange="ajSHOWSCHEMA(\'attributes\',\'at\')" id="attributes">';
|
||||
} else
|
||||
echo '<select name="viewvalue" onChange="submit()">';
|
||||
|
||||
@@ -211,7 +142,7 @@ switch($entry['view']) {
|
||||
echo '</select>';
|
||||
|
||||
if (isAjaxEnabled())
|
||||
printf('<input type="button" value="%s" onClick="showthis(\'attributes\',\'at\')"/>',_('Go'));
|
||||
printf('<input type="button" value="%s" onClick="ajSHOWSCHEMA(\'attributes\',\'at\')"/>',_('Go'));
|
||||
else
|
||||
printf('<input type="submit" value="%s" />',_('Go'));
|
||||
echo '</form>';
|
||||
@@ -223,7 +154,7 @@ switch($entry['view']) {
|
||||
$entry['viewed'] = true;
|
||||
|
||||
if (isAjaxEnabled() && $entry['value'])
|
||||
printf('<div id="at%s" style="display: %s">',$attr->getName(),strcasecmp($entry['value'],$attr->getName()) ? 'none' : '');
|
||||
printf('<div id="at%s" style="display: %s">',$attr->getName(),strcasecmp($entry['value'],$attr->getName()) ? 'none' : 'block');
|
||||
else
|
||||
printf('<div id="at%s">',$attr->getName());
|
||||
|
||||
@@ -264,7 +195,7 @@ switch($entry['view']) {
|
||||
else {
|
||||
$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['attributes'],strtolower($attr->getSupAttribute())));
|
||||
if (isAjaxEnabled())
|
||||
printf('<a href="cmd.php?%s" onClick="return showthis(\'attributes\',\'at\',\'%s\');">%s</a>',
|
||||
printf('<a href="cmd.php?%s" onClick="return ajSHOWSCHEMA(\'attributes\',\'at\',\'%s\');">%s</a>',
|
||||
$href,strtolower($attr->getSupAttribute()),$attr->getSupAttribute());
|
||||
else
|
||||
printf('<a href="cmd.php?%s">%s</a>',$href,$attr->getSupAttribute());
|
||||
@@ -282,7 +213,7 @@ switch($entry['view']) {
|
||||
else {
|
||||
$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['matching_rules'],$attr->getEquality()));
|
||||
if (isAjaxEnabled())
|
||||
printf('<a href="cmd.php?%s" onClick="return ajJump(\'%s\',\'%s\',\'%s\');">%s</a>',
|
||||
printf('<a href="cmd.php?%s" onClick="return ajJUMP(\'%s\',\'%s\',\'%s\');">%s</a>',
|
||||
$href,$href,_('Matching Rules'),$attr->getEquality(),$attr->getEquality());
|
||||
else
|
||||
printf('<a href="cmd.php?%s">%s</a>',$href,$attr->getEquality());
|
||||
@@ -310,7 +241,7 @@ switch($entry['view']) {
|
||||
} else {
|
||||
$href = htmlspecialchars(sprintf('%s&highlight_oid=%s',$entry['href']['syntaxes'],$attr->getSyntaxOID()));
|
||||
if (isAjaxEnabled())
|
||||
printf('<a href="cmd.php?%s" onClick="return ajJump(\'%s\',\'%s\',\'%s\');">%s (%s)</a>',
|
||||
printf('<a href="cmd.php?%s" onClick="return ajJUMP(\'%s\',\'%s\',\'%s\');">%s (%s)</a>',
|
||||
$href,$href,_('Syntaxes'),'',$attr->getType(),$attr->getSyntaxOID());
|
||||
else
|
||||
printf('<a href="cmd.php?%s">%s (%s)</a>',$href,$attr->getType(),$attr->getSyntaxOID());
|
||||
@@ -358,7 +289,7 @@ switch($entry['view']) {
|
||||
foreach ($attr->getAliases() as $alias) {
|
||||
$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['attributes'],strtolower($alias)));
|
||||
if (isAjaxEnabled())
|
||||
printf('<a href="cmd.php?%s" onClick="return showthis(\'attributes\',\'at\',\'%s\');">%s</a>',
|
||||
printf('<a href="cmd.php?%s" onClick="return ajSHOWSCHEMA(\'attributes\',\'at\',\'%s\');">%s</a>',
|
||||
$href,strtolower($alias),$alias);
|
||||
else
|
||||
printf('<a href="cmd.php?%s">%s</a>',$href,$alias);
|
||||
@@ -377,7 +308,7 @@ switch($entry['view']) {
|
||||
foreach ($attr->getUsedInObjectClasses() as $objectclass) {
|
||||
$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower($objectclass)));
|
||||
if (isAjaxEnabled())
|
||||
printf('<a href="cmd.php?%s" onClick="return ajJump(\'%s\',\'%s\',\'%s\');">%s</a> ',
|
||||
printf('<a href="cmd.php?%s" onClick="return ajJUMP(\'%s\',\'%s\',\'%s\');">%s</a> ',
|
||||
$href,$href,_('ObjectClasses'),strtolower($objectclass),$objectclass);
|
||||
else
|
||||
printf('<a href="cmd.php?%s">%s</a> ',$href,$objectclass);
|
||||
@@ -414,20 +345,8 @@ switch($entry['view']) {
|
||||
echo '<input type="hidden" name="view" value="matching_rules" />';
|
||||
|
||||
if (isAjaxEnabled()) {
|
||||
echo '<script type="text/javascript" language="javascript">'."\n";
|
||||
echo "function items() {
|
||||
var \$items = new Array();";
|
||||
$counter = 0;
|
||||
foreach ($schema_matching_rules as $rule) {
|
||||
printf(' items[%s] = "%s";',$counter++,$rule->getName());
|
||||
echo "\n";
|
||||
}
|
||||
echo '
|
||||
return items;
|
||||
}
|
||||
';
|
||||
echo '</script>';
|
||||
echo '<select name="viewvalue" onChange="showthis(\'matchingrules\',\'mr\')" id="matchingrules">';
|
||||
drawJSItems($schema_matching_rules);
|
||||
echo '<select name="viewvalue" onChange="ajSHOWSCHEMA(\'matchingrules\',\'mr\')" id="matchingrules">';
|
||||
} else
|
||||
echo '<select name="viewvalue" onChange="submit()">';
|
||||
|
||||
@@ -441,7 +360,7 @@ switch($entry['view']) {
|
||||
echo '</select>';
|
||||
|
||||
if (isAjaxEnabled())
|
||||
printf('<input type="button" value="%s" onClick="showthis(\'matchingrules\',\'mr\')"/>',_('Go'));
|
||||
printf('<input type="button" value="%s" onClick="ajSHOWSCHEMA(\'matchingrules\',\'mr\')"/>',_('Go'));
|
||||
else
|
||||
printf('<input type="submit" value="%s" />',_('Go'));
|
||||
echo '</form>';
|
||||
@@ -494,7 +413,7 @@ switch($entry['view']) {
|
||||
echo '</select><br />';
|
||||
|
||||
if (isAjaxEnabled())
|
||||
printf('<input type="button" value="%s" onClick="return ajJump(\'cmd=schema&view=attributes&server_id=%s\',\'%s\',\'%s\',\'vv\');"/>',
|
||||
printf('<input type="button" value="%s" onClick="return ajJUMP(\'cmd=schema&view=attributes&server_id=%s\',\'%s\',\'%s\',\'vv\');"/>',
|
||||
_('Go'),$app['server']->getIndex(),_('Attributes'),$rule->getName());
|
||||
else
|
||||
printf('<input type="submit" value="%s" />',_('Go'));
|
||||
@@ -522,19 +441,8 @@ switch($entry['view']) {
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
|
||||
if (isAjaxEnabled()) {
|
||||
echo '<script type="text/javascript" language="javascript">'."\n";
|
||||
echo "function items() {
|
||||
var \$items = new Array();";
|
||||
$counter = 0;
|
||||
foreach ($socs as $oclass) {
|
||||
printf(' items[%s] = "%s";',$counter++,$oclass->getName());
|
||||
echo "\n";
|
||||
}
|
||||
echo '
|
||||
return items;
|
||||
}';
|
||||
echo '</script>';
|
||||
echo '<select name="viewvalue" onChange="showthis(\'objectclasses\',\'oc\')" id="objectclasses">';
|
||||
drawJSItems($socs);
|
||||
echo '<select name="viewvalue" onChange="ajSHOWSCHEMA(\'objectclasses\',\'oc\')" id="objectclasses">';
|
||||
} else
|
||||
echo '<select name="viewvalue" onChange="submit()">';
|
||||
|
||||
@@ -546,7 +454,7 @@ switch($entry['view']) {
|
||||
echo '</select>';
|
||||
|
||||
if (isAjaxEnabled())
|
||||
printf('<input type="button" value="%s" onClick="showthis(\'objectclasses\',\'oc\')"/>',_('Go'));
|
||||
printf('<input type="button" value="%s" onClick="ajSHOWSCHEMA(\'objectclasses\',\'oc\')"/>',_('Go'));
|
||||
else
|
||||
printf('<input type="submit" value="%s" />',_('Go'));
|
||||
echo '</form>';
|
||||
@@ -582,7 +490,7 @@ switch($entry['view']) {
|
||||
foreach ($oclass->getSupClasses() as $i => $object_class) {
|
||||
$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower($object_class)));
|
||||
if (isAjaxEnabled())
|
||||
printf('<a href="cmd.php?%s" onClick="return showthis(\'objectclasses\',\'oc\',\'%s\');">%s</a>',
|
||||
printf('<a href="cmd.php?%s" onClick="return ajSHOWSCHEMA(\'objectclasses\',\'oc\',\'%s\');">%s</a>',
|
||||
$href,strtolower($object_class),$object_class);
|
||||
else
|
||||
printf('<a href="cmd.php?%s&viewvalue=%s" title="%s">%s</a>',
|
||||
@@ -597,7 +505,7 @@ switch($entry['view']) {
|
||||
if (strcasecmp($oclass->getName(),'top') == 0) {
|
||||
$href = htmlspecialchars($entry['href']['objectclasses']);
|
||||
if (isAjaxEnabled())
|
||||
printf('<a href="cmd.php?%s" onClick="return showthis(\'objectclasses\',\'oc\',\'\');">all</a>',
|
||||
printf('<a href="cmd.php?%s" onClick="return ajSHOWSCHEMA(\'objectclasses\',\'oc\',\'\');">all</a>',
|
||||
$href);
|
||||
else
|
||||
printf('(<a href="cmd.php?%s">all</a>)',$href);
|
||||
@@ -609,7 +517,7 @@ switch($entry['view']) {
|
||||
foreach ($oclass->getChildObjectClasses() as $i => $object_class) {
|
||||
$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower($object_class)));
|
||||
if (isAjaxEnabled())
|
||||
printf('<a href="cmd.php?%s" title="%s" onClick="return showthis(\'objectclasses\',\'oc\',\'%s\');">%s</a>',
|
||||
printf('<a href="cmd.php?%s" title="%s" onClick="return ajSHOWSCHEMA(\'objectclasses\',\'oc\',\'%s\');">%s</a>',
|
||||
$href,_('Jump to this objectClass definition'),strtolower($object_class),$object_class);
|
||||
else
|
||||
printf('<a href="cmd.php?%s" title="%s">%s</a>',$href,_('Jump to this objectClass definition'),$object_class);
|
||||
@@ -632,7 +540,7 @@ switch($entry['view']) {
|
||||
echo '<li>';
|
||||
$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['attributes'],$attr->getName()));
|
||||
if (isAjaxEnabled())
|
||||
printf('<a href="cmd.php?%s" onClick="return ajJump(\'%s\',\'%s\',\'%s\');">%s</a>',
|
||||
printf('<a href="cmd.php?%s" onClick="return ajJUMP(\'%s\',\'%s\',\'%s\');">%s</a>',
|
||||
$href,$href,_('Attributes'),$attr->getName(),$attr->getName(false));
|
||||
else
|
||||
printf('<a href="cmd.php?%s">%s</a>',$href,$attr->getName(false));
|
||||
@@ -642,7 +550,7 @@ switch($entry['view']) {
|
||||
$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower($attr->getSource())));
|
||||
printf('<small>(%s ',_('Inherited from'));
|
||||
if (isAjaxEnabled())
|
||||
printf('<a href="cmd.php?%s" title="%s" onClick="return showthis(\'objectclasses\',\'oc\',\'%s\');">%s</a>',
|
||||
printf('<a href="cmd.php?%s" title="%s" onClick="return ajSHOWSCHEMA(\'objectclasses\',\'oc\',\'%s\');">%s</a>',
|
||||
$href,_('Jump to this objectClass definition'),strtolower($attr->getSource()),$attr->getSource());
|
||||
else
|
||||
printf('<a href="cmd.php?%s">%s</a>',$href,$attr->getSource());
|
||||
@@ -665,7 +573,7 @@ switch($entry['view']) {
|
||||
echo '<li>';
|
||||
$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['attributes'],$attr->getName()));
|
||||
if (isAjaxEnabled())
|
||||
printf('<a href="cmd.php?%s" onClick="return ajJump(\'%s\',\'%s\',\'%s\');">%s</a>',
|
||||
printf('<a href="cmd.php?%s" onClick="return ajJUMP(\'%s\',\'%s\',\'%s\');">%s</a>',
|
||||
$href,$href,_('Attributes'),$attr->getName(),$attr->getName(false));
|
||||
else
|
||||
printf('<a href="cmd.php?%s">%s</a>',$href,$attr->getName(false));
|
||||
@@ -675,7 +583,7 @@ switch($entry['view']) {
|
||||
$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower($attr->getSource())));
|
||||
printf('<small>(%s ',_('Inherited from'));
|
||||
if (isAjaxEnabled())
|
||||
printf('<a href="cmd.php?%s" title="%s" onClick="return showthis(\'objectclasses\',\'oc\',\'%s\');">%s</a>',
|
||||
printf('<a href="cmd.php?%s" title="%s" onClick="return ajSHOWSCHEMA(\'objectclasses\',\'oc\',\'%s\');">%s</a>',
|
||||
$href,_('Jump to this objectClass definition'),strtolower($attr->getSource()),$attr->getSource());
|
||||
else
|
||||
printf('<a href="cmd.php?%s">%s</a>',$href,$attr->getSource());
|
||||
@@ -705,4 +613,22 @@ switch($entry['view']) {
|
||||
|
||||
if (! is_null($entry['value']) && ! $entry['viewed'])
|
||||
error(sprintf(_('No such schema item: "%s"'),$entry['value']),'error','index.php');
|
||||
|
||||
function drawJSItems($object) {
|
||||
echo '<script type="text/javascript" language="javascript">'."\n";
|
||||
|
||||
echo "
|
||||
function items() {
|
||||
var \$items = new Array();";
|
||||
$counter = 0;
|
||||
foreach ($object as $attr) {
|
||||
printf(' items[%s] = "%s";',$counter++,$attr->getName());
|
||||
echo "\n";
|
||||
}
|
||||
echo '
|
||||
return items;
|
||||
}';
|
||||
|
||||
echo '</script>';
|
||||
}
|
||||
?>
|
||||
|
@@ -92,7 +92,7 @@ if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_debug_info')) {
|
||||
poststr += "&global=on" + encodeURI(xx);
|
||||
<?php } ?>
|
||||
obj.innerHTML = '<img src="<?php echo IMGDIR ?>/ajax-spinner.gif" /> <?php echo _('Loading') ?>...';
|
||||
makePOSTRequest('cmd.php',poststr,'alertCacheContents','cancelCacheContents');
|
||||
makeHttpRequest('cmd.php',poststr,'POST','alertCacheContents','cancelCacheContents');
|
||||
}
|
||||
|
||||
function close(key,xx) {
|
||||
|
@@ -52,21 +52,15 @@ if ($result) {
|
||||
# If the user password was changed, not tell the to relogin.
|
||||
if ($mustRelogin) {
|
||||
$app['server']->logout('user');
|
||||
unset_lastactivity($app['server']);
|
||||
echo '<body>';
|
||||
unset($_SESSION['ACTIVITY'][$app['server']->getIndex()]);
|
||||
|
||||
echo '<br />';
|
||||
echo '<center>';
|
||||
printf('<b>%s</b>',_('Modification successful!'));
|
||||
echo '<br /><br />';
|
||||
echo _('Since you changed your password, you must now login again with your new password.');
|
||||
echo '<br />';
|
||||
printf('<a href="cmd.php?cmd=login_form&server_id=%s">%s...</a>',$app['server']->getIndex(), _('Login'));
|
||||
echo '</center>';
|
||||
echo '</body>';
|
||||
echo '</html>';
|
||||
system_message(array(
|
||||
'title'=>_('Modification successful!'),
|
||||
'body'=>_('Since you changed your password, you must now login again with your new password.'),
|
||||
'type'=>'info'),
|
||||
sprintf('cmd.php?cmd=login_form&server_id=%s',$app['server']->getIndex()));
|
||||
|
||||
exit;
|
||||
exit;
|
||||
}
|
||||
|
||||
$redirect_url = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',
|
||||
|
@@ -53,15 +53,8 @@ if (count($request['template']->getLDAPmodify(true))) {
|
||||
echo "\n\n";
|
||||
|
||||
# If we skip objectclass changes, but there are new must/may attrs provided by the new objectclass, they need to be skip.
|
||||
$mustattrs = array();
|
||||
foreach ($request['template']->getAttribute('objectclass')->getValues() as $value) {
|
||||
$soc = $app['server']->getSchemaObjectClass($value);
|
||||
$mustattrs = getMustAttrs($request['template']->getAttribute('objectclass')->getValues());
|
||||
|
||||
if ($soc)
|
||||
foreach ($soc->getMustAttrs() as $sma)
|
||||
array_push($mustattrs,$sma->getName());
|
||||
}
|
||||
|
||||
$counter = 0;
|
||||
foreach ($request['template']->getLDAPmodify(true) as $attribute) {
|
||||
$counter++;
|
||||
@@ -117,37 +110,45 @@ if (count($request['template']->getLDAPmodify(true))) {
|
||||
$input_disabled = '';
|
||||
$input_onclick = '';
|
||||
|
||||
if ($attribute->isForceDelete() || in_array($attribute->getName(),$mustattrs))
|
||||
if ($attribute->isForceDelete() || (in_array($attribute->getName(),$mustattrs)) && $request['template']->getAttribute('objectclass')->justModified())
|
||||
$input_disabled = 'disabled="disabled"';
|
||||
|
||||
if ($attribute->getName() == 'objectclass') {
|
||||
$input_onclick = '';
|
||||
|
||||
# If there are attributes being force deleted...
|
||||
if (count($request['template']->getForceDeleteAttrs()) > 0) {
|
||||
$input_onclick = 'onclick="if (this.checked) {';
|
||||
|
||||
# And this OC is being skipped, then these attributes can be optionally deleted.
|
||||
foreach ($request['template']->getForceDeleteAttrs() as $ad_name) {
|
||||
$input_onclick .= sprintf("document.getElementById('skip_array_%s').disabled = false;",$ad_name->getName());
|
||||
# Only if it is not a must attr by this objectclass now staying
|
||||
if (! in_array($ad_name->getName(),getMustAttrs($attribute->getOldValues())))
|
||||
$input_onclick .= sprintf("document.getElementById('skip_array_%s').disabled = false;",$ad_name->getName());
|
||||
|
||||
$input_onclick .= sprintf("document.getElementById('skip_array_%s').checked = true;",$ad_name->getName());
|
||||
$input_onclick .= "\n";
|
||||
}
|
||||
|
||||
$input_onclick .= '} else {';
|
||||
|
||||
# Otherwise the attributes must be deleted.
|
||||
foreach ($request['template']->getForceDeleteAttrs() as $ad_name) {
|
||||
$input_onclick .= sprintf("document.getElementById('skip_array_%s').checked = false;",$ad_name->getName());
|
||||
$input_onclick .= sprintf("document.getElementById('skip_array_%s').disabled = true;",$ad_name->getName());
|
||||
$input_onclick .= "\n";
|
||||
}
|
||||
|
||||
$input_onclick .= '};';
|
||||
$input_onclick .= '};';
|
||||
}
|
||||
|
||||
# If the attributes arent force deleted...
|
||||
if ($input_onclick)
|
||||
$input_onclick .= 'if (this.checked) {';
|
||||
else
|
||||
$input_onclick = 'onclick="if (this.checked) {';
|
||||
|
||||
# IE: There are new objectclasses that result in new values.
|
||||
foreach ($request['template']->getLDAPmodify(true) as $skipattr) {
|
||||
if (! $skipattr->getOldValues()) {
|
||||
if (! in_array($skipattr->getName(),$mustattrs))
|
||||
@@ -216,4 +217,20 @@ if (count($request['template']->getLDAPmodify(true))) {
|
||||
printf(' <a href="%s">%s</a>.',htmlspecialchars($href),_('Go back'));
|
||||
echo '</center>';
|
||||
}
|
||||
|
||||
function getMustAttrs($oclasses) {
|
||||
global $app;
|
||||
|
||||
$mustattrs = array();
|
||||
|
||||
foreach ($oclasses as $value) {
|
||||
$soc = $app['server']->getSchemaObjectClass($value);
|
||||
|
||||
if ($soc)
|
||||
foreach ($soc->getMustAttrs() as $sma)
|
||||
array_push($mustattrs,$sma->getName());
|
||||
}
|
||||
|
||||
return $mustattrs;
|
||||
}
|
||||
?>
|
||||
|
@@ -65,20 +65,13 @@ class AJAXTree extends HTMLTree {
|
||||
if ($last_child)
|
||||
$nb += 2;
|
||||
|
||||
$imgs['expand'] = array(JSDIR.'phplayersmenu/menuimages/tree_expand.png',
|
||||
JSDIR.'phplayersmenu/menuimages/tree_expand.png',
|
||||
JSDIR.'phplayersmenu/menuimages/tree_expand_corner.png',
|
||||
($level > 0) ? JSDIR.'phplayersmenu/menuimages/tree_expand_corner.png' : JSDIR.'phplayersmenu/menuimages/tree_expand_corner_first.png');
|
||||
$imgs['expand'] = array('tree_expand.png','tree_expand.png','tree_expand_corner.png',
|
||||
($level > 0) ? 'tree_expand_corner.png' : 'tree_expand_corner_first.png');
|
||||
|
||||
$imgs['collapse'] = array(JSDIR.'phplayersmenu/menuimages/tree_collapse.png',
|
||||
JSDIR.'phplayersmenu/menuimages/tree_collapse.png',
|
||||
JSDIR.'phplayersmenu/menuimages/tree_collapse_corner.png',
|
||||
($level > 0) ? JSDIR.'phplayersmenu/menuimages/tree_collapse_corner.png' : JSDIR.'phplayersmenu/menuimages/tree_collapse_corner_first.png');
|
||||
$imgs['collapse'] = array('tree_collapse.png','tree_collapse.png','tree_collapse_corner.png',
|
||||
($level > 0) ? 'tree_collapse_corner.png' : 'tree_collapse_corner_first.png');
|
||||
|
||||
$imgs['tree'] = array(JSDIR.'phplayersmenu/menuimages/tree_split.png',
|
||||
JSDIR.'phplayersmenu/menuimages/tree_split.png',
|
||||
JSDIR.'phplayersmenu/menuimages/tree_corner.png',
|
||||
JSDIR.'phplayersmenu/menuimages/tree_corner.png');
|
||||
$imgs['tree'] = array('tree_split.png','tree_split.png','tree_corner.png','tree_corner.png');
|
||||
|
||||
/** Information on array[$nb]
|
||||
* nb == 1 => the node is the first child
|
||||
@@ -104,25 +97,25 @@ class AJAXTree extends HTMLTree {
|
||||
echo $this->get_indentation($code);
|
||||
|
||||
if (! $child_count)
|
||||
printf('<img align="top" border="0" class="imgs" id="jt%snode" src="%s" alt="--" />',$node_id,$imgs['tree'][$nb]);
|
||||
printf('<img align="top" border="0" class="imgs" id="jt%snode" src="%s/%s" alt="--" />',$node_id,IMGDIR,$imgs['tree'][$nb]);
|
||||
|
||||
else {
|
||||
printf('<a href="#" onclick="return opencloseTreeNode(\'%s\',\'%s\');">',$node_id,$parms['openclose']);
|
||||
printf('<a href="#" onclick="return opencloseTreeNode(\'%s\',\'%s\',\'%s\');">',$node_id,$parms['openclose'],IMGDIR);
|
||||
|
||||
if ($entry->isOpened())
|
||||
printf('<img align="top" border="0" class="imgs" id="jt%snode" src="%s" alt="+-" />',$node_id,$imgs['collapse'][$nb]);
|
||||
printf('<img align="top" border="0" class="imgs" id="jt%snode" src="%s/%s" alt="+-" />',$node_id,IMGDIR,$imgs['collapse'][$nb]);
|
||||
else
|
||||
printf('<img align="top" border="0" class="imgs" id="jt%snode" src="%s" alt="+-" />',$node_id,$imgs['expand'][$nb]);
|
||||
printf('<img align="top" border="0" class="imgs" id="jt%snode" src="%s/%s" alt="+-" />',$node_id,IMGDIR,$imgs['expand'][$nb]);
|
||||
|
||||
echo '</a>';
|
||||
}
|
||||
|
||||
printf('<a href="%s" onclick="return displayAJ(\'BODY\',\'%s\',\'%s\');" title="%s" >',$href,$parms['edit'],_('Retrieving DN'),htmlspecialchars($item));
|
||||
printf('<a href="%s" onclick="return ajDISPLAY(\'BODY\',\'%s\',\'%s\');" title="%s" >',$href,$parms['edit'],_('Retrieving DN'),htmlspecialchars($item));
|
||||
printf('<span class="dnicon"><img align="top" border="0" class="imgs" id="jt%sfolder" src="%s/%s" alt="->" /></span>',$node_id,IMGDIR,$entry->getIcon($server));
|
||||
echo '</a>';
|
||||
|
||||
echo ' ';
|
||||
printf('<a href="%s" onclick="return displayAJ(\'BODY\',\'%s\',\'%s\');" title="%s" class="phplm">',$href,$parms['edit'],_('Retrieving DN'),htmlspecialchars($item));
|
||||
printf('<a href="%s" onclick="return ajDISPLAY(\'BODY\',\'%s\',\'%s\');" title="%s" class="phplm">',$href,$parms['edit'],_('Retrieving DN'),htmlspecialchars($item));
|
||||
echo $this->get_formatted_dn($entry,$level-1);
|
||||
echo ($child_count ? (sprintf(' (%s%s)',$child_count,($entry->isSizeLimited() ? '+' : ''))) : '');
|
||||
echo '</a>';
|
||||
@@ -147,10 +140,8 @@ class AJAXTree extends HTMLTree {
|
||||
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$children = array();
|
||||
$pchildren = $parent_entry->getChildren();
|
||||
usort($pchildren,'pla_compare_dns');
|
||||
|
||||
foreach ($pchildren as $child) {
|
||||
foreach ($parent_entry->getChildren() as $child) {
|
||||
if (! $this->getEntry($child))
|
||||
$this->addEntry($child);
|
||||
|
||||
@@ -201,11 +192,11 @@ class AJAXTree extends HTMLTree {
|
||||
for ($i=0; $i<strlen($code); $i++) {
|
||||
switch ($code[$i]) {
|
||||
case '0':
|
||||
$indent .= sprintf('<img align="top" border="0" class="imgs" src="%s/phplayersmenu/menuimages/tree_space.png" alt=" " />',JSDIR);
|
||||
$indent .= sprintf('<img align="top" border="0" class="imgs" src="%s/tree_space.png" alt=" " />',IMGDIR);
|
||||
break;
|
||||
|
||||
case '1':
|
||||
$indent .= sprintf('<img align="top" border="0" class="imgs" src="%s/phplayersmenu/menuimages/tree_vertline.png" alt="| " />',JSDIR);
|
||||
$indent .= sprintf('<img align="top" border="0" class="imgs" src="%s/tree_vertline.png" alt="| " />',IMGDIR);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -220,8 +211,8 @@ class AJAXTree extends HTMLTree {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
printf('<script type="text/javascript" language="javascript" src="%sphplayersmenu/libjs/layersmenu-browser_detection.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" language="javascript" src="%sajaxtree.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" language="javascript" src="%slayersmenu-browser_detection.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" language="javascript" src="%sajax_tree.js"></script>',JSDIR);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -239,7 +230,7 @@ class AJAXTree extends HTMLTree {
|
||||
|
||||
if (! $server->isReadOnly() && ! $entry->isLeaf() && (count($entry->getChildren()) > 10) && $this->getServer()->isShowCreateEnabled()
|
||||
&& $_SESSION[APPCONFIG]->getValue('appearance','show_top_create'))
|
||||
$output = $this->draw_create_new_entry($entry,$level,JSDIR.'phplayersmenu/menuimages/tree_split.png');
|
||||
$output = $this->draw_create_new_entry($entry,$level,IMGDIR.'/tree_split.png');
|
||||
|
||||
return $output;
|
||||
}
|
||||
@@ -258,7 +249,7 @@ class AJAXTree extends HTMLTree {
|
||||
$output = '';
|
||||
|
||||
if (! $server->isReadOnly() && ! $entry->isLeaf() && $this->getServer()->isShowCreateEnabled())
|
||||
$output = $this->draw_create_new_entry($entry,$level,JSDIR.'phplayersmenu/menuimages/tree_corner.png');
|
||||
$output = $this->draw_create_new_entry($entry,$level,IMGDIR.'/tree_corner.png');
|
||||
|
||||
return $output;
|
||||
}
|
||||
@@ -282,7 +273,7 @@ class AJAXTree extends HTMLTree {
|
||||
$output .= ' ';
|
||||
|
||||
if (isAjaxEnabled())
|
||||
$output .= sprintf('<a href="cmd.php?%s" title="%s" class="phplm" onclick="return displayAJ(\'BODY\',\'%s\',\'%s\');">',
|
||||
$output .= sprintf('<a href="cmd.php?%s" title="%s" class="phplm" onclick="return ajDISPLAY(\'BODY\',\'%s\',\'%s\');">',
|
||||
htmlspecialchars($href),_('Create new entry here'),
|
||||
htmlspecialchars($href),_('Loading'));
|
||||
else
|
||||
|
@@ -715,7 +715,7 @@ class Attribute {
|
||||
switch ($index) {
|
||||
# Helpers should be accompanied with a <post> attribute.
|
||||
case 'helper':
|
||||
if (! isset($values['post']))
|
||||
if (! isset($values['post']) && ! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))
|
||||
system_message(array(
|
||||
'title'=>sprintf('%s [<i>%s</i>]',_('Missing [post] setting in XML file'),$index),
|
||||
'body'=>_('[helper] needs an accompanying [post] action.'),
|
||||
@@ -730,10 +730,11 @@ class Attribute {
|
||||
|
||||
foreach ($value as $i => $detail) {
|
||||
if (! in_array($i,array('default','display','id','value'))) {
|
||||
system_message(array(
|
||||
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown XML setting'),$i),
|
||||
'body'=>sprintf('%s <small>[%s]</small>',_('Unknown XML type setting for helper will be ignored.'),$detail),
|
||||
'type'=>'warn'));
|
||||
if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))
|
||||
system_message(array(
|
||||
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown XML setting'),$i),
|
||||
'body'=>sprintf('%s <small>[%s]</small>',_('Unknown XML type setting for helper will be ignored.'),$detail),
|
||||
'type'=>'warn'));
|
||||
|
||||
unset($value[$i]);
|
||||
}
|
||||
@@ -751,7 +752,7 @@ class Attribute {
|
||||
|
||||
# Essentially, we ignore type, it is used to select an Attribute type in the Factory. But we'll generated a warning if there is an unknown type.
|
||||
case 'type':
|
||||
if (! in_array($value,array('password','multiselect','select','textarea')))
|
||||
if (! in_array($value,array('password','multiselect','select','textarea')) && ! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))
|
||||
system_message(array(
|
||||
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown XML setting'),$index),
|
||||
'body'=>sprintf('%s <small>[%s]</small>',_('Unknown XML type setting will be ignored.'),$value),
|
||||
@@ -765,10 +766,11 @@ class Attribute {
|
||||
$this->postvalue['args'] = $matches[2];
|
||||
|
||||
} else
|
||||
system_message(array(
|
||||
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown XML setting'),$index),
|
||||
'body'=>sprintf('%s <small>[%s]</small>',_('Unknown XML type setting will be ignored.'),$value),
|
||||
'type'=>'warn'));
|
||||
if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))
|
||||
system_message(array(
|
||||
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown XML setting'),$index),
|
||||
'body'=>sprintf('%s <small>[%s]</small>',_('Unknown XML type setting will be ignored.'),$value),
|
||||
'type'=>'warn'));
|
||||
|
||||
case 'value':
|
||||
if (is_array($value))
|
||||
@@ -809,11 +811,16 @@ class Attribute {
|
||||
case 'verify': $this->$index = $value;
|
||||
break;
|
||||
|
||||
case 'max':
|
||||
if ($this->getMaxValueCount() == -1)
|
||||
$this->setMaxValueCount($value);
|
||||
|
||||
default:
|
||||
system_message(array(
|
||||
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown XML setting'),$index),
|
||||
'body'=>sprintf('%s <small>[%s]</small>',_('Unknown attribute setting will be ignored.'),serialize($value)),
|
||||
'type'=>'warn'));
|
||||
if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))
|
||||
system_message(array(
|
||||
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown XML setting'),$index),
|
||||
'body'=>sprintf('%s <small>[%s]</small>',_('Unknown attribute setting will be ignored.'),serialize($value)),
|
||||
'type'=>'warn'));
|
||||
}
|
||||
|
||||
elseif (is_string($values) && (strlen($values) > 0))
|
||||
|
@@ -25,10 +25,11 @@ class AttributeFactory {
|
||||
break;
|
||||
|
||||
default:
|
||||
system_message(array(
|
||||
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown template [post] function'),$matches[1]),
|
||||
'body'=>sprintf('%s <small>[%s]</small>',_('The template function is not known and will be ignored.'),$values['post']),
|
||||
'type'=>'warn'));
|
||||
if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))
|
||||
system_message(array(
|
||||
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown template [post] function'),$matches[1]),
|
||||
'body'=>sprintf('%s <small>[%s]</small>',_('The template function is not known and will be ignored.'),$values['post']),
|
||||
'type'=>'warn'));
|
||||
|
||||
unset($values['post']);
|
||||
}
|
||||
@@ -39,10 +40,11 @@ class AttributeFactory {
|
||||
if (isset($values['helper']['value']) && ! is_array($values['helper']['value']))
|
||||
if (preg_match('/^=php\.(\w+)\((.*)\)$/',$values['helper']['value'],$matches))
|
||||
if (! in_array($matches[1],array('GetNextNumber','PasswordEncryptionTypes'))) {
|
||||
system_message(array(
|
||||
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown template helper function'),$matches[1]),
|
||||
'body'=>sprintf('%s <small>[%s]</small>',_('The template helper function is not known and will be ignored.'),$values['helper']['value']),
|
||||
'type'=>'warn'));
|
||||
if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))
|
||||
system_message(array(
|
||||
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown template helper function'),$matches[1]),
|
||||
'body'=>sprintf('%s <small>[%s]</small>',_('The template helper function is not known and will be ignored.'),$values['helper']['value']),
|
||||
'type'=>'warn'));
|
||||
|
||||
unset($values['helper']['value']);
|
||||
}
|
||||
@@ -67,10 +69,11 @@ class AttributeFactory {
|
||||
break;
|
||||
|
||||
default:
|
||||
system_message(array(
|
||||
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown template function'),$matches[1]),
|
||||
'body'=>sprintf('%s <small>[%s]</small>',_('The template function is not known and will be ignored.'),$values['value']),
|
||||
'type'=>'warn'));
|
||||
if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))
|
||||
system_message(array(
|
||||
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown template function'),$matches[1]),
|
||||
'body'=>sprintf('%s <small>[%s]</small>',_('The template function is not known and will be ignored.'),$values['value']),
|
||||
'type'=>'warn'));
|
||||
|
||||
unset($values['value']);
|
||||
}
|
||||
|
@@ -308,7 +308,7 @@ class HTMLTree extends Tree {
|
||||
$href_parms = htmlspecialchars(sprintf('cmd=%s&server_id=%s%s',$menu['cmd'],$server->getIndex(),isset($menu['href']) ? $menu['href'] : ''));
|
||||
|
||||
if (isAjaxEnabled())
|
||||
return sprintf('<a href="cmd.php?%s" onclick="return displayAJ(\'%s\',\'%s\',\'%s\');" title="%s %s"><img src="%s/%s" alt="%s" /><br />%s</a>',
|
||||
return sprintf('<a href="cmd.php?%s" onclick="return ajDISPLAY(\'%s\',\'%s\',\'%s\');" title="%s %s"><img src="%s/%s" alt="%s" /><br />%s</a>',
|
||||
$href_parms,$menu['div'],$href_parms,$menu['ajax'],$menu['title'],$server->getName(),IMGDIR,$menu['img'],$menu['name'],$menu['name']);
|
||||
else
|
||||
return sprintf('<a href="cmd.php?%s" title="%s %s"><img src="%s/%s" alt="%s" /><br />%s</a>',
|
||||
@@ -513,9 +513,9 @@ class HTMLTree extends Tree {
|
||||
echo '<tr class="option"><td class="spacer"></td>';
|
||||
|
||||
if (isAjaxEnabled()) {
|
||||
printf('<td class="icon"><a href="cmd.php?%s" onclick="return displayAJ(\'BODY\',\'%s\',\'%s\');" title="%s %s"><img src="%s/%s" alt="%s" /></a></td>',
|
||||
printf('<td class="icon"><a href="cmd.php?%s" onclick="return ajDISPLAY(\'BODY\',\'%s\',\'%s\');" title="%s %s"><img src="%s/%s" alt="%s" /></a></td>',
|
||||
$href_parm,$href_parm,_('Loading Login'),_('Login to'),$server->getName(),IMGDIR,'login.png',_('login'));
|
||||
printf('<td class="logged_in" colspan="%s"><a href="cmd.php?%s" onclick="return displayAJ(\'BODY\',\'%s\',\'%s\');" title="%s %s">%s</a></td>',
|
||||
printf('<td class="logged_in" colspan="%s"><a href="cmd.php?%s" onclick="return ajDISPLAY(\'BODY\',\'%s\',\'%s\');" title="%s %s">%s</a></td>',
|
||||
$this->getDepth()+3-2,$href_parm,$href_parm,_('Loading Login'),_('Login to'),$server->getName(),_('login'));
|
||||
|
||||
} else {
|
||||
|
@@ -474,7 +474,7 @@ class PageRender extends Visitor {
|
||||
|
||||
# Is there a hint for this attribute
|
||||
if ($attribute->getHint())
|
||||
return sprintf('<acronym title="%s">%s</acronym>',$attribute->getHint(),_('hint'));
|
||||
return sprintf('<acronym title="%s">%s</acronym>',_($attribute->getHint()),_('hint'));
|
||||
else
|
||||
return '';
|
||||
}
|
||||
@@ -702,7 +702,7 @@ class PageRender extends Visitor {
|
||||
$val = $attribute->getValue($i);
|
||||
|
||||
echo '<span style="white-space: nowrap;">';
|
||||
printf('<input type="text" class="value" id="f_date_%s_%s" name="new_values[%s][%s]" value="%s" %s%s %s %s/> ',
|
||||
printf('<input type="text" class="value" id="new_values_%s_%s" name="new_values[%s][%s]" value="%s" %s%s %s %s/> ',
|
||||
$attribute->getName(),$i,
|
||||
htmlspecialchars($attribute->getName()),$i,htmlspecialchars($val),
|
||||
$attribute->needJS('focus') ? sprintf('onFocus="focus_%s(this);" ',$attribute->getName()) : '',
|
||||
|
@@ -80,6 +80,7 @@ class QueryRender extends PageRender {
|
||||
$baseDNs = $server->getBaseDN();
|
||||
|
||||
echo '<center>';
|
||||
printf('<script type="text/javascript" language="javascript" src="%sdnChooserPopup.js"></script>',JSDIR);
|
||||
echo '<form action="cmd.php" name="advanced_search_form">';
|
||||
echo '<input type="hidden" name="cmd" value="query_engine" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$server->getIndex());
|
||||
@@ -233,41 +234,6 @@ class QueryRender extends PageRender {
|
||||
);
|
||||
}
|
||||
|
||||
# Display the Javascript that enables us to show/hide DV entries
|
||||
echo '<script type="text/javascript" language="javascript">';
|
||||
echo "
|
||||
function showthis(key,item) {
|
||||
select = document.getElementById(key+item);
|
||||
if (select.style.display == '')
|
||||
return false;
|
||||
|
||||
hideall(key,item);
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
function hideall(key,except) {
|
||||
items = items();
|
||||
for (x in items) {
|
||||
if (! isNaN(x) && except != items[x]) {
|
||||
item = document.getElementById(key+items[x]);
|
||||
item.style.display = 'none';
|
||||
item = document.getElementById('CTL'+items[x]);
|
||||
item.style.background = '#E0E0E0';
|
||||
|
||||
} else if (! isNaN(x) && except == items[x]) {
|
||||
item = document.getElementById(key+items[x]);
|
||||
item.style.display = '';
|
||||
item = document.getElementById('CTL'+items[x]);
|
||||
item.style.background = '#F0F0F0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
";
|
||||
echo '</script>';
|
||||
echo "\n\n";
|
||||
|
||||
$this->drawBaseTabs();
|
||||
$ado = $this->template->getAttrDisplayOrder();
|
||||
$counter = 0;
|
||||
@@ -434,7 +400,7 @@ function hideall(key,except) {
|
||||
# Is mass action enabled.
|
||||
if ($_SESSION[APPCONFIG]->getValue('mass','enabled')) {
|
||||
printf('<tr class="%s">',++$j%2 ? 'odd' : 'even');
|
||||
printf('<td><input type="checkbox" name="allbox" value="1" onclick="CheckAll(1,%s);" /></td>',$counter);
|
||||
printf('<td><input type="checkbox" name="allbox" value="1" onclick="CheckAll(1,\'massform_\',%s);" /></td>',$counter);
|
||||
printf('<td colspan=%s>',2+count(explode(',',$ado)));
|
||||
echo '<select name="cmd" onChange="if (this.value) submit();" style="font-size: 12px">';
|
||||
|
||||
@@ -463,31 +429,8 @@ function hideall(key,except) {
|
||||
echo "\n\n";
|
||||
}
|
||||
|
||||
if (get_request('format','REQUEST',false,'table') == 'table') {
|
||||
echo '<script type="text/javascript" language="javascript">'."\n";
|
||||
echo "
|
||||
function CheckAll(setbgcolor,form) {
|
||||
htmlform = document.getElementById('massform_'+form);
|
||||
|
||||
for (var i=0;i<htmlform.elements.length;i++) {
|
||||
var e = htmlform.elements[i];
|
||||
if (e.type == 'checkbox' && e.name != 'allbox') {
|
||||
e.checked = htmlform.allbox.checked;
|
||||
if (!document.layers && setbgcolor) {
|
||||
var tr = document.getElementById('tr_'+e.id);
|
||||
if (e.checked) {
|
||||
tr.style.backgroundColor='#DDDDFF';
|
||||
} else {
|
||||
var id = e.id.substr(3);
|
||||
tr.style.backgroundColor= id%2 ? '#E0E0E0' : '#F0F0F0';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
";
|
||||
echo '</script>';
|
||||
}
|
||||
if (get_request('format','REQUEST',false,'table') == 'table')
|
||||
printf('<script type="text/javascript" language="javascript" src="%sCheckAll.js"></script>',JSDIR);
|
||||
}
|
||||
|
||||
public function drawSubTitle($subtitle=null) {
|
||||
@@ -546,7 +489,7 @@ function CheckAll(setbgcolor,form) {
|
||||
if (! $show = get_request('show','REQUEST'))
|
||||
$show = ($counter++ === 0 ? $this->getAjaxRef($base) : null);
|
||||
|
||||
printf('<td id="CTL%s" onclick="return showthis(\'DN\',\'%s\');" style="background-color: %s;">%s</td>',
|
||||
printf('<td id="CTL%s" onclick="return ajSHOWTHIS(\'DN\',\'%s\',\'CTL\');" style="background-color: %s;">%s</td>',
|
||||
$this->getAjaxRef($base),
|
||||
$this->getAjaxRef($base),
|
||||
($show == $this->getAjaxRef($base) ? '#F0F0F0' : '#E0E0E0'),
|
||||
@@ -588,7 +531,7 @@ function CheckAll(setbgcolor,form) {
|
||||
$query_string = htmlspecialchars(sprintf('%s&format=%s&show=%s&focusbase=%s',array_to_query_string($_GET,array('format','meth')),$f,$this->getAjaxRef($base),$base));
|
||||
|
||||
if (isAjaxEnabled())
|
||||
printf('<a href="cmd.php?%s" onclick="return displayAJ(\'BODY\',\'%s\',\'%s\');">%s</a>',
|
||||
printf('<a href="cmd.php?%s" onclick="return ajDISPLAY(\'BODY\',\'%s\',\'%s\');">%s</a>',
|
||||
$query_string,$query_string,_('Loading Search'),_($f));
|
||||
else
|
||||
printf('<a href="cmd.php?%s">%s</a>',$query_string,_($f));
|
||||
|
@@ -45,6 +45,8 @@ class Template extends xmlTemplate {
|
||||
private $dn;
|
||||
# Where this template will store its data
|
||||
protected $container;
|
||||
# Does this template prohibit children being created
|
||||
private $noleaf = false;
|
||||
# A regexp that determines if this template is valid in the container.
|
||||
private $regexp;
|
||||
# Template Title
|
||||
@@ -54,6 +56,14 @@ class Template extends xmlTemplate {
|
||||
# Template RDN attributes
|
||||
private $rdn;
|
||||
|
||||
public function __construct($server_id,$name=null,$filename=null,$type=null,$id=null) {
|
||||
parent::__construct($server_id,$name,$filename,$type,$id);
|
||||
|
||||
# If this is the default template, we might disable leafs by default.
|
||||
if (is_null($filename))
|
||||
$this->noleaf = $_SESSION[APPCONFIG]->getValue('appearance','disable_default_leaf');
|
||||
}
|
||||
|
||||
public function __clone() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
@@ -1113,7 +1123,7 @@ class Template extends xmlTemplate {
|
||||
$sattr = $this->getServer()->getSchemaAttribute($checkattr);
|
||||
|
||||
# If the attribute is the same as in the XML file, then dont need to do anything.
|
||||
if (! strcasecmp($sattr->getName(),$checkattr))
|
||||
if (! $sattr || ! strcasecmp($sattr->getName(),$checkattr))
|
||||
continue;
|
||||
|
||||
$formula = preg_replace("/$checkattr/",$sattr->getName(),$formula);
|
||||
@@ -1501,5 +1511,9 @@ class Template extends xmlTemplate {
|
||||
masort($attributes,'name');
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
public function isNoLeaf() {
|
||||
return $this->noleaf;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -56,7 +56,7 @@ class TemplateRender extends PageRender {
|
||||
$this->layout['hint'] = sprintf('<td class="icon"><img src="%s/light.png" alt="%s" /></td><td colspan="3"><span class="hint">%%s</span></td>',
|
||||
IMGDIR,_('Hint'));
|
||||
$this->layout['action'] = '<td class="icon"><img src="%s/%s" alt="%s" /></td><td><a href="cmd.php?%s" title="%s">%s</a></td>';
|
||||
$this->layout['actionajax'] = '<td class="icon"><img src="%s/%s" alt="%s" /></td><td><a href="cmd.php?%s" title="%s" onclick="return displayAJ(\'BODY\',\'%s\',\'%s\');">%s</a></td>';
|
||||
$this->layout['actionajax'] = '<td class="icon"><img src="%s/%s" alt="%s" /></td><td><a href="cmd.php?%s" title="%s" onclick="return ajDISPLAY(\'BODY\',\'%s\',\'%s\');">%s</a></td>';
|
||||
|
||||
# If we dont want to render this template automatically, we'll return here.
|
||||
if ($norender)
|
||||
@@ -227,10 +227,11 @@ class TemplateRender extends PageRender {
|
||||
break;
|
||||
|
||||
/**
|
||||
* PickList will query the LDAP server and provide a select list of values
|
||||
* MultiList will query the LDAP server and provide a multi select list of values
|
||||
* eg: <![CDATA[=php.MultiList(/;(objectClass=posixAccount);uid)]]>
|
||||
*
|
||||
* eg: <![CDATA[=php.MultiList(/;(&(objectClass=posixAccount)(uid=groupA*));uid;%cn/U% (%gidNumber%);memberUid;dmdName=users,root => cn=root;nobody => cn=nobody;gidNumber;10;(gidNuber=%gidNumber%);uid)]]>
|
||||
* eg: <![CDATA[=php.MultiList(/;(&(objectClass=posixAccount)(uid=groupA*));uid;%cn/U% (%gidNumber%);memberUid;dmdName=users;root => cn=root,nobody => cn=nobody;gidNumber;10)]]>
|
||||
*
|
||||
* Mandatory Arguments:
|
||||
* * arg 0
|
||||
@@ -255,38 +256,26 @@ class TemplateRender extends PageRender {
|
||||
* - container override
|
||||
*
|
||||
* * arg 6
|
||||
* - csv list (, separator) of added values. syntax: key => display_attribute=value; key...
|
||||
* - csv list (, separator) of added values. syntax: key => display_attribute=value, key...
|
||||
*
|
||||
* * arg 7
|
||||
* - csv list (, separator) of sort attributes (less to more important)
|
||||
*
|
||||
* * arg 8
|
||||
* * arg 8 (for MultiList)
|
||||
* - size of displayed list (default: 10 lines)
|
||||
*
|
||||
* * arg 9
|
||||
* - preselected values filter. see arg 1.
|
||||
*
|
||||
* * arg 10
|
||||
* - key of preselected values. replaced by arg 4 if not given. replaced by arg 2 if both are not given.
|
||||
*
|
||||
* * arg 11
|
||||
* - base dn override for preselected values
|
||||
*
|
||||
* @todo This could probably be merged with PickList
|
||||
*/
|
||||
case 'MultiList':
|
||||
$args[2] = strtolower($args[2]);
|
||||
|
||||
case 'PickList':
|
||||
# arg5 overrides our container
|
||||
if (empty($args[5]))
|
||||
$container = $server->getContainerPath($container,$args[0]);
|
||||
else
|
||||
$container = $args[5];
|
||||
|
||||
# Process filter (arg 1), eventually replace %attr% by it's value setted in a previous page.
|
||||
# Process filter (arg 1), eventually replace %attr% by it's value set in a previous page.
|
||||
preg_match_all('/%(\w+)(\|.+)?(\/[lUC])?%/U',$args[1],$filtermatchall);
|
||||
//print_r($matchall); // -1 = highlevel match, 1 = attr, 2 = subst, 3 = mod
|
||||
|
||||
# @todo this section needs to be validated/tested
|
||||
if (isset($_REQUEST['form'])) {
|
||||
$formvalues = array_change_key_case($_REQUEST['form']);
|
||||
|
||||
@@ -296,17 +285,18 @@ class TemplateRender extends PageRender {
|
||||
}
|
||||
}
|
||||
|
||||
$args[3] = ! empty($args[3]) ? $args[3] : "%{$args[2]}%";
|
||||
if (empty($args[3]))
|
||||
$args[3] = "%{$args[2]}%";
|
||||
|
||||
preg_match_all('/%(\w+)(\|.+)?(\/[lUC])?%/U',$args[3],$matchall);
|
||||
//print_r($matchall); // -1 = highlevel match, 1 = attr, 2 = subst, 3 = mod
|
||||
|
||||
$attrs = array_unique(array_merge($matchall[1],array($args[2])));
|
||||
|
||||
# arg7 is sort attributes
|
||||
# arg7 is sort attributes
|
||||
if (isset($args[7])) {
|
||||
$sort_attrs = explode(',',$args[7]);
|
||||
$attrs = array_merge($attrs,$sort_attrs);
|
||||
$attrs = array_unique(array_merge($attrs,$sort_attrs));
|
||||
}
|
||||
|
||||
$picklistvalues = return_ldap_hash($container,$args[1],$args[2],$attrs,(isset($args[7]) && ($args[7])) ? $sort_attrs : false);
|
||||
@@ -322,31 +312,12 @@ class TemplateRender extends PageRender {
|
||||
$fixedvalue = preg_split('/=\>/',$fixedvalue);
|
||||
$displayvalue = explode('=',$fixedvalue[1]);
|
||||
|
||||
$newvalue[trim($fixedvalue[0])] = array($args[2]=>trim($fixedvalue[0]),
|
||||
trim($displayvalue[0])=>trim($displayvalue[1]));
|
||||
$newvalue[trim($fixedvalue[0])] = array($args[2]=>trim($fixedvalue[0]),trim($displayvalue[0])=>trim($displayvalue[1]));
|
||||
|
||||
$picklistvalues = array_merge($picklistvalues,$newvalue);
|
||||
}
|
||||
}
|
||||
|
||||
/* arg 9 is the search filter for already selected values, with criteriai eventually
|
||||
coming from previous pages (eg: %uid%) */
|
||||
if (isset($args[9])) {
|
||||
preg_match_all('/%(\w+)(\|.+)?(\/[lUC])?%/U',$args[9],$matchallinlist);
|
||||
|
||||
foreach ($matchallinlist[1] as $arg) {
|
||||
$value=$formvalues[strtolower($arg)];
|
||||
|
||||
$args[9] = preg_replace('/%('.$arg.')(\|.+)?(\/[lU])?%/U',$value,$args[9]);
|
||||
}
|
||||
|
||||
# arg11 overrides container dn for selected values
|
||||
if (! empty($args[11]))
|
||||
$container = $args[11];
|
||||
|
||||
$inpicklistvalues = return_ldap_hash($container,$args[9],$args[2],$attrs);
|
||||
}
|
||||
|
||||
$vals = array();
|
||||
|
||||
foreach ($picklistvalues as $key => $values) {
|
||||
@@ -429,95 +400,6 @@ class TemplateRender extends PageRender {
|
||||
|
||||
break;
|
||||
|
||||
/**
|
||||
* PickList will query the LDAP server and provide a select list of values
|
||||
* eg: <![CDATA[=php.PickList(/;(&(objectClass=posixGroup));gidNumber;%cn%)]]>
|
||||
*
|
||||
* eg: <![CDATA[=php.PickList(/;(&(objectClass=sambaGroupMapping)(|(cn=domain administrator)(cn=domain users)(cn=domain guests)))|sambaSID|%cn% (%sambaSID%)|sambaPrimaryGroupSID|dmdname=users,dmdName=groups,dc=example,dc=com|S-1-5-XX-YYY => cn=Administrators,S-1-5-XX-YYY => cn=Users,S-1-5-XX-YYY => cn=Guests,S-1-5-XX-YYY => cn=power users|cn)]]>
|
||||
*
|
||||
* Mandatory Arguments:
|
||||
* * arg 0
|
||||
* - container, to query from current position
|
||||
* - "/",".",".." => get container parent as usual
|
||||
*
|
||||
* * arg 1
|
||||
* - LDAP filter.
|
||||
*
|
||||
* * arg2
|
||||
* - list attribute key
|
||||
*
|
||||
* * arg3
|
||||
* - select display
|
||||
*
|
||||
* Optional Arguments:
|
||||
* * arg4
|
||||
* - output attribute
|
||||
*
|
||||
* * arg5
|
||||
* - container override
|
||||
*
|
||||
* * arg6
|
||||
* - csv list (, separator) of added values. syntax: key => display_attribute=value; key...
|
||||
*
|
||||
* * arg7
|
||||
* - csv list (, separator) of sort attributes (less to more important)
|
||||
*/
|
||||
case 'PickList':
|
||||
$args[2] = strtolower($args[2]);
|
||||
|
||||
# arg5 overrides our container
|
||||
if (empty($args[5]))
|
||||
$container = $server->getContainerPath($container,$args[0]);
|
||||
else
|
||||
$container = $args[5];
|
||||
|
||||
# Extract the attributes to use in the display
|
||||
preg_match_all('/%(\w+)(\|.+)?(\/[lU])?%/U',$args[3],$matchall);
|
||||
//print_r($matchall); // -1 = highlevel match, 1 = attr, 2 = subst, 3 = mod
|
||||
|
||||
$attrs = array_unique(array_merge($matchall[1],array($args[2])));
|
||||
|
||||
# The query results are sorted by arg7
|
||||
if (! empty($args[7])) {
|
||||
$sort_attrs = explode(',',$args[7]);
|
||||
$attrs = array_merge($attrs,$sort_attrs);
|
||||
}
|
||||
|
||||
$picklistvalues = return_ldap_hash($container,$args[1],$args[2],$attrs,(isset($args[7]) && ($args[7])) ? $sort_attrs : false);
|
||||
|
||||
if (! empty($args[6])) {
|
||||
$fixedvalues = explode(',',$args[6]);
|
||||
|
||||
foreach ($fixedvalues as $fixedvalue) {
|
||||
$fixedvalue = preg_split('/=\>/',$fixedvalue);
|
||||
$displayvalue = explode('=',$fixedvalue[1]);
|
||||
|
||||
$newvalue[trim($fixedvalue[0])] = array($args[2]=>trim($fixedvalue[0]),
|
||||
trim($displayvalue[0])=>trim($displayvalue[1]));
|
||||
|
||||
$picklistvalues = array_merge($picklistvalues,$newvalue);
|
||||
}
|
||||
}
|
||||
|
||||
$vals = array();
|
||||
|
||||
foreach ($picklistvalues as $key => $values) {
|
||||
$display = $args[3];
|
||||
|
||||
foreach ($matchall[1] as $arg)
|
||||
if (isset($values[$arg]))
|
||||
$display = preg_replace("/%($arg)(\|.+)?(\/[lU])?%/U",$values[$arg],$display);
|
||||
else
|
||||
$display = preg_replace("/%($arg)(\|.+)?(\/[lU])?%/U",'',$display);
|
||||
|
||||
if (! isset($picklist[$values[$args[2]]])) {
|
||||
$vals[$values[$args[2]]] = $display;
|
||||
$picklist[$display] = true;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
/**
|
||||
* RandomPassword will create a random password for the value.
|
||||
* eg: =php.RandomPassword()
|
||||
@@ -657,7 +539,7 @@ class TemplateRender extends PageRender {
|
||||
|
||||
else {
|
||||
if (isAjaxEnabled())
|
||||
printf('<td><input type="radio" name="template" value="%s" id="%s" onclick="return displayAJ(\'BODY\',\'%s&template=%s\',\'%s\');" /></td>',
|
||||
printf('<td><input type="radio" name="template" value="%s" id="%s" onclick="return ajDISPLAY(\'BODY\',\'%s&template=%s\',\'%s\');" /></td>',
|
||||
htmlspecialchars($details->getID()),htmlspecialchars($details->getID()),htmlspecialchars($href_parms),$details->getID(),_('Retieving DN'));
|
||||
else
|
||||
printf('<td><input type="radio" name="template" value="%s" id="%s" onclick="document.forms.template_choice_form.submit()" /></td>',
|
||||
@@ -694,7 +576,7 @@ class TemplateRender extends PageRender {
|
||||
|
||||
echo '<tr>';
|
||||
if (isAjaxEnabled())
|
||||
printf('<td><input type="radio" name="template" value="none" id="none" onclick="return displayAJ(\'BODY\',\'%s&template=%s\',\'%s\');" /></td>',
|
||||
printf('<td><input type="radio" name="template" value="none" id="none" onclick="return ajDISPLAY(\'BODY\',\'%s&template=%s\',\'%s\');" /></td>',
|
||||
htmlspecialchars($href_parms),'none',_('Retieving DN'));
|
||||
else
|
||||
echo '<td><input type="radio" name="template" value="none" id="none" onclick="document.forms.template_choice_form.submit()" /></td>';
|
||||
@@ -1018,7 +900,7 @@ class TemplateRender extends PageRender {
|
||||
return '';
|
||||
|
||||
case 'childcreate':
|
||||
if ($_SESSION[APPCONFIG]->isCommandAvailable('script','create') && ! $this->template->isReadOnly())
|
||||
if ($_SESSION[APPCONFIG]->isCommandAvailable('script','create') && ! $this->template->isReadOnly() && ! $this->template->isNoLeaf())
|
||||
return $this->getMenuItemCreate();
|
||||
else
|
||||
return '';
|
||||
@@ -1308,7 +1190,7 @@ class TemplateRender extends PageRender {
|
||||
return '';
|
||||
|
||||
$href = sprintf('cmd=add_attr_form&%s',$this->url_base);
|
||||
$layout = '<td class="icon"><img src="%s/%s" alt="%s" /></td><td><a href="cmd.php?%s" title="%s" onclick="getDiv(\'ADD\').style.display = \'block\';return displayAJ(\'ADD\',\'%s\',\'%s\');">%s</a></td>';
|
||||
$layout = '<td class="icon"><img src="%s/%s" alt="%s" /></td><td><a href="cmd.php?%s" title="%s" onclick="getDiv(\'ADD\').style.display = \'block\';return ajDISPLAY(\'ADD\',\'%s\',\'%s\');">%s</a></td>';
|
||||
|
||||
if (isAjaxEnabled())
|
||||
return sprintf($layout,IMGDIR,'add.png',_('Add'),
|
||||
@@ -1674,7 +1556,9 @@ class TemplateRender extends PageRender {
|
||||
printf('<!-- START: %s -->',__METHOD__);
|
||||
echo "\n";
|
||||
|
||||
printf('<script type="text/javascript" language="javascript" src="%stemplaterender.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" language="javascript" src="%sTemplateRender.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" language="javascript" src="%stoAscii.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" language="javascript" src="%sdnChooserPopup.js"></script>',JSDIR);
|
||||
echo "\n";
|
||||
|
||||
printf('<!-- START: MAIN FORM VALIDATION: %s -->',__METHOD__);
|
||||
@@ -1712,23 +1596,15 @@ function validateForm(silence) {
|
||||
|
||||
$this->drawTemplateJavascript();
|
||||
|
||||
# If we have a DateAttribute, we need to set some defaults for the js_calendar.
|
||||
if (isset($_SESSION[APPCONFIG])) {
|
||||
foreach ($this->template->getAttributesShown() as $attribute) {
|
||||
if (array_key_exists($attribute->getName(),array_change_key_case($_SESSION[APPCONFIG]->getValue('appearance','date_attrs')))) {
|
||||
echo '<!-- START: GLOBAL SETTINGS FOR THE js_calendar -->'."\n";
|
||||
echo '<script type="text/javascript" language="javascript">'."\n";
|
||||
echo 'var defaults = new Array();'."\n";
|
||||
printf('var default_date_format = "%s";',$_SESSION[APPCONFIG]->getValue('appearance','date'));
|
||||
echo "\n";
|
||||
echo '</script>'."\n";
|
||||
echo '<!-- END: GLOBAL SETTINGS FOR THE js_calendar -->'."\n";
|
||||
echo "\n";
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
# For DateAttributes, we need to set some defaults for the js_calendar.
|
||||
echo '<!-- START: GLOBAL SETTINGS FOR THE js_calendar -->'."\n";
|
||||
echo '<script type="text/javascript" language="javascript">'."\n";
|
||||
echo 'var defaults = new Array();'."\n";
|
||||
printf('var default_date_format = "%s";',$_SESSION[APPCONFIG]->getValue('appearance','date'));
|
||||
echo "\n";
|
||||
echo '</script>'."\n";
|
||||
echo '<!-- END: GLOBAL SETTINGS FOR THE js_calendar -->'."\n";
|
||||
echo "\n";
|
||||
|
||||
foreach ($this->template->getAttributesShown() as $attribute)
|
||||
$this->draw('Javascript',$attribute);
|
||||
@@ -1981,9 +1857,10 @@ function fillRec(id,value) {
|
||||
}
|
||||
|
||||
echo '// validate'."\n";
|
||||
printf('function validate_%s(component,silence) {',$attribute->getName());
|
||||
echo "\n";
|
||||
|
||||
if ($attribute->needJS('validate')) {
|
||||
printf('function validate_%s(component,silence) {',$attribute->getName());
|
||||
echo "\n";
|
||||
echo ' var valid = true;';
|
||||
echo "\n";
|
||||
$this->draw('ValidateJavascript',$attribute,'component','silence','valid');
|
||||
@@ -1991,9 +1868,13 @@ function fillRec(id,value) {
|
||||
echo ' if (valid) { component.style.backgroundColor = "white"; component.style.color = "black"; }';
|
||||
echo ' else { component.style.backgroundColor = \'#FFFFA0\'; component.style.color = "black"; }';
|
||||
echo ' return valid;';
|
||||
echo '}'."\n";
|
||||
|
||||
} else {
|
||||
echo ' return true;'."\n";
|
||||
}
|
||||
|
||||
echo '}'."\n";
|
||||
|
||||
echo '</script>'."\n";
|
||||
|
||||
printf('<!-- END: ATTRIBUTE %s (%s)-->',__METHOD__,$attribute->getName());
|
||||
@@ -2031,7 +1912,7 @@ function fillRec(id,value) {
|
||||
|
||||
protected function drawFillJavascriptAttribute($attribute,$component_id,$component_value) {
|
||||
if ($attribute->needJS('validate'))
|
||||
printf("\tvalidate_%s(pla_getComponentById(%s),false);\n",$attribute->getName(),$component_id);
|
||||
printf("\tvalidate_%s(pla_getComponentById(%s),true);\n",$attribute->getName(),$component_id);
|
||||
}
|
||||
|
||||
protected function drawValidateJavascriptAttribute($attribute,$component,$silence,$var_valid) {
|
||||
@@ -2117,7 +1998,7 @@ function fillRec(id,value) {
|
||||
$this->getServerID(),rawurlencode($this->template->getDN()),rawurlencode($attribute->getName(false))));
|
||||
|
||||
if (isAjaxEnabled())
|
||||
return sprintf('(<a href="cmd.php?%s" title="%s %s" onclick="return displayAJ(\'ADDVALUE%s\',\'%s&raw=1\',\'%s\');">%s</a>)',
|
||||
return sprintf('(<a href="cmd.php?%s" title="%s %s" onclick="return ajDISPLAY(\'ADDVALUE%s\',\'%s&raw=1\',\'%s\');">%s</a>)',
|
||||
$href_parm,_('Add an additional value to attribute'),$attribute->getName(false),$attribute->getName(),
|
||||
$href_parm,_('Add Value to Attribute'),_('add value'));
|
||||
else
|
||||
@@ -2135,7 +2016,7 @@ function fillRec(id,value) {
|
||||
$this->getServerID(),rawurlencode($this->template->getDN()),rawurlencode($attribute->getName()));
|
||||
|
||||
if (isAjaxEnabled())
|
||||
return sprintf('(<a href="cmd.php?%s" title="%s: %s" onclick="return displayAJ(\'BODY\',\'%s\',\'%s\');">%s</a>)',
|
||||
return sprintf('(<a href="cmd.php?%s" title="%s: %s" onclick="return ajDISPLAY(\'BODY\',\'%s\',\'%s\');">%s</a>)',
|
||||
htmlspecialchars($href),_('Modify members for'),$this->template->getDN(),
|
||||
htmlspecialchars($href),_('Modify group membership'),
|
||||
_('modify group members'));
|
||||
@@ -2356,7 +2237,7 @@ function deleteAttribute(attrName,friendlyName,i)
|
||||
$config['format'] = $config['date'][$attribute->getName()];
|
||||
|
||||
for ($i=0;$i<=$attribute->getValueCount();$i++) {
|
||||
printf('<script type="text/javascript" language="javascript">defaults[\'f_date_%s_%s\'] = \'%s\';</script>',$attribute->getName(),$i,$config['format']);
|
||||
printf('<script type="text/javascript" language="javascript">defaults[\'new_values_%s_%s\'] = \'%s\';</script>',$attribute->getName(),$i,$config['format']);
|
||||
|
||||
if (in_array_ignore_case($attribute->getName(),array_keys($config['time'])) && ($config['time'][$attribute->getName()]))
|
||||
printf('<script type="text/javascript" language="javascript">defaults[\'f_time_%s_%s\'] = \'%s\';</script>',$attribute->getName(),$i,'true');
|
||||
@@ -2490,8 +2371,8 @@ function deleteAttribute(attrName,friendlyName,i)
|
||||
$id,htmlspecialchars($attribute->getName()),$i,
|
||||
$id,htmlspecialchars($attribute->getName()),$i);
|
||||
|
||||
foreach (password_types() as $v)
|
||||
printf('<option value="%s" %s>%s</option>',$v,($v == $default) ? 'selected' : '',$v);
|
||||
foreach (password_types() as $v => $display)
|
||||
printf('<option value="%s" %s>%s</option>',$v,($v == $default) ? 'selected' : '',$display);
|
||||
|
||||
echo '</select>';
|
||||
}
|
||||
|
@@ -301,6 +301,8 @@ abstract class Tree {
|
||||
if ($nolimit)
|
||||
@set_time_limit($_SESSION[APPCONFIG]->getValue('search','time_limit'));
|
||||
|
||||
$this->entries[$dnlower]->readingChildren(true);
|
||||
|
||||
foreach ($ldap['children'] as $child) {
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('Adding (%s)',64,0,__FILE__,__LINE__,__METHOD__,$child);
|
||||
@@ -309,6 +311,8 @@ abstract class Tree {
|
||||
$this->entries[$dnlower]->addChild($child);
|
||||
}
|
||||
|
||||
$this->entries[$dnlower]->readingChildren(false);
|
||||
|
||||
if (count($this->entries[$dnlower]->getChildren()) == $ldap['child_limit'])
|
||||
$this->entries[$dnlower]->setSizeLimited();
|
||||
else
|
||||
|
@@ -33,6 +33,10 @@ class TreeItem {
|
||||
private $size_limited = true;
|
||||
# Last template used to edit this entry
|
||||
private $template = null;
|
||||
# Do we need to sort the children
|
||||
private $childsort = true;
|
||||
# Are we reading the children
|
||||
private $reading_children = false;
|
||||
|
||||
public function __construct($server_id,$dn) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
@@ -115,9 +119,38 @@ class TreeItem {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->children);
|
||||
|
||||
if ($this->childsort && ! $this->reading_children) {
|
||||
usort($this->children,'pla_compare_dns');
|
||||
$this->childsort = false;
|
||||
}
|
||||
|
||||
return $this->children;
|
||||
}
|
||||
|
||||
public function readingChildren($bool) {
|
||||
$this->reading_children = $bool;
|
||||
}
|
||||
|
||||
/**
|
||||
* Do the children require resorting
|
||||
*/
|
||||
public function isChildSorted() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->childsort);
|
||||
|
||||
return $this->childsort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark the children as sorted
|
||||
*/
|
||||
public function childSorted() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$this->childsort = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a child to this DN entry.
|
||||
*
|
||||
@@ -131,6 +164,7 @@ class TreeItem {
|
||||
return;
|
||||
|
||||
array_push($this->children,$dn);
|
||||
$this->childsort = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -65,6 +65,7 @@ class Config {
|
||||
|
||||
$this->default->appearance['control_icons'] = array(
|
||||
'desc'=>'Show the control as icons or text',
|
||||
'undocumented'=>true,
|
||||
'default'=>false);
|
||||
|
||||
$this->default->appearance['custom_templates_only'] = array(
|
||||
@@ -87,6 +88,10 @@ class Config {
|
||||
'desc'=>'Disabled the Default Template',
|
||||
'default'=>false);
|
||||
|
||||
$this->default->appearance['disable_default_leaf'] = array(
|
||||
'desc'=>'Disabled creating leaf entries in the Default Template',
|
||||
'default'=>false);
|
||||
|
||||
$this->default->appearance['friendly_attrs'] = array(
|
||||
'desc'=>'Friendly names for attributes',
|
||||
'default'=>array());
|
||||
@@ -303,6 +308,7 @@ class Config {
|
||||
|
||||
$this->default->commands['script'] = array(
|
||||
'desc'=>'Define scripts availability',
|
||||
'undocumented'=>true,
|
||||
'default'=> array(
|
||||
'add_attr_form' => true,
|
||||
'add_oclass_form' => true,
|
||||
@@ -375,6 +381,7 @@ class Config {
|
||||
|
||||
@$this->default->deref['view'] = array(
|
||||
'desc'=>'',
|
||||
'undocumented'=>true,
|
||||
'default'=>LDAP_DEREF_NEVER);
|
||||
|
||||
## Debug Attributes
|
||||
@@ -418,6 +425,7 @@ class Config {
|
||||
*/
|
||||
$this->default->modify_member['filter'] = array(
|
||||
'desc'=>'Search filter for member searches',
|
||||
'undocumented'=>true,
|
||||
'default'=>'(objectclass=Person)');
|
||||
|
||||
/**
|
||||
@@ -427,6 +435,7 @@ class Config {
|
||||
*/
|
||||
$this->default->modify_member['groupattr'] = array(
|
||||
'desc'=>'Group member attributes',
|
||||
'undocumented'=>true,
|
||||
'default'=>array('member','uniqueMember','memberUid'));
|
||||
|
||||
/**
|
||||
@@ -435,6 +444,7 @@ class Config {
|
||||
*/
|
||||
$this->default->modify_member['attr'] = array(
|
||||
'desc'=>'Default attribute that is added to the group member attribute',
|
||||
'undocumented'=>true,
|
||||
'default'=>'dn');
|
||||
|
||||
/**
|
||||
@@ -443,6 +453,7 @@ class Config {
|
||||
*/
|
||||
$this->default->modify_member['posixattr'] = array(
|
||||
'desc'=>'Contents of the group member attribute',
|
||||
'undocumented'=>true,
|
||||
'default'=>'uid');
|
||||
|
||||
/**
|
||||
@@ -451,6 +462,7 @@ class Config {
|
||||
*/
|
||||
$this->default->modify_member['posixfilter'] = array(
|
||||
'desc'=>'Search filter for posixmember searches',
|
||||
'undocumented'=>true,
|
||||
'default'=>'(uid=*)');
|
||||
|
||||
/**
|
||||
@@ -459,6 +471,7 @@ class Config {
|
||||
*/
|
||||
$this->default->modify_member['posixgroupattr'] = array(
|
||||
'desc'=>'posixGroup member attribute',
|
||||
'undocumented'=>true,
|
||||
'default'=>'memberUid');
|
||||
|
||||
## Session Attributes
|
||||
@@ -471,10 +484,12 @@ class Config {
|
||||
|
||||
$this->default->session['memorylimit'] = array(
|
||||
'desc'=>'Set the PHP memorylimit warning threshold.',
|
||||
'undocumented'=>true,
|
||||
'default'=>24);
|
||||
|
||||
$this->default->session['timelimit'] = array(
|
||||
'desc'=>'Set the PHP timelimit.',
|
||||
'undocumented'=>true,
|
||||
'default'=>30);
|
||||
|
||||
/** Cookie Time
|
||||
@@ -483,6 +498,7 @@ class Config {
|
||||
*/
|
||||
$this->default->session['cookie_time'] = array(
|
||||
'desc'=>'Time in seconds for the life of cookies',
|
||||
'undocumented'=>true,
|
||||
'default'=>0);
|
||||
|
||||
/**
|
||||
@@ -503,30 +519,36 @@ class Config {
|
||||
## Password Generation
|
||||
$this->default->password['length'] = array(
|
||||
'desc'=>'Length of autogenerated password',
|
||||
'undocumented'=>true,
|
||||
'default'=>8);
|
||||
|
||||
$this->default->password['numbers'] = array(
|
||||
'desc'=>'Number of numbers required in the password',
|
||||
'undocumented'=>true,
|
||||
'default'=>2);
|
||||
|
||||
$this->default->password['lowercase'] = array(
|
||||
'desc'=>'Number of lowercase letters required in the password',
|
||||
'undocumented'=>true,
|
||||
'default'=>2);
|
||||
|
||||
$this->default->password['uppercase'] = array(
|
||||
'desc'=>'Number of uppercase letters required in the password',
|
||||
'undocumented'=>true,
|
||||
'default'=>2);
|
||||
|
||||
$this->default->password['punctuation'] = array(
|
||||
'desc'=>'Number of punctuation letters required in the password',
|
||||
'undocumented'=>true,
|
||||
'default'=>2);
|
||||
|
||||
$this->default->password['use_similar'] = array(
|
||||
'desc'=>'Whether to use similiar characters',
|
||||
'undocumented'=>true,
|
||||
'default'=>true);
|
||||
|
||||
$this->default->password['no_random_crypt_salt'] = array(
|
||||
'descr'=>'Disable random salt for crypt()',
|
||||
'desc'=>'Disable random salt for crypt()',
|
||||
'default'=>false);
|
||||
|
||||
/** Search display
|
||||
@@ -536,10 +558,12 @@ class Config {
|
||||
*/
|
||||
$this->default->search['display'] = array(
|
||||
'desc'=>'Display a list or table of search results',
|
||||
'undocumented'=>true,
|
||||
'default'=>'list');
|
||||
|
||||
$this->default->search['size_limit'] = array(
|
||||
'desc'=>'Limit the size of searchs on the search page',
|
||||
'undocumented'=>true,
|
||||
'default'=>50);
|
||||
|
||||
/**
|
||||
@@ -548,10 +572,12 @@ class Config {
|
||||
*/
|
||||
$this->default->search['result_attributes'] = array(
|
||||
'desc'=>'List of attributes to display in each search result entry',
|
||||
'undocumented'=>true,
|
||||
'default'=>array('cn','sn','uid','postalAddress','telephoneNumber'));
|
||||
|
||||
$this->default->search['time_limit'] = array(
|
||||
'desc'=>'Maximum time to allow unlimited size_limit searches to the ldap server',
|
||||
'undocumented'=>true,
|
||||
'default'=>120);
|
||||
}
|
||||
|
||||
@@ -610,6 +636,20 @@ class Config {
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the undocumented config items
|
||||
*/
|
||||
public function undocumented() {
|
||||
$result = array();
|
||||
|
||||
foreach ($this->default as $option => $details)
|
||||
foreach ($details as $param => $values)
|
||||
if (isset($values['undocumented']) && $values['undocumented'])
|
||||
array_push($result,sprintf('%s.%s',$option,$param));
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to check and warn about any unusual defined variables.
|
||||
*/
|
||||
@@ -677,13 +717,13 @@ class Config {
|
||||
$cmd = $this->getValue('commands',$index);
|
||||
|
||||
if (! is_string($a) || ! isset($cmd[$a]))
|
||||
debug_dump(array('Unknown command '=>$a),1);
|
||||
|
||||
return $cmd[$a];
|
||||
return false;
|
||||
else
|
||||
return $cmd[$a];
|
||||
}
|
||||
|
||||
public function configDefinition($key,$index,$config) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',3,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
if (! is_array($config) || ! array_key_exists('desc',$config) || ! array_key_exists('default',$config))
|
||||
|
26
lib/ds.php
@@ -112,6 +112,20 @@ abstract class DS {
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the undocumented config items
|
||||
*/
|
||||
public function undocumented() {
|
||||
$result = array();
|
||||
|
||||
foreach ($this->default as $option => $details)
|
||||
foreach ($details as $param => $values)
|
||||
if (isset($values['undocumented']) && $values['undocumented'])
|
||||
array_push($result,sprintf('%s.%s',$option,$param));
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of this datastore
|
||||
*/
|
||||
@@ -427,7 +441,7 @@ abstract class DS {
|
||||
*/
|
||||
public function isSessionValid() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs,true);
|
||||
debug_log('Entered (%%)',17,1,__FILE__,__LINE__,__METHOD__,$fargs,true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -466,10 +480,12 @@ class Datastore {
|
||||
|
||||
$this->default->server['id'] = array(
|
||||
'desc'=>'Server ID',
|
||||
'undocumented'=>true,
|
||||
'default'=>null);
|
||||
|
||||
$this->default->server['name'] = array(
|
||||
'desc'=>'Server name',
|
||||
'undocumented'=>true,
|
||||
'default'=>null);
|
||||
|
||||
# Connectivity Info
|
||||
@@ -479,15 +495,18 @@ class Datastore {
|
||||
|
||||
$this->default->server['port'] = array(
|
||||
'desc'=>'Port Number',
|
||||
'undocumented'=>true,
|
||||
'default'=>null);
|
||||
|
||||
# Read or write only access
|
||||
$this->default->server['read_only'] = array(
|
||||
'desc'=>'Server is in READ ONLY mode',
|
||||
'undocumented'=>true,
|
||||
'default'=>false);
|
||||
|
||||
$this->default->server['visible'] = array(
|
||||
'desc'=>'Whether this server is visible',
|
||||
'undocumented'=>true,
|
||||
'default'=>true);
|
||||
|
||||
# Authentication Information
|
||||
@@ -512,23 +531,28 @@ class Datastore {
|
||||
|
||||
$this->default->login['auth_text'] = array(
|
||||
'desc'=>'Text to show at the login prompt',
|
||||
'undocumented'=>true,
|
||||
'default'=>null);
|
||||
|
||||
$this->default->login['bind_id'] = array(
|
||||
'desc'=>'User Login ID to bind to this DS',
|
||||
'undocumented'=>true,
|
||||
'default'=>null);
|
||||
|
||||
$this->default->login['bind_pass'] = array(
|
||||
'desc'=>'User Login Password to bind to this DS',
|
||||
'undocumented'=>true,
|
||||
'default'=>null);
|
||||
|
||||
$this->default->login['timeout'] = array(
|
||||
'desc'=>'Session timout in seconds',
|
||||
'undocumented'=>true,
|
||||
'default'=>session_cache_expire()-1);
|
||||
|
||||
# Prefix for custom pages
|
||||
$this->default->custom['pages_prefix'] = array(
|
||||
'desc'=>'Prefix name for custom pages',
|
||||
'undocumented'=>true,
|
||||
'default'=>'custom_');
|
||||
}
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* This abstract class provides the basic variables and methods for LDAP datastores:wq
|
||||
* This abstract class provides the basic variables and methods for LDAP datastores
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage DataStore
|
||||
@@ -46,6 +46,7 @@ class ldap extends DS {
|
||||
* definitions when reading the schema.*/
|
||||
$this->default->server['schema_oclass_default'] = array(
|
||||
'desc'=>'When reading the schema, and it doesnt specify objectClass type, default it to this',
|
||||
'undocumented'=>true,
|
||||
'default'=>null);
|
||||
|
||||
$this->default->server['base'] = array(
|
||||
@@ -89,31 +90,37 @@ class ldap extends DS {
|
||||
$this->default->sasl['mech'] = array(
|
||||
'desc'=>'SASL mechanism used while binding LDAP server',
|
||||
'untested'=>true,
|
||||
'undocumented'=>true,
|
||||
'default'=>'PLAIN');
|
||||
|
||||
$this->default->sasl['realm'] = array(
|
||||
'desc'=>'SASL realm name',
|
||||
'untested'=>true,
|
||||
'undocumented'=>true,
|
||||
'default'=>null);
|
||||
|
||||
$this->default->sasl['authz_id'] = array(
|
||||
'desc'=>'SASL authorization id',
|
||||
'untested'=>true,
|
||||
'undocumented'=>true,
|
||||
'default'=>null);
|
||||
|
||||
$this->default->sasl['authz_id_regex'] = array(
|
||||
'desc'=>'SASL authorization id PCRE regular expression',
|
||||
'untested'=>true,
|
||||
'undocumented'=>true,
|
||||
'default'=>null);
|
||||
|
||||
$this->default->sasl['authz_id_replacement'] = array(
|
||||
'desc'=>'SASL authorization id PCRE regular expression replacement string',
|
||||
'untested'=>true,
|
||||
'undocumented'=>true,
|
||||
'default'=>null);
|
||||
|
||||
$this->default->sasl['props'] = array(
|
||||
'desc'=>'SASL properties',
|
||||
'untested'=>true,
|
||||
'undocumented'=>true,
|
||||
'default'=>null);
|
||||
}
|
||||
|
||||
@@ -194,7 +201,7 @@ class ldap extends DS {
|
||||
|
||||
# If SASL has been configured for binding, then start it now.
|
||||
if ($this->isSASLEnabled())
|
||||
$this->startSASL($resource,$method);
|
||||
$bind['result'] = $this->startSASL($resource,$method);
|
||||
|
||||
# Normal bind...
|
||||
else
|
||||
@@ -243,7 +250,6 @@ class ldap extends DS {
|
||||
* Login to the database with the application user/password
|
||||
*
|
||||
* @return boolean true|false for successful login.
|
||||
* @todo isLoginStringEnabled() based logins
|
||||
*/
|
||||
public function login($user=null,$pass=null,$method=null,$new=false) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
@@ -259,6 +265,9 @@ class ldap extends DS {
|
||||
else
|
||||
$userDN = $this->getLoginID($user,'login');
|
||||
|
||||
if (! $userDN && $this->getValue('login','fallback_dn'))
|
||||
$userDN = $user;
|
||||
|
||||
if (! $userDN)
|
||||
return false;
|
||||
|
||||
@@ -270,7 +279,7 @@ class ldap extends DS {
|
||||
|
||||
} else {
|
||||
$userDN = $this->getLogin('user');
|
||||
$pass = $this->getLogin('user');
|
||||
$pass = $this->getPassword('user');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,8 +319,6 @@ class ldap extends DS {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$size_limit = 500;
|
||||
$time_limit = 0;
|
||||
$attrs_only = 0;
|
||||
|
||||
# Defaults
|
||||
@@ -333,7 +340,9 @@ class ldap extends DS {
|
||||
if (! isset($query['scope']))
|
||||
$query['scope'] = 'sub';
|
||||
if (! isset($query['size_limit']))
|
||||
$query['size_limit'] = $size_limit;
|
||||
$query['size_limit'] = 0;
|
||||
if (! isset($query['time_limit']))
|
||||
$query['time_limit'] = 0;
|
||||
|
||||
if ($query['scope'] == 'base' && ! isset($query['baseok']))
|
||||
system_message(array(
|
||||
@@ -360,16 +369,16 @@ class ldap extends DS {
|
||||
|
||||
switch ($query['scope']) {
|
||||
case 'base':
|
||||
$search = @ldap_read($resource,$query['base'],$query['filter'],$query['attrs'],$attrs_only,$query['size_limit'],$time_limit,$query['deref']);
|
||||
$search = @ldap_read($resource,$query['base'],$query['filter'],$query['attrs'],$attrs_only,$query['size_limit'],$query['time_limit'],$query['deref']);
|
||||
break;
|
||||
|
||||
case 'one':
|
||||
$search = @ldap_list($resource,$query['base'],$query['filter'],$query['attrs'],$attrs_only,$query['size_limit'],$time_limit,$query['deref']);
|
||||
$search = @ldap_list($resource,$query['base'],$query['filter'],$query['attrs'],$attrs_only,$query['size_limit'],$query['time_limit'],$query['deref']);
|
||||
break;
|
||||
|
||||
case 'sub':
|
||||
default:
|
||||
$search = @ldap_search($resource,$query['base'],$query['filter'],$query['attrs'],$attrs_only,$query['size_limit'],$time_limit,$query['deref']);
|
||||
$search = @ldap_search($resource,$query['base'],$query['filter'],$query['attrs'],$attrs_only,$query['size_limit'],$query['time_limit'],$query['deref']);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -487,7 +496,7 @@ class ldap extends DS {
|
||||
return null;
|
||||
|
||||
$detail = array_shift($result);
|
||||
|
||||
|
||||
if (! isset($detail['dn']))
|
||||
die('ERROR: DN missing?');
|
||||
else
|
||||
@@ -557,8 +566,16 @@ class ldap extends DS {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
if (! $this->getValue('server','tls') || (function_exists('ldap_start_tls') && ! ldap_start_tls($resource)))
|
||||
error(_('Could not start TLS. Please check your LDAP server configuration.'),'error',null,true);
|
||||
if (! $this->getValue('server','tls') || (function_exists('ldap_start_tls') && ! @ldap_start_tls($resource))) {
|
||||
system_message(array(
|
||||
'title'=>sprintf('%s (%s)',_('Could not start TLS.'),$this->getName()),
|
||||
'body'=>sprintf('<b>%s</b>: %s',_('Error'),_('Could not start TLS. Please check your LDAP server configuration.')),
|
||||
'type'=>'error'));
|
||||
|
||||
return false;
|
||||
|
||||
} else
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -593,10 +610,17 @@ class ldap extends DS {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
error(__METHOD__.' has NOT been tested, please let us know if it works and which version of PHP you are using.','info');
|
||||
static $CACHE = array();
|
||||
|
||||
if (! $this->getValue('server','sasl') || ! function_exists('ldap_start_tls'));
|
||||
switch (strtolower($this->getValue('sasl','mech'))) {
|
||||
case 'gssapi':
|
||||
if (isset($_ENV['REDIRECT_KRB5CCNAME']))
|
||||
putenv(sprintf('KRB5CCNAME={%s}',$_ENV['REDIRECT_KRB5CCNAME']));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (! $this->getValue('server','sasl') || ! function_exists('ldap_start_tls'))
|
||||
return false;
|
||||
|
||||
if (! isset($CACHE['login_dn'])) {
|
||||
@@ -638,7 +662,7 @@ class ldap extends DS {
|
||||
return @ldap_sasl_bind($resource,$CACHE['login_dn'],$CACHE['login_pass'],
|
||||
$this->getValue('sasl','mech'),
|
||||
$this->getValue('sasl','realm'),
|
||||
$CACH['authz_id'],
|
||||
$CACHE['authz_id'],
|
||||
$this->getValue('sasl','props'));
|
||||
}
|
||||
|
||||
|
@@ -21,35 +21,47 @@ class ldap_pla extends ldap {
|
||||
|
||||
$this->default->appearance['password_hash'] = array(
|
||||
'desc'=>'Default HASH to use for passwords',
|
||||
'undocumented'=>true,
|
||||
'default'=>'md5');
|
||||
|
||||
$this->default->appearance['show_create'] = array(
|
||||
'desc'=>'Whether to show the "Create new Entry here" in the tree browser',
|
||||
'undocumented'=>true,
|
||||
'default'=>true);
|
||||
|
||||
$this->default->login['fallback_dn'] = array(
|
||||
'desc'=>'If the attribute base login fails, see if a DN was entered',
|
||||
'default'=>false);
|
||||
|
||||
$this->default->query['disable_default'] = array(
|
||||
'desc'=>'Configuration to disable the default query template',
|
||||
'undocumented'=>true,
|
||||
'default'=>false);
|
||||
|
||||
$this->default->query['custom_only'] = array(
|
||||
'desc'=>'Configuration to force the usage of custom query templates',
|
||||
'undocumented'=>true,
|
||||
'default'=>false);
|
||||
|
||||
$this->default->server['branch_rename'] = array(
|
||||
'desc'=>'Enable renaming of branches',
|
||||
'undocumented'=>true,
|
||||
'default'=>false);
|
||||
|
||||
$this->default->server['custom_attrs'] = array(
|
||||
'desc'=>'Custom operational attributes to be treated as regular attributes',
|
||||
'undocumented'=>true,
|
||||
'default'=>array(''));
|
||||
|
||||
$this->default->server['custom_sys_attrs'] = array(
|
||||
'desc'=>'Custom operational attributes to be treated as internal attributes',
|
||||
'undocumented'=>true,
|
||||
'default'=>array('+'));
|
||||
|
||||
# This was added in case the LDAP server doesnt provide them with a base +,* query.
|
||||
$this->default->server['root_dse_attributes'] = array(
|
||||
'desc'=>'RootDSE attributes for use when displaying server info',
|
||||
'undocumented'=>true,
|
||||
'default'=>array(
|
||||
'namingContexts',
|
||||
'subschemaSubentry',
|
||||
@@ -92,6 +104,7 @@ class ldap_pla extends ldap {
|
||||
|
||||
$this->default->auto_number['search_base'] = array(
|
||||
'desc'=>'Base DN to use for search mechanisms',
|
||||
'undocumented'=>true,
|
||||
'default'=>null);
|
||||
|
||||
$this->default->auto_number['min'] = array(
|
||||
@@ -470,7 +483,7 @@ class ldap_pla extends ldap {
|
||||
return false;
|
||||
|
||||
if (run_hook('pre_entry_modify',array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn,'attrs'=>$attrs))) {
|
||||
$result = @ldap_mod_replace($this->connect($method),$dn,$attrs);
|
||||
$result = @ldap_modify($this->connect($method),$dn,$attrs);
|
||||
|
||||
if ($result) {
|
||||
run_hook('post_entry_modify',array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn,'attrs'=>$attrs));
|
||||
@@ -583,7 +596,7 @@ class ldap_pla extends ldap {
|
||||
foreach ($results as $values)
|
||||
# If one of the attributes is owned to somebody else, then we may as well die here.
|
||||
if ($values['dn'] != $dn) {
|
||||
$href = sprintf('cmd.php?cmd=query_engine&server_id=%s&filter=%s&scope=sub&query=none&format=list',$this->index,$query['filter']);
|
||||
$href = sprintf('cmd.php?cmd=query_engine&server_id=%s&filter=%s&scope=sub&query=none&format=list&search=true',$this->index,$query['filter']);
|
||||
|
||||
system_message(array(
|
||||
'title'=>_('Attribute value would not be unique'),
|
||||
|
1
lib/export_functions.php
Executable file → Normal file
@@ -128,6 +128,7 @@ abstract class Export {
|
||||
$query['filter'] = get_request('filter','REQUEST',false,'objectclass=*');
|
||||
$query['scope'] = get_request('scope','REQUEST',false,'base');
|
||||
$query['deref'] = $_SESSION[APPCONFIG]->getValue('deref','export');
|
||||
$query['size_limit'] = 0;
|
||||
$attrs = get_request('attributes','REQUEST');
|
||||
|
||||
$attrs = preg_replace('/\s+/','',$attrs);
|
||||
|
@@ -341,7 +341,7 @@ function check_config($config_file) {
|
||||
* @return array
|
||||
*/
|
||||
function cmd_control_pane($type) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
switch ($type) {
|
||||
@@ -355,15 +355,15 @@ function cmd_control_pane($type) {
|
||||
|
||||
'purge'=>array(
|
||||
'title'=>_('Purge caches'),
|
||||
'enable'=>$_SESSION[APPCONFIG]->isCommandAvailable('script','purge_cache'),
|
||||
'link'=>sprintf('href="cmd.php?cmd=purge_cache" onclick="return displayAJ(\'BODY\',\'cmd=purge_cache\',\'%s\');" title="%s"',
|
||||
'enable'=>isset($_SESSION[APPCONFIG]) ? $_SESSION[APPCONFIG]->isCommandAvailable('script','purge_cache') : false,
|
||||
'link'=>sprintf('href="cmd.php?cmd=purge_cache" onclick="return ajDISPLAY(\'BODY\',\'cmd=purge_cache\',\'%s\');" title="%s"',
|
||||
_('Clearing cache'),_('Purge caches')),
|
||||
'image'=>sprintf('<img src="%s/trash-big.png" alt="%s" />',IMGDIR,_('Purge caches'))),
|
||||
|
||||
'hide_debug_info'=>array(
|
||||
'title'=>_('Show Cache'),
|
||||
'enable'=>$_SESSION[APPCONFIG]->isCommandAvailable('script','show_cache'),
|
||||
'link'=>sprintf('href="cmd.php?cmd=show_cache" onclick="return displayAJ(\'BODY\',\'cmd=show_cache\',\'%s\');" title="%s"',
|
||||
'enable'=>isset($_SESSION[APPCONFIG]) ? $_SESSION[APPCONFIG]->isCommandAvailable('script','show_cache') : false,
|
||||
'link'=>sprintf('href="cmd.php?cmd=show_cache" onclick="return ajDISPLAY(\'BODY\',\'cmd=show_cache\',\'%s\');" title="%s"',
|
||||
_('Loading'),_('Show Cache'),_('Show Cache')),
|
||||
'image'=>sprintf('<img src="%s/debug-cache.png" alt="%s" />',IMGDIR,_('Show Cache'))),
|
||||
);
|
||||
@@ -374,31 +374,31 @@ function cmd_control_pane($type) {
|
||||
return array(
|
||||
'forum'=>array(
|
||||
'title'=>_('Forum'),
|
||||
'enable'=>$_SESSION[APPCONFIG]->isCommandAvailable('cmd','oslinks'),
|
||||
'enable'=>isset($_SESSION[APPCONFIG]) ? $_SESSION[APPCONFIG]->isCommandAvailable('cmd','oslinks') : true,
|
||||
'link'=>sprintf('href="%s" title="%s" target="_blank"',get_href('forum'),_('Forum')),
|
||||
'image'=>sprintf('<img src="%s/forum-big.png" alt="%s" />',IMGDIR,_('Forum'))),
|
||||
|
||||
'feature'=>array(
|
||||
'title'=>_('Request feature'),
|
||||
'enable'=>$_SESSION[APPCONFIG]->isCommandAvailable('cmd','oslinks'),
|
||||
'enable'=>isset($_SESSION[APPCONFIG]) ? $_SESSION[APPCONFIG]->isCommandAvailable('cmd','oslinks') : true,
|
||||
'link'=>sprintf('href="%s" title="%s" target="_blank"',get_href('add_rfe'),_('Request feature')),
|
||||
'image'=>sprintf('<img src="%s/request-feature-big.png" alt="%s" />',IMGDIR,_('Request feature'))),
|
||||
|
||||
'bug'=>array(
|
||||
'title'=>_('Report a bug'),
|
||||
'enable'=>$_SESSION[APPCONFIG]->isCommandAvailable('cmd','oslinks'),
|
||||
'enable'=>isset($_SESSION[APPCONFIG]) ? $_SESSION[APPCONFIG]->isCommandAvailable('cmd','oslinks') : true,
|
||||
'link'=>sprintf('href="%s" title="%s" target="_blank"',get_href('add_bug'),_('Report a bug')),
|
||||
'image'=>sprintf('<img src="%s/bug-big.png" alt="%s" />',IMGDIR,_('Report a bug'))),
|
||||
|
||||
'donation'=>array(
|
||||
'title'=>_('Donate'),
|
||||
'enable'=>$_SESSION[APPCONFIG]->isCommandAvailable('cmd','oslinks'),
|
||||
'enable'=>isset($_SESSION[APPCONFIG]) ? $_SESSION[APPCONFIG]->isCommandAvailable('cmd','oslinks') : true,
|
||||
'link'=>sprintf('href="%s" title="%s" target="_blank"',get_href('donate'),_('Donate')),
|
||||
'image'=>sprintf('<img src="%s/smile-big.png" alt="%s" />',IMGDIR,_('Donate'))),
|
||||
|
||||
'help'=>array(
|
||||
'title'=>_('Help'),
|
||||
'enable'=>$_SESSION[APPCONFIG]->isCommandAvailable('cmd','oslinks'),
|
||||
'enable'=>isset($_SESSION[APPCONFIG]) ? $_SESSION[APPCONFIG]->isCommandAvailable('cmd','oslinks') : true,
|
||||
'link'=>sprintf('href="%s" title="%s" target="_blank"',get_href('documentation'),_('Help')),
|
||||
'image'=>sprintf('<img src="%s/help-big.png" alt="%s" />',IMGDIR,_('Help')))
|
||||
);
|
||||
@@ -486,8 +486,8 @@ function debug_log($msg,$level,$indent) {
|
||||
static $debug_file;
|
||||
|
||||
# In case we are called before we are fully initialised or if debugging is not set.
|
||||
if (! isset($_SESSION[APPCONFIG]) ||
|
||||
! ($_SESSION[APPCONFIG]->getValue('debug','file') || $_SESSION[APPCONFIG]->getValue('debug','syslog')))
|
||||
if (! isset($_SESSION[APPCONFIG])
|
||||
|| ! ($_SESSION[APPCONFIG]->getValue('debug','file') || $_SESSION[APPCONFIG]->getValue('debug','syslog')))
|
||||
return;
|
||||
|
||||
$debug_level = $_SESSION[APPCONFIG]->getValue('debug','level');
|
||||
@@ -563,7 +563,7 @@ function debug_log($msg,$level,$indent) {
|
||||
fwrite($debug_file,$debug_message."\n");
|
||||
}
|
||||
|
||||
if ($_SESSION[APPCONFIG]->getValue('debug','syslog'))
|
||||
if ($_SESSION[APPCONFIG]->getValue('debug','syslog') && function_exists('syslog_notice'))
|
||||
syslog_notice($debug_message);
|
||||
}
|
||||
|
||||
@@ -648,11 +648,11 @@ function error($msg,$type='note',$redirect=null,$fatal=false,$backtrace=false) {
|
||||
function get_request($attr,$type='POST',$die=false,$default=null) {
|
||||
switch($type) {
|
||||
case 'GET':
|
||||
$value = isset($_GET[$attr]) ? (is_array($_GET[$attr]) ? $_GET[$attr] : rawurldecode($_GET[$attr])) : $default;
|
||||
$value = isset($_GET[$attr]) ? (is_array($_GET[$attr]) ? $_GET[$attr] : trim(rawurldecode($_GET[$attr]))) : $default;
|
||||
break;
|
||||
|
||||
case 'REQUEST':
|
||||
$value = isset($_REQUEST[$attr]) ? (is_array($_REQUEST[$attr]) ? $_REQUEST[$attr] : rawurldecode($_REQUEST[$attr])) : $default;
|
||||
$value = isset($_REQUEST[$attr]) ? (is_array($_REQUEST[$attr]) ? $_REQUEST[$attr] : trim(rawurldecode($_REQUEST[$attr]))) : $default;
|
||||
break;
|
||||
|
||||
case 'SESSION':
|
||||
@@ -661,7 +661,7 @@ function get_request($attr,$type='POST',$die=false,$default=null) {
|
||||
|
||||
case 'POST':
|
||||
default:
|
||||
$value = isset($_POST[$attr]) ? (is_array($_POST[$attr]) ? $_POST[$attr] : rawurldecode($_POST[$attr])) : $default;
|
||||
$value = isset($_POST[$attr]) ? (is_array($_POST[$attr]) ? $_POST[$attr] : trim(rawurldecode($_POST[$attr]))) : $default;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2085,15 +2085,15 @@ function password_types() {
|
||||
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
return array(
|
||||
'blowfish',
|
||||
'clear',
|
||||
'crypt',
|
||||
'ext_des',
|
||||
'md5',
|
||||
'md5crypt',
|
||||
'sha',
|
||||
'smd5',
|
||||
'ssha'
|
||||
'blowfish'=>'blowfish',
|
||||
''=>'clear',
|
||||
'crypt'=>'crypt',
|
||||
'ext_des'=>'ext_des',
|
||||
'md5'=>'md5',
|
||||
'md5crypt'=>'md5crypt',
|
||||
'sha'=>'sha',
|
||||
'smd5'=>'smd5',
|
||||
'ssha'=>'ssha'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2860,6 +2860,7 @@ function binSIDtoText($binsid) {
|
||||
* or true to have the returned array sorted by DN (uses ksort)
|
||||
* or an array of attribute names to sort by attribute values
|
||||
* @return array Array of values keyed by $key.
|
||||
* @todo sort is not being performed
|
||||
*/
|
||||
function return_ldap_hash($base,$filter,$key,$attrs,$sort=true) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
@@ -2881,11 +2882,12 @@ function return_ldap_hash($base,$filter,$key,$attrs,$sort=true) {
|
||||
if (is_array($values[$key]))
|
||||
foreach ($values[$key] as $i => $k)
|
||||
foreach ($attrs as $attr) {
|
||||
if (isset($values[$attr])) {
|
||||
$lattr = strtolower($attr);
|
||||
if (isset($values[$lattr])) {
|
||||
$v = '';
|
||||
|
||||
if (is_array($values[$attr]) && isset($values[$attr][$i]))
|
||||
$v = $values[$attr][$i];
|
||||
if (is_array($values[$lattr]) && isset($values[$lattr][$i]))
|
||||
$v = $values[$lattr][$i];
|
||||
|
||||
if (is_string($v) && (strlen($v) > 0))
|
||||
$results[$k][$attr] = $v;
|
||||
@@ -2893,9 +2895,11 @@ function return_ldap_hash($base,$filter,$key,$attrs,$sort=true) {
|
||||
}
|
||||
|
||||
else
|
||||
foreach ($attrs as $attr)
|
||||
if (isset($values[$attr]))
|
||||
$results[$values[$key]][$attr] = $values[$attr];
|
||||
foreach ($attrs as $attr) {
|
||||
$lattr = strtolower($attr);
|
||||
if (isset($values[$lattr]))
|
||||
$results[$values[$key]][$attr] = $values[$lattr];
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
@@ -117,7 +117,7 @@ function run_hook($hook_name,$args) {
|
||||
* @param rollback_function Name of the php rollback function called upon failure.
|
||||
*/
|
||||
function add_hook($hook_name,$hook_function,$priority=0,$rollback_function=null) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',257,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
# First, see if the hook function exists.
|
||||
@@ -153,7 +153,7 @@ function add_hook($hook_name,$hook_function,$priority=0,$rollback_function=null)
|
||||
* procedures that call this function as a rollback will be removed.
|
||||
*/
|
||||
function remove_hook($hook_name,$hook_function,$priority,$rollback_function) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',257,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
if (array_key_exists($hook_name,$_SESSION[APPCONFIG]->hooks)) {
|
||||
|
49
lib/page.php
@@ -26,7 +26,7 @@ class page {
|
||||
protected $_default;
|
||||
|
||||
public function __construct($index=null) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
# If we done have a configuration, then our IMGDIR and CSS are not defined
|
||||
@@ -66,7 +66,7 @@ class page {
|
||||
if (isCompress()) {
|
||||
header('Content-Encoding: gzip');
|
||||
|
||||
if (DEBUG_ENABLED)
|
||||
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED)
|
||||
debug_log('Sent COMPRESSED header to browser and discarded (%s)',129,0,__FILE__,__LINE__,__METHOD__,$preOutput);
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ class page {
|
||||
|
||||
/* Add to the HTML Header */
|
||||
public function head_add($html) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$this->_head[] .= $html;
|
||||
@@ -97,7 +97,7 @@ class page {
|
||||
|
||||
/* Print out the HTML header */
|
||||
private function pageheader_print() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
# HTML prepage requirements.
|
||||
@@ -106,6 +106,7 @@ class page {
|
||||
|
||||
# Page Title
|
||||
echo '<head>';
|
||||
printf('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />');
|
||||
|
||||
if (isset($_SESSION[APPCONFIG]))
|
||||
printf('<title>%s (%s) - %s</title>',
|
||||
@@ -113,24 +114,20 @@ class page {
|
||||
else
|
||||
printf('<title>%s - %s</title>',$this->_app['title'],app_version());
|
||||
|
||||
echo '<link rel="shortcut icon" href="images/favicon.ico" type="image/vnd.microsoft.icon" />';
|
||||
# Style sheet.
|
||||
printf('<link type="text/css" rel="stylesheet" href="%s" />',$this->_app['urlcss']);
|
||||
echo '<link rel="shortcut icon" href="images/favicon.ico" type="image/vnd.microsoft.icon" />';
|
||||
|
||||
if (defined('JSDIR')) {
|
||||
printf('<link type="text/css" rel="stylesheet" media="all" href="%sjscalendar/calendar-blue.css" title="blue" />',JSDIR);
|
||||
printf('<link type="text/css" rel="stylesheet" href="%s/phplayersmenu/layerstreemenu.css" />',JSDIR);
|
||||
echo "\n";
|
||||
printf('<script type="text/javascript" src="%spla_ajax.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" src="%stree_hide.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" src="%sentry_chooser.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" src="%sto_ascii.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" src="%sjscalendar/calendar.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" language="javascript" src="%sajax_functions.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" language="javascript" src="%sjscalendar/calendar.js"></script>',JSDIR);
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
# HTML head requirements.
|
||||
if (is_array($this->_head) && count ($this->_head))
|
||||
if (is_array($this->_head) && count($this->_head))
|
||||
foreach ($this->_head as $line)
|
||||
echo $line."\n";
|
||||
|
||||
@@ -139,7 +136,7 @@ class page {
|
||||
}
|
||||
|
||||
private function head_print() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
if (isset($_SESSION[APPCONFIG]))
|
||||
@@ -175,7 +172,7 @@ class page {
|
||||
}
|
||||
|
||||
private function control_print() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
echo '<table class="control" width=100% border=0>';
|
||||
@@ -189,7 +186,7 @@ class page {
|
||||
echo ' | ';
|
||||
|
||||
printf('<a %s>%s</a>',$cmddetails['link'],
|
||||
$_SESSION[APPCONFIG]->getValue('appearance','control_icons') ? $cmddetails['image'] : $cmddetails['title']);
|
||||
(isset($_SESSION[APPCONFIG]) && $_SESSION[APPCONFIG]->getValue('appearance','control_icons')) ? $cmddetails['image'] : $cmddetails['title']);
|
||||
|
||||
$empty = false;
|
||||
}
|
||||
@@ -203,7 +200,7 @@ class page {
|
||||
}
|
||||
|
||||
protected function tree() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
if (! isset($_SESSION[APPCONFIG]))
|
||||
@@ -232,7 +229,7 @@ class page {
|
||||
}
|
||||
|
||||
public function block_add($side,$object) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
if (! is_object($object))
|
||||
@@ -242,7 +239,7 @@ class page {
|
||||
}
|
||||
|
||||
private function block_print($side) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
if (! isset($this->_block[$side]))
|
||||
@@ -255,7 +252,7 @@ class page {
|
||||
}
|
||||
|
||||
private function sysmsg() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
if (isset($this->sysmsg)) {
|
||||
@@ -293,7 +290,7 @@ class page {
|
||||
}
|
||||
|
||||
private function body($raw=false) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
# Add the Session System Messages
|
||||
@@ -317,7 +314,7 @@ class page {
|
||||
}
|
||||
|
||||
private function footer_print() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
printf('<tr class="foot"><td><small>%s</small></td><td colspan=2><div id="ajFOOT">%s</div>%s</td></tr>',
|
||||
@@ -330,7 +327,7 @@ class page {
|
||||
* Only show a particular page frame - used by an AJAX call
|
||||
*/
|
||||
public function show($frame,$compress=false,$raw=false) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
# If the body is called via AJAX, and compression is enable, we need to compress the output
|
||||
@@ -356,7 +353,7 @@ class page {
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
if (DEBUG_ENABLED)
|
||||
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED)
|
||||
debug_log('Sending COMPRESSED output to browser[(%s),%s]',129,0,__FILE__,__LINE__,__METHOD__,
|
||||
strlen($output),$output);
|
||||
|
||||
@@ -365,7 +362,7 @@ class page {
|
||||
}
|
||||
|
||||
public function display($filter=array()) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
# Control what is displayed.
|
||||
@@ -434,7 +431,7 @@ class page {
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
if (DEBUG_ENABLED)
|
||||
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED)
|
||||
debug_log('Sending COMPRESSED output to browser[(%s),%s]',129,0,__FILE__,__LINE__,__METHOD__,
|
||||
strlen($output),$output);
|
||||
|
||||
@@ -443,7 +440,7 @@ class page {
|
||||
}
|
||||
|
||||
public function setsysmsg($data) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
if (! is_array($data))
|
||||
|
@@ -42,7 +42,7 @@ abstract class SchemaItem {
|
||||
|
||||
public function getOID() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->oid);
|
||||
|
||||
return $this->oid;
|
||||
}
|
||||
|
@@ -86,7 +86,7 @@ function app_session_start() {
|
||||
* prior to loading the SchemaItem (and descedants) class. Destroy the auto-started
|
||||
* session to prevent this problem.
|
||||
*/
|
||||
if (ini_get('session.auto_start'))
|
||||
if (ini_get('session.auto_start') && ! array_key_exists(app_session_id_init,$_SESSION))
|
||||
@session_destroy();
|
||||
|
||||
# Do we already have a session?
|
||||
|