/** * Challenge password for a visitor. * @param $password password to be challenged * @return true if password is valid, false otherwise. */ function Pingouin_challenge_upload_password($cfg, $password) { if (!Pingouin_has_upload_password($cfg)) { return false; } foreach ($cfg['upload_password'] as $p) { if ($password == $p) { return true; } } return false; }
if (isset($_POST['new_password'])) { $new_password = $_POST['new_password']; } echo Pingouin_alias_update($_POST['alias'], $_POST['destination'], $_POST['password'], $new_password, get_ip_address($cfg)); } elseif (isset($_GET['alias_delete'])) { if (!isset($_POST['alias']) || !isset($_POST['password'])) { echo 'Error'; exit; } echo Pingouin_alias_delete($_POST['alias'], $_POST['password']); } elseif (isset($_GET['init_async'])) { if (!Pingouin_challenge_upload_ip($cfg, get_ip_address($cfg))) { echo 'Error'; exit; } if (Pingouin_has_upload_password($cfg) && (!isset($_POST['upload_password']) || !Pingouin_challenge_upload_password($cfg, $_POST['upload_password']))) { echo 'Error'; exit; } if (!isset($_POST['filename'])) { echo 'Error'; exit; } $type = ''; if (isset($_POST['type'])) { $type = $_POST['type']; } $key = ''; if (isset($_POST['key'])) { $key = $_POST['key']; }
document.getElementById('upload').style.display = 'none'; document.getElementById('uploading').style.display = ''; upload ('<?php echo $cfg['web_root']; ?> ', <?php echo Pingouin_get_max_upload_size_bytes(); ?> ); "/> </p> </table> </div> </fieldset> <?php if (Pingouin_has_upload_password($cfg)) { ?> <form action = "<?php echo basename(__FILE__); ?> " method = "post"> <input type = "hidden" name = "action" value = "logout"/> <input type = "submit" value = "<?php echo t('Logout'); ?> " /> </form> <?php } ?>