$action_number = $_SESSION[APPCONFIG]->getValue('appearance', 'action_after_creation'); $href = sprintf('cmd=template_engine&server_id=%s', $app['server']->getIndex()); if ($request['redirect']) { $redirect_url = $request['redirect']; } else { if ($action_number == 2) { $redirect_url = sprintf('cmd.php?%s&template=%s&container=%s', $href, 'default', $request['template']->getContainerEncode()); } else { $redirect_url = sprintf('cmd.php?%s&template=%s&dn=%s', $href, 'default', $request['template']->getDNEncode()); } } if ($action_number == 1 || $action_number == 2) { printf('<meta http-equiv="refresh" content="0; url=%s" />', $redirect_url); } if ($action_number == 1 || $action_number == 2) { $create_message = sprintf('%s %s: <b>%s</b> %s', _('Creation successful!'), _('DN'), $request['template']->getDN(), _('has been created.')); if (isAjaxEnabled()) { $redirect_url .= sprintf('&refresh=SID_%s_nodes&noheader=1', $app['server']->getIndex()); } system_message(array('title' => _('Create Entry'), 'body' => $create_message, 'type' => 'info'), $redirect_url); } else { $request['page']->drawTitle(_('Entry created')); $request['page']->drawSubTitle(sprintf('%s: <b>%s</b> %s: <b>%s</b>', _('Server'), $app['server']->getName(), _('Distinguished Name'), $request['template']->getDN())); echo '<br />'; echo '<center>'; printf('<a href="cmd.php?%s&dn=%s">%s</a>.', htmlspecialchars($href), rawurlencode($request['template']->getDN()), _('Display the new created entry')); echo '<br />'; printf('<a href="cmd.php?%s&container=%s">%s</a>.', htmlspecialchars($href), rawurlencode($request['template']->getContainer()), _('Create another entry')); echo '</center>'; } }
private function drawResultsTable($base, $results) { $server = $this->getServer(); echo '<table class="result" border="0">'; echo '<tr>'; printf('<td>%s: <b>%s</b><br/><br/><div class="execution_time">(%s %s)</div></td>', _('Entries found'), number_format($results), $this->template->resultsdata[$base]['time'], _('seconds')); if ($_SESSION[APPCONFIG]->isCommandAvailable('script', 'export') && $_SESSION[APPCONFIG]->isCommandAvailable('script', 'export_form')) { $href = htmlspecialchars(sprintf('cmd.php?cmd=export_form&server_id=%s&scope=%s&dn=%s&filter=%s&attributes=%s', $server->getIndex(), $this->template->resultsdata[$base]['scope'], $base, rawurlencode($this->template->resultsdata[$base]['filter']), rawurlencode(implode(', ', $this->template->resultsdata[$base]['attrs'])))); printf('<td style="text-align: right; width: 85%%"><small>[ <a href="%s"><img src="%s/save.png" alt="Save" /> %s</a> ]</small>', $href, IMGDIR, _('export results')); } printf('<small>[ <img src="%s/rename.png" alt="rename" /> %s:', IMGDIR, _('Format')); foreach (array('list', 'table') as $f) { echo ' '; if (get_request('format', 'REQUEST', false, $_SESSION[APPCONFIG]->getValue('search', 'display')) == $f) { printf('<b>%s</b>', _($f)); } else { $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 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)); } } } echo ' ]</small>'; echo '<br />'; printf('<small>%s: <b>%s</b></small>', _('Base DN'), htmlspecialchars($base)); echo '<br />'; printf('<small>%s: <b>%s</b></small>', _('Filter performed'), htmlspecialchars($this->template->resultsdata[$base]['filter'])); echo '</td>'; echo '</tr>'; echo '</table>'; }
/** * Draw the "Create New Entry" item. */ private function draw_create_new_entry($entry, $level, $img) { if (DEBUG_ENABLED && (($fargs = func_get_args()) || ($fargs = 'NOARGS'))) { debug_log('Entered (%%)', 33, 0, __FILE__, __LINE__, __METHOD__, $fargs); } $output = ''; $href = sprintf('cmd=template_engine&server_id=%s&container=%s', $this->getServerID(), rawurlencode($entry->getDN())); $output .= $this->get_indentation($level); $output .= sprintf('<img align="top" border="0" class="imgs" src="%s" alt="--" />', $img); $output .= sprintf('<a href="%s" title="%s">', htmlspecialchars($href), $entry->getDN()); $output .= sprintf('<img align="top" border="0" class="imgs" src="%s/create.png" alt="->" />', IMGDIR); $output .= '</a>'; $output .= ' '; if (isAjaxEnabled()) { $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 { $output .= sprintf('<a href="cmd.php?%s" title="%s" class="phplm">', htmlspecialchars($href), _('Create new entry here')); } $output .= _('Create new entry here'); $output .= '</a>'; return $output; }
/** * Draw login link */ protected function draw_login_link() { if (DEBUG_ENABLED && (($fargs = func_get_args()) || ($fargs = 'NOARGS'))) { debug_log('Entered (%%)', 33, 0, __FILE__, __LINE__, __METHOD__, $fargs); } $server = $this->getServer(); $href_parm = htmlspecialchars(sprintf('cmd=%s&server_id=%s', get_custom_file($server->getIndex(), 'login_form', ''), $server->getIndex())); echo '<tr class="option"><td class="spacer"></td>'; if (isAjaxEnabled()) { 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 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 { printf('<td class="icon"><a href="cmd.php?%s"><img src="%s/%s" alt="%s" /></a></td>', $href_parm, IMGDIR, 'login.png', _('login')); printf('<td class="logged_in" colspan="%s"><a href="cmd.php?%s">%s...</a></td>', $this->getDepth() + 3 - 2, $href_parm, _('Login')); } echo '</tr>'; printf('<tr><td class="blank" colspan="%s"> </td>', $this->getDepth() + 3); printf('<tr><td class="blank" colspan="%s"> </td>', $this->getDepth() + 3); }
# See if we can render the command if (trim($www['cmd'])) { # If this is a READ-WRITE operation, the LDAP server must not be in READ-ONLY mode. if ($app['server']->isReadOnly() && !in_array(get_request('cmd', 'REQUEST'), $app['readwrite_cmds'])) { 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'])) { system_message(array('title' => _('Command disabled by the server configuration'), _('Error'), 'body' => sprintf('%s: <b>%s</b>.', _('The command could not be run'), htmlspecialchars($www['cmd'])), 'type' => 'error'), 'index.php'); $app['script_cmd'] = null; } } if ($app['script_cmd']) { include $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')) { 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. $www['body'] = new block(); $www['body']->SetBody(ob_get_contents()); $www['page']->block_add('body', $www['body']); ob_end_clean(); if ($www['meth'] == 'ajax') { $www['page']->show(get_request('frame', 'REQUEST', false, 'BODY'), true, get_request('raw', 'REQUEST', false, false)); } else { $www['page']->display(); }
echo '<table class="forminput" border="0">'; printf('<tr><td colspan="4">%s</td></tr>', _('Are you sure you want to permanently delete this object?')); echo '<tr><td colspan="4"> </td></tr>'; printf('<tr><td style="width: 10%%;">%s:</td><td colspan="3" style="width: 75%%;"><b>%s</b></td></tr>', _('Server'), $app['server']->getName()); printf('<tr><td style="width: 10%%;"><acronym title="%s">%s</acronym></td><td colspan="3" style="width: 75%%;"><b>%s</b></td></tr>', _('Distinguished Name'), _('DN'), $request['dn']); echo '<tr><td colspan="4"> </td></tr>'; echo "\n"; echo '<tr>'; echo '<td colspan="2" style="width: 50%; text-align: center;">'; echo '<form action="cmd.php" method="post" id="delete_form">'; echo '<input type="hidden" name="cmd" value="delete" />'; printf('<input type="hidden" name="server_id" value="%s" />', $app['server']->getIndex()); printf('<input type="hidden" name="dn" value="%s" />', $request['template']->getDNEncode(false)); //@todo need to refresh the tree after a delete printf('<input type="submit" name="submit" value="%s" %s />', _('Delete'), isAjaxEnabled() ? sprintf('onclick="return ajSUBMIT(\'BODY\',document.getElementById(\'delete_form\'),\'%s\');"', _('Deleting Object(s)')) : ''); echo '</form>'; echo '</td>'; echo '<td colspan="2" style="width: 50%; text-align: center;">'; echo '<form action="cmd.php" method="get">'; echo '<input type="hidden" name="cmd" value="template_engine" />'; printf('<input type="hidden" name="server_id" value="%s" />', $app['server']->getIndex()); printf('<input type="hidden" name="dn" value="%s" />', $request['template']->getDNEncode(false)); printf('<input type="submit" name="submit" value="%s" %s />', _('Cancel'), isAjaxEnabled() ? sprintf('onclick="return ajDISPLAY(\'BODY\',\'cmd=template_engine&server_id=%s&dn=%s\',\'%s\');"', $app['server']->getIndex(), $request['template']->getDNEncode(), _('Retrieving DN')) : ''); echo '</form>'; echo '</td>'; echo '</tr>'; echo '</table>'; echo "\n"; } echo '</center>'; echo '<br />';
protected function getModifyMemberMenuItemAttribute($attribute) { if (DEBUG_ENABLED && (($fargs = func_get_args()) || ($fargs = 'NOARGS'))) { debug_log('Entered (%%)', 129, 0, __FILE__, __LINE__, __METHOD__, $fargs); } if (DEBUGTMP) { printf('<font size=-2>%s</font><br />', __METHOD__); } $href = sprintf('cmd=modify_member_form&server_id=%s&dn=%s&attr=%s', $this->getServerID(), $this->template->getDNEncode(), rawurlencode($attribute->getName())); if (isAjaxEnabled()) { 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), str_replace('\'', '\\\'', _('Modify group membership')), _('modify group members')); } else { return sprintf('(<a href="cmd.php?%s" title="%s: %s">%s</a>)', htmlspecialchars($href), _('Modify members for'), $this->template->getDN(), _('modify group members')); } }
} # Draw objectClass selection echo '<table border="0">'; echo '<tr><td>'; echo '<select name="new_values[objectclass][]" multiple="multiple" size="15">'; foreach ($socs as $name => $oclass) { # Exclude any structural ones, that are not in the heirachy, as they'll only generate an LDAP_OBJECT_CLASS_VIOLATION if ($oclass->getType() == 'structural' && !$oclass->isRelated($request['attribute']->getValues())) { continue; } printf('<option value="%s">%s</option>', $oclass->getName(false), $oclass->getName(false)); } echo '</select>'; echo '</td></tr><tr><td>'; echo '<br />'; printf('<input id="save_button" type="submit" value="%s" %s />', _('Add new ObjectClass'), isAjaxEnabled() ? sprintf('onclick="return ajSUBMIT(\'BODY\',document.getElementById(\'entry_form\'),\'%s\');"', _('Updating Object')) : ''); echo '</td></tr></table>'; echo '</td>'; echo '</tr>'; if ($_SESSION[APPCONFIG]->getValue('appearance', 'show_hints')) { printf('<tr><td colspan="2"><small><br /><img src="%s/light.png" alt="Hint" /><span class="hint">%s</span></small></td></tr>', IMGDIR, _('Note: You may be required to enter new attributes that these objectClass(es) require')); } echo '</table>'; echo '</form>'; } else { # Draw a blank field echo '<table border="0"><tr><td>'; $request['page']->draw('FormValue', $request['attribute'], $request['count']); echo '</td></tr><tr><td>'; $sattr = $app['server']->getSchemaAttribute($request['attr']); if ($sattr->getDescription()) {