Code Duplication    Length = 23-25 lines in 2 locations

mod/contactform/include/class.phpmailer.php 2 locations

@@ 1124-1146 (lines=23) @@
1121
   * @param string $type File extension (MIME) type.
1122
   * @return bool
1123
   */
1124
  function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
1125
    if(!@is_file($path)) {
1126
      $this->SetError($this->Lang('file_access') . $path);
1127
      return false;
1128
    }
1129
1130
    $filename = basename($path);
1131
    if($name == '') {
1132
      $name = $filename;
1133
    }
1134
1135
    $cur = count($this->attachment);
1136
    $this->attachment[$cur][0] = $path;
1137
    $this->attachment[$cur][1] = $filename;
1138
    $this->attachment[$cur][2] = $name;
1139
    $this->attachment[$cur][3] = $encoding;
1140
    $this->attachment[$cur][4] = $type;
1141
    $this->attachment[$cur][5] = false; // isStringAttachment
1142
    $this->attachment[$cur][6] = 'attachment';
1143
    $this->attachment[$cur][7] = 0;
1144
1145
    return true;
1146
  }
1147
1148
  /**
1149
   * Attaches all fs, string, and binary attachments to the message.
@@ 1484-1508 (lines=25) @@
1481
   * @param string $type File extension (MIME) type.
1482
   * @return bool
1483
   */
1484
  function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
1485
1486
    if(!@is_file($path)) {
1487
      $this->SetError($this->Lang('file_access') . $path);
1488
      return false;
1489
    }
1490
1491
    $filename = basename($path);
1492
    if($name == '') {
1493
      $name = $filename;
1494
    }
1495
1496
    /* Append to $attachment array */
1497
    $cur = count($this->attachment);
1498
    $this->attachment[$cur][0] = $path;
1499
    $this->attachment[$cur][1] = $filename;
1500
    $this->attachment[$cur][2] = $name;
1501
    $this->attachment[$cur][3] = $encoding;
1502
    $this->attachment[$cur][4] = $type;
1503
    $this->attachment[$cur][5] = false;
1504
    $this->attachment[$cur][6] = 'inline';
1505
    $this->attachment[$cur][7] = $cid;
1506
1507
    return true;
1508
  }
1509
1510
  /**
1511
   * Returns true if an inline attachment is present.