19
19
require './common.php';
21
21
if ($ldapserver->isReadOnly())
22
pla_error(_('You cannot perform updates while server is in read-only mode'));
22
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
24
24
if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add'))
25
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute')));
25
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute')),'error','index.php');
27
28
$entry['val'] = get_request('val','POST');
28
29
$entry['binary'] = get_request('binary','POST');
48
49
$href = htmlspecialchars(sprintf('cmd.php?cmd=search&search=true&form=advanced&server_id=%s&filter=%s=%s',
49
50
$ldapserver->server_id,$entry['attr']['string'],$badattr));
51
pla_error(sprintf(_('Your attempt to add <b>%s</b> (<i>%s</i>) to <br><b>%s</b><br> is NOT allowed. That attribute/value belongs to another entry.<p>You might like to <a href=\'%s\'>search</a> for that entry.'),$entry['attr']['string'],$badattr,$entry['dn']['string'],$href));
52
error(sprintf(_('Your attempt to add <b>%s</b> (<i>%s</i>) to <br><b>%s</b><br> is NOT allowed. That attribute/value belongs to another entry.<p>You might like to <a href=\'%s\'>search</a> for that entry.'),$entry['attr']['string'],$badattr,$entry['dn']['string'],$href),'error','index.php');
54
55
if (strlen($entry['binary']) > 0) {
55
56
if ($_FILES['val']['size'] == 0)
56
pla_error(_('The file you chose is either empty or does not exist. Please go back and try again.'));
57
error(_('The file you chose is either empty or does not exist. Please go back and try again.'),'error','index.php');
58
59
if (! is_uploaded_file($_FILES['val']['tmp_name'])) {
59
60
if (isset($_FILES['val']['error']))
61
62
switch($_FILES['val']['error']) {
62
63
case 0: # No error; possible file attack!
63
pla_error(_('Security error: The file being uploaded may be malicious.'));
64
error(_('Security error: The file being uploaded may be malicious.'),'error','index.php');
66
67
case 1: # Uploaded file exceeds the upload_max_filesize directive in php.ini
67
pla_error(_('The file you uploaded is too large. Please check php.ini, upload_max_size setting'));
68
error(_('The file you uploaded is too large. Please check php.ini, upload_max_size setting'),'error','index.php');
70
71
case 2: # Uploaded file exceeds the MAX_FILE_SIZE directive specified in the html form
71
pla_error(_('The file you uploaded is too large. Please check php.ini, upload_max_size setting'));
72
error(_('The file you uploaded is too large. Please check php.ini, upload_max_size setting'),'error','index.php');
74
75
case 3: # Uploaded file was only partially uploaded
75
pla_error(_('The file you selected was only partially uploaded, likley due to a network error.'));
76
error(_('The file you selected was only partially uploaded, likley due to a network error.'),'error','index.php');
78
79
case 4: # No file was uploaded
79
pla_error(_('You left the attribute value blank. Please go back and try again.'));
80
error(_('You left the attribute value blank. Please go back and try again.'),'error','index.php');
82
83
default: # A default error, just in case! :)
83
pla_error(_('Security error: The file being uploaded may be malicious.'));
84
error(_('Security error: The file being uploaded may be malicious.'),'error','index.php');
88
pla_error(_('Security error: The file being uploaded may be malicious.'));
89
error(_('Security error: The file being uploaded may be malicious.'),'error','index.php');
91
92
$binaryfile['name'] = $_FILES['val']['tmp_name'];