*  - val
 *  - binary
 */
require 'common.php';
$dn = rawurldecode($_POST['dn']);
$server_id = $_POST['server_id'];
$attr = $_POST['attr'];
$val = $_POST['val'];
$val = utf8_encode($val);
$encoded_dn = rawurlencode($dn);
$encoded_attr = rawurlencode($attr);
$is_binary_val = isset($_POST['binary']) ? true : false;
if (!$is_binary_val && $val == "") {
    pla_error("You left the attribute value blank. Please go back and try again.");
}
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.
Esempio n. 2
0
 * Copies a given object to create a new one.
 *
 * Vars that come in as POST vars
 *  - source_dn (rawurlencoded)
 *  - new_dn (form element)
 *  - server_id
 */
require 'common.php';
session_start();
$source_dn = rawurldecode($_POST['old_dn']);
$dest_dn = utf8_encode($_POST['new_dn']);
$encoded_dn = rawurlencode($old_dn);
$source_server_id = $_POST['server_id'];
$dest_server_id = $_POST['dest_server_id'];
$do_recursive = isset($_POST['recursive']) && $_POST['recursive'] == 'on' ? true : false;
if (is_server_read_only($dest_server_id)) {
    pla_error("You cannot perform updates while server is in read-only mode");
}
check_server_id($source_server_id) or pla_error("Bad server_id: " . htmlspecialchars($source_server_id));
have_auth_info($source_server_id) or pla_error("Not enough information to login to server. Please check your configuration.");
check_server_id($dest_server_id) or pla_error("Bad server_id: " . htmlspecialchars($dest_server_id));
have_auth_info($dest_server_id) or pla_error("Not enough information to login to server. Please check your configuration.");
include 'header.php';
/* Error checking */
if (0 == strlen(trim($dest_dn))) {
    pla_error("You left the destination DN blank.");
}
if (strcasecmp($source_dn, $dest_dn) == 0 && $source_server_id == $dest_server_id) {
    pla_error("The source and destination DN are the same.");
}
if ($do_recursive) {