本文整理汇总了PHP中pla_error函数的典型用法代码示例。如果您正苦于以下问题:PHP pla_error函数的具体用法?PHP pla_error怎么用?PHP pla_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pla_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pla_rdelete
function pla_rdelete($server_id, $dn)
{
$children = get_container_contents($server_id, $dn);
global $ds;
$ds = pla_ldap_connect($server_id);
if (!is_array($children) || count($children) == 0) {
echo "<nobr>Deleting " . htmlspecialchars($dn) . "...";
flush();
if (ldap_delete($ds, $dn)) {
echo " <span style=\"color:green\">Success</span></nobr><br />\n";
return true;
} else {
pla_error("Failed to delete dn: " . htmlspecialchars(utf8_decode($dn)), ldap_error($ds), ldap_errno($ds));
}
} else {
foreach ($children as $child_dn) {
pla_rdelete($server_id, $child_dn);
}
echo "<nobr>Deleting " . htmlspecialchars($dn) . "...";
flush();
if (ldap_delete($ds, $dn)) {
echo " <span style=\"color:green\">Success</span></nobr><br />\n";
return true;
} else {
pla_errror("Failed to delete dn: " . htmlspecialchars(utf8_decode($dn)), ldap_error($ds), ldap_errno($ds));
}
}
}
示例2: pla_rdelete
function pla_rdelete($ldapserver, $dn)
{
$children = $ldapserver->getContainerContents($dn);
if (!is_array($children) || count($children) == 0) {
printf('<nobr>' . _('Deleting %s') . '...', htmlspecialchars($dn));
flush();
if (run_hook('pre_entry_delete', array('server_id' => $ldapserver->server_id, 'dn' => $dn))) {
if ($ldapserver->delete($dn)) {
run_hook('post_entry_delete', array('server_id' => $ldapserver->server_id, 'dn' => $dn));
printf(' <span style="color:green">%s</span></nobr><br />', _('Success'));
return true;
} else {
pla_error(sprintf(_('Failed to delete entry %s'), htmlspecialchars($dn)), $ldapserver->error(), $ldapserver->errno());
}
}
} else {
foreach ($children as $child_dn) {
pla_rdelete($ldapserver, $child_dn);
}
printf('<nobr>' . _('Deleting %s') . '...', htmlspecialchars($dn));
flush();
if (run_hook('pre_entry_delete', array('server_id' => $ldapserver->server_id, 'dn' => $dn))) {
if ($ldapserver->delete($dn)) {
run_hook('post_entry_delete', array('server_id' => $ldapserver->server_id, 'dn' => $dn));
printf(' <span style="color:green">%s</span></nobr><br />', _('Success'));
return true;
} else {
pla_error(sprintf(_('Failed to delete entry %s'), htmlspecialchars($dn)), $ldapserver->error(), $ldapserver->errno());
}
}
}
}
示例3: session_timed_out
/**
* Check if custom session timeout has been reached for server $ldapserver.
* If it has:
* - automatically log out user by calling $ldapserver->unsetLoginDN()
* - if $server_id is equal to right frame $server_id, load timeout.php page in the right frame
* - return true
*
* @param object $ldapserver The LDAPServer object of the server which the user has logged in.
* @return bool true on success, false on failure.
*/
function session_timed_out($ldapserver)
{
if (DEBUG_ENABLED) {
debug_log('session_timed_out(): Entered with (%s)', 1, $ldapserver->server_id);
}
# If session hasn't expired yet
if (isset($_SESSION['activity']['server'][$ldapserver->server_id])) {
# If $session_timeout not defined, use (session_cache_expire() - 1)
if (!isset($ldapserver->session_timeout)) {
$session_timeout = session_cache_expire() - 1;
} else {
$session_timeout = $ldapserver->session_timeout;
}
# Get the $last_activity and $rightframe_server_id value
$last_activity = $_SESSION['activity']['server'][$ldapserver->server_id];
# If diff between current time and last activity greater than $session_timeout, log out user
if (time() - $last_activity > $session_timeout * 60) {
if (in_array($ldapserver->auth_type, array('cookie', 'session'))) {
syslog_notice('Logout for ' . $ldapserver->getLoggedInDN());
$ldapserver->unsetLoginDN() or pla_error(_('Could not logout.'));
}
return true;
} else {
return false;
}
}
}
示例4: pla_error
if (is_server_read_only($server_id)) {
pla_error("You cannot perform updates while server is in read-only mode");
}
check_server_id($server_id) or pla_error("Bad server_id: " . htmlspecialchars($server_id));
have_auth_info($server_id) or pla_error("Not enough information to login to server. Please check your configuration.");
// special case for binary attributes (like jpegPhoto and userCertificate):
// we must go read the data from the file and override $val with the binary data
if ($is_binary_val) {
$file = $_FILES['val']['tmp_name'];
$f = fopen($file, 'r');
$binary_data = fread($f, filesize($file));
fclose($f);
$val = $binary_data;
}
// Automagically hash new userPassword attributes according to the
// chosen in config.php.
if (0 == strcasecmp($attr, 'userpassword')) {
if ($servers[$server_id]['default_hash'] != '') {
$enc_type = $servers[$server_id]['default_hash'];
$new_val = password_hash($new_val, $enc_type);
$val = $new_val;
}
}
$ds = pla_ldap_connect($server_id) or pla_error("Could not connect to LDAP server");
$new_entry = array($attr => $val);
$result = @ldap_mod_add($ds, $dn, $new_entry);
if ($result) {
header("Location: edit.php?server_id={$server_id}&dn={$encoded_dn}&updated_attr={$encoded_attr}");
} else {
pla_error("Failed to add the attribute.", ldap_error($ds), ldap_errno($ds));
}
示例5: elseif
?>
</td>
</td>
</tr>
<tr>
<td colspan="3"><center><br /><input type="submit" value="Proceed >>" /></td>
</tr>
</table>
</center>
<?php
} elseif ($step == 2) {
$dc_name = trim($_POST['dc_name']);
$container = trim($_POST['container']);
$associateddomain = trim($_POST['associateddomain']);
dn_exists($server_id, $container) or pla_error("The container you specified (" . htmlspecialchars($container) . ") does not exist. " . "Please go back and try again.");
?>
<form action="create.php" method="post">
<input type="hidden" name="server_id" value="<?php
echo $server_id;
?>
" />
<input type="hidden" name="new_dn" value="<?php
echo htmlspecialchars('dc=' . $dc_name . ',' . $container);
?>
" />
<!-- ObjectClasses -->
<?php
$object_classes = rawurlencode(serialize(array('top', 'dnsdomain', 'domainRelatedObject')));
?>
示例6: htmlspecialchars
?>
</b></td></tr>
<tr><td class="val"><input type="text" name="new_attrs[<?php
echo htmlspecialchars($attr->getName());
?>
]" value="" size="40" /></tr>
<?php
}
?>
</table>
<br />
<br />
<center><input type="submit" value="<?php
echo _('Add ObjectClass and Attributes');
?>
" /></center>
</form>
</body>
</html>
<?php
} else {
$add_res = $ldapserver->attrModify($dn, array('objectClass' => $new_oclass));
if (!$add_res) {
pla_error("Could not perform ldap_mod_add operation.", $ldapserver->error(), $ldapserver->errno());
} else {
header(sprintf('Location: template_engine.php?server_id=%s&dn=%s&modified_attrs[]=objectClass', $ldapserver->server_id, $encoded_dn));
}
}
示例7: pla_error
*
* Variables that come in via common.php
* - server_id
* Variables that come in via GET variables
* - dn (rawurlencoded)
*
* @package phpLDAPadmin
*/
/**
*/
require './common.php';
if ($ldapserver->isReadOnly()) {
pla_error(_('You cannot perform updates while server is in read-only mode'));
}
if (!$ldapserver->haveAuthInfo()) {
pla_error(_('Not enough information to login to server. Please check your configuration.'));
}
$dn = $_GET['dn'];
$rdn = get_rdn($dn);
$attrs = $ldapserver->getDNAttrs($dn);
$select_server_html = server_select_list($ldapserver->server_id, true, 'dest_server_id');
$children = $ldapserver->getContainerContents($dn);
include './header.php';
# Draw some javaScrpt to enable/disable the filter field if this may be a recursive copy
if (is_array($children) && count($children) > 0) {
?>
<script type="text/javascript" language="javascript">
//<!--
function toggle_disable_filter_field(recursive_checkbox)
{
示例8: foreach
}
echo '</td>';
echo '<td width="50%">';
if (count($oclass->getMayAttrs($schema_oclasses)) > 0) {
echo '<ul class="schema">';
foreach ($oclass->getMayAttrs($schema_oclasses) as $attr) {
echo '<li>';
printf('<a href="?server_id=%s&view=attributes&viewvalue=%s">%s</a>', $ldapserver->server_id, rawurlencode(strtolower($attr->getName())), htmlspecialchars($attr->getName()));
if ($attr->getSource() != $oclass->getName()) {
echo '<br />';
printf('<small> (%s <a href="?server_id=%s&view=objectClasses&viewvalue=%s">%s</a>)</small>', _('Inherited from'), $ldapserver->server_id, strtolower($attr->getSource()), $attr->getSource());
}
echo '</li>';
}
echo '</ul>';
} else {
printf('<center>(%s)</center>', _('none'));
}
echo '</td>';
echo '</tr>';
echo '</table>';
}
}
/* End foreach objectClass */
break;
}
if (!is_null($viewvalue) && !$viewed) {
pla_error(sprintf(_('No such schema item: "%s"'), htmlspecialchars($viewvalue)));
}
echo '</body>';
echo '</html>';
示例9: copy_dn
function copy_dn($ldapserver_src, $ldapserver_dst, $dn_src, $dn_dst)
{
if (DEBUG_ENABLED) {
debug_log('copy_dn: Entered with (%s,%s,%s,%s)', 17, $ldapserver_src->server_id, $ldapserver_dst->server_id, $dn_src, $dn_dst);
}
$new_entry = $ldapserver_src->getDNAttrs($dn_src);
# modify the prefix-value (ie "bob" in cn=bob) to match the destination DN's value.
$rdn_attr = substr($dn_dst, 0, strpos($dn_dst, '='));
$rdn_value = get_rdn($dn_dst);
$rdn_value = substr($rdn_value, strpos($rdn_value, '=') + 1);
$new_entry[$rdn_attr] = $rdn_value;
# don't need a dn attribute in the new entry
unset($new_entry['dn']);
# Check the user-defined custom call back first
if (run_hook('pre_entry_create', array('server_id' => $ldapserver_dst->server_id, 'dn' => $dn_dst, 'attrs' => $new_entry))) {
$add_result = $ldapserver_dst->add($dn_dst, $new_entry);
if (!$add_result) {
run_hook('post_entry_create', array('server_id' => $ldapserver_dst->server_id, 'dn' => $dn_dst, 'attrs' => $new_entry));
echo '</small><br /><br />';
pla_error(_('Failed to copy DN: ') . $dn_dst, $ldapserver_dst->error(), $ldapserver_dst->errno());
}
return $add_result;
} else {
return false;
}
}
示例10: pla_error
pla_error(_('You cannot perform updates while server is in read-only mode'));
}
if (!$ldapserver->haveAuthInfo()) {
pla_error(_('Not enough information to login to server. Please check your configuration.'));
}
$dn = $_POST['dn'];
if (is_null($dn)) {
pla_error(_('You must specify a DN'));
}
if (!$ldapserver->dnExists($dn)) {
pla_error(sprintf(_('No such entry: %s'), '<b>' . pretty_print_dn($dn) . '</b>'));
}
# Check the user-defined custom callback first.
if (run_hook('pre_entry_delete', array('server_id' => $ldapserver->server_id, 'dn' => $dn))) {
$del_result = $ldapserver->delete($dn);
} else {
pla_error(sprintf(_('Could not delete the entry: %s'), '<b>' . pretty_print_dn($dn) . '</b>'));
}
if ($del_result) {
# Custom callback
run_hook('post_entry_delete', array('server_id' => $ldapserver->server_id, 'dn' => $dn));
include './header.php';
echo '<body>';
echo '<script type="text/javascript" language="javascript">parent.left_frame.location.reload();</script>';
echo '<br /><br />';
printf('<center>' . _('Entry %s deleted successfully.') . '</center>', '<b>' . pretty_print_dn($dn) . '</b>');
echo '</body>';
} else {
pla_error(sprintf(_('Could not delete the entry: %s'), '<b>' . pretty_print_dn($dn) . '</b>'), $ldapserver->error(), $ldapserver->errno());
}
echo '</html>';
示例11: isset
require 'common.php';
$container = isset($_GET['container']) ? rawurldecode($_GET['container']) : false;
$server_id = isset($_GET['server_id']) ? $_GET['server_id'] : false;
$return_form_element = $_GET['form_element'];
include "header.php";
echo "<h3 class=\"subtitle\">Automagic Entry Chooser</h3>\n";
if ($container) {
echo "Server: <b>" . htmlspecialchars($servers[$server_id]['name']) . "</b><br />\n";
echo "Looking in: <b>" . htmlspecialchars($container) . "</b><br />\n";
}
/* Has the use already begun to descend into a specific server tree? */
if ($server_id !== false && $container !== false) {
check_server_id($server_id) or pla_error("Bad server_id: " . htmlspecialchars($server_id));
have_auth_info($server_id) or pla_error("Not enough information to login to server. " . "Please check your configuration.");
pla_ldap_connect($server_id) or pla_error("Coult not connect to LDAP server.");
$dn_list = get_container_contents($server_id, $container);
$base_dn = $servers[$server_id]['base'];
if (!$base_dn) {
$base_dn = try_to_get_root_dn($server_id);
}
if ($container == $base_dn) {
$parent_container = false;
$up_href = "entry_chooser.php?form_element={$return_form_element}";
} else {
$parent_container = get_container($container);
$up_href = "entry_chooser.php?form_element={$return_form_element}&server_id={$server_id}&container=" . rawurlencode($parent_container);
}
echo " <a href=\"{$up_href}\" style=\"text-decoration:none\">" . "<img src=\"images/up.png\"> Back Up...</a><br />\n";
if (count($dn_list) == 0) {
echo " (no entries)<br />\n";
示例12: get_default_search_display
/**
* Return the default format for search results.
*
* @return string The format to use.
*/
function get_default_search_display()
{
if (DEBUG_ENABLED) {
debug_log('get_default_search_display(): Entered with ()', 1);
}
global $default_search_display;
if (!isset($default_search_display) || is_null($default_search_display)) {
return 'list';
} elseif (0 == strcasecmp($default_search_display, 'list')) {
return 'list';
} elseif (0 == strcasecmp($default_search_display, 'table')) {
return 'table';
} else {
pla_error(sprintf(_('Your config.php specifies an invalid value for $default_search_display: %s. Please fix it'), htmlspecialchars($default_search_display)));
}
}
示例13: rawurldecode
$dn = rawurldecode($_POST['dn']);
$encoded_dn = rawurlencode($dn);
$update_array = $_POST['update_array'];
check_server_id($server_id) or pla_error("Bad server_id: " . htmlspecialchars($server_id));
have_auth_info($server_id) or pla_error("Not enough information to login to server. Please check your configuration.");
is_array($update_array) or pla_error("update_array is malformed. This might be a phpLDAPadmin bug. Please report it.");
// check for delete attributes (indicated by the attribute entry appearing like this: attr => ''
foreach ($update_array as $attr => $val) {
if (!is_array($val)) {
if ($val == '') {
$update_array[$attr] = array();
} else {
$update_array[$attr] = $val;
}
} else {
foreach ($val as $i => $v) {
$update_array[$attr][$i] = $v;
}
}
}
$ds = pla_ldap_connect($server_id);
$res = @ldap_modify($ds, $dn, $update_array);
if ($res) {
$redirect_url = "edit.php?server_id={$server_id}&dn={$encoded_dn}";
foreach ($update_array as $attr => $junk) {
$redirect_url .= "&modified_attrs[]={$attr}";
}
header("Location: {$redirect_url}");
} else {
pla_error("Could not perform ldap_modify operation.", ldap_error($ds), ldap_errno($ds));
}
示例14: SetValue
function SetValue($server_id, $key, $index, $value)
{
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED) {
debug_log('%s::SetValue(): Entered with (%s,%s,%s,%s)', 3, get_class($this), $server_id, $key, $index, $value);
}
if (!isset($this->default->{$key})) {
pla_error("ERROR: Setting a key [{$key}] that isnt predefined.");
} else {
$default = $this->default->{$key};
}
if (!isset($default[$index])) {
pla_error("ERROR: Setting a index [{$index}] that isnt predefined.");
} else {
$default = $default[$index];
}
# Test if its should be an array or not.
if (is_array($default['default']) && !is_array($value)) {
pla_error("Error in configuration file, {$key}['{$index}'] SHOULD be an array of values.");
}
if (!is_array($default['default']) && is_array($value)) {
pla_error("Error in configuration file, {$key}['{$index}'] should NOT be an array of values.");
}
# Some special processing.
if ($key == 'server') {
switch ($index) {
case 'host':
if (strstr($value, "ldapi://")) {
$this->_ldapservers[$server_id][$key]['port'] = false;
}
break;
}
}
$this->_ldapservers[$server_id][$key][$index] = $value;
}
示例15: rawurldecode
$decoded_dn = rawurldecode($dn);
$encoded_dn = rawurlencode($decoded_dn);
$modified_attrs = isset($_GET['modified_attrs']) ? $_GET['modified_attrs'] : false;
$server_id = $_GET['server_id'];
$show_internal_attrs = isset($_GET['show_internal_attrs']) ? true : false;
$rdn = pla_explode_dn($dn);
$rdn = $rdn[0];
check_server_id($server_id) or pla_error("Bad server_id: " . htmlspecialchars($server_id));
have_auth_info($server_id) or pla_error("Not enough information to login to server. Please check your configuration.");
pla_ldap_connect($server_id) or pla_error("Coult not connect to LDAP server.");
$friendly_attrs = process_friendly_attr_table();
$attrs = get_object_attrs($server_id, $dn);
pla_ldap_connect($server_id) or pla_error("Could not connect to LDAP server");
$system_attrs = get_entry_system_attrs($server_id, $dn);
if (!$attrs) {
pla_error("No such dn, " . htmlspecialchars(utf8_decode($dn)));
}
$server_name = $servers[$server_id]['name'];
// build a list of attributes available for this object based on its objectClasses
$oclasses = get_object_attr($server_id, $dn, 'objectClass');
if (!is_array($oclasses)) {
$oclasses = array($oclasses);
}
$avail_attrs = array();
$schema_oclasses = get_schema_objectclasses($server_id, true);
$schema_attrs = get_schema_attributes($server_id);
foreach ($oclasses as $oclass) {
$avail_attrs = array_merge($schema_oclasses[strtolower($oclass)]['must_attrs'], $schema_oclasses[strtolower($oclass)]['may_attrs'], $avail_attrs);
}
$avail_attrs = array_unique($avail_attrs);
$avail_attrs = array_filter($avail_attrs, "not_an_attr");