+ function ClearAttachments() {
+ global $username, $attachments, $attachment_dir;
+ $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
+
+ foreach ($attachments as $info) {
+ $attached_file = "$hashed_attachment_dir/$info[localfilename]";
+ if (file_exists($attached_file)) {
+ unlink($attached_file);
+ }
+ }
+
+ $attachments = array();
+ }
+
+ function getReplyCitation($orig_from) {
+ global $reply_citation_style, $reply_citation_start, $reply_citation_end;
+
+ /* First, return an empty string when no citation style selected. */
+ if (($reply_citation_style == '') || ($reply_citation_style == 'none')) {
+ return ('');
+ }
+
+ /* Decode the users name. */
+ $parpos = strpos($orig_from, '(');
+ if ($parpos === false) {
+ $orig_from = trim(substr($orig_from, 0, strpos($orig_from, '<')));
+ $orig_from = str_replace('"', '', $orig_from);
+ $orig_from = str_replace("'", '', $orig_from);
+ } else {
+ $end_parpos = strrpos($orig_from, ')');
+ $end_parpos -= ($end_parpos === false ? $end_parpos : $parpos + 1);
+ $orig_from = trim(substr($orig_from, $parpos + 1, $end_parpos));
+ }
+
+ /* Make sure our final value isn't an empty string. */
+ if ($orig_from == '') {
+ return ('');
+ }
+
+ /* Otherwise, try to select the desired citation style. */
+ switch ($reply_citation_style) {
+ case 'author_said':
+ $start = '';
+ $end = ' ' . _("said") . ':';
+ break;
+ case 'quote_who':
+ $start = '<' . _("quote") . ' ' . _("who") . '="';
+ $end = '">';
+ break;
+ case 'user-defined':
+ $start = $reply_citation_start;
+ $end = $reply_citation_end;
+ break;
+ default: return ('');
+ }
+
+ /* Build and return the citation string. */
+ return ($start . $orig_from . $end . "\n");
+ }
+?>