X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fcontacts.php;h=0ddcac70f43ac7a5abca92200b908543a2bc6d82;hb=6edc52f78f12f366f344eb86723d39b92a77a9ff;hp=ffd43434c321e2fa72b98bbd812abb0a15d7f9db;hpb=b58189bb98a3583f3be66e986bd84bc68f01b78d;p=friendica.git diff --git a/mod/contacts.php b/mod/contacts.php index ffd43434c3..0ddcac70f4 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -225,6 +225,36 @@ function contacts_content(&$a) { if($cmd === 'drop') { + // Check if we should do HTML-based delete confirmation + if($_REQUEST['confirm']) { + //
can't take arguments in its "action" parameter + // so add any arguments as hidden inputs + $query = explode_querystring($a->query_string); + $inputs = array(); + foreach($query['args'] as $arg) { + if(strpos($arg, 'confirm=') === false) { + $arg_parts = explode('=', $arg); + $inputs[] = array('name' => $arg_parts[0], 'value' => $arg_parts[1]); + } + } + + $a->page['aside'] = ''; + return replace_macros(get_markup_template('confirm.tpl'), array( + '$method' => 'get', + '$message' => t('Do you really want to delete this contact?'), + '$extra_inputs' => $inputs, + '$confirm' => t('Yes'), + '$confirm_url' => $query['base'], + '$confirm_name' => 'confirmed', + '$cancel' => t('Cancel'), + )); + } + // Now check how the user responded to the confirmation query + if($_REQUEST['canceled']) { + goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']); + + } + require_once('include/Contact.php'); terminate_friendship($a->user,$a->contact,$orig_record[0]); @@ -239,6 +269,10 @@ function contacts_content(&$a) { } } + + + $_SESSION['return_url'] = $a->query_string; + if((x($a->data,'contact')) && (is_array($a->data['contact']))) { $contact_id = $a->data['contact']['id']; @@ -405,8 +439,6 @@ function contacts_content(&$a) { $ignored = false; $all = false; - $_SESSION['return_url'] = $a->query_string; - if(($a->argc == 2) && ($a->argv[1] === 'all')) { $sql_extra = ''; $all = true;