public function attachments($s) { $html = ''; $id = (int) $_GET['a']; $q = mysql_query("SELECT *,\n `" . DB_PREFIX . "faqattach`.`id` AS `attachID`\n\t\t FROM `" . DB_PREFIX . "faqassign`\n LEFT JOIN `" . DB_PREFIX . "faqattach`\n ON `" . DB_PREFIX . "faqassign`.`itemID` = `" . DB_PREFIX . "faqattach`.`id`\n WHERE `" . DB_PREFIX . "faqassign`.`question` = '{$id}'\n\t\t AND `" . DB_PREFIX . "faqassign`.`desc` = 'attachment'\n GROUP BY `" . DB_PREFIX . "faqassign`.`itemID`\n ORDER BY `" . DB_PREFIX . "faqattach`.`orderBy`\n ") or die(mswMysqlErrMsg(mysql_errno(), mysql_error(), __LINE__, __FILE__)); while ($ATT = mysql_fetch_object($q)) { $ext = substr(strrchr($ATT->path ? $ATT->path : $ATT->remote, '.'), 1); $html .= str_replace(array('{url}', '{name}', '{name_alt}', '{size}', '{filetype}'), array($ATT->remote ? $ATT->remote : '?fattachment=' . $ATT->attachID, $ATT->name ? mswCleanData($ATT->name) : ($ATT->remote ? basename($ATT->remote) : $ATT->path), $ATT->name ? mswSpecialChars($ATT->name) : ($ATT->remote ? basename($ATT->remote) : $ATT->path), mswFileSizeConversion($ATT->size), strtoupper($ext)), file_get_contents(PATH . 'content/' . MS_TEMPLATE_SET . '/html/faq-attachment-link.htm')) . mswDefineNewline(); } return $html ? $html : ''; }
Data here is applicable to view ticket/dispute and create ticket screens ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ if (!defined('PARENT') || !defined('MS_PERMISSIONS')) { $HEADERS->err403(); } // JS/CSS.. $ms_js_css_loader['bbcode'] = 'yes'; $ms_js_css_loader['alertify'] = 'yes'; // Attachment types seperator.. $ATTACH_TYPES_SEPERATOR = ' , '; // Attachment restrictions.. $attachRestrictions = ''; if ($SETTINGS->filetypes) { $attachRestrictions = str_replace(array('{text}', '{info}'), array($msg_newticket34, str_replace('|', $ATTACH_TYPES_SEPERATOR, str_replace('.', '', $SETTINGS->filetypes))), file_get_contents(PATH . 'content/' . MS_TEMPLATE_SET . '/html/ticket-attachment-restrictions.htm')); } if ($SETTINGS->maxsize > 0 || $SETTINGS->attachboxes > 0) { $attachRestrictions .= str_replace(array('{text}', '{info}'), array($msg_newticket35, ($SETTINGS->attachboxes > 0 ? $SETTINGS->attachboxes : $msg_public_ticket2) . ' / ' . ($SETTINGS->maxsize > 0 ? mswFileSizeConversion($SETTINGS->maxsize) : $msg_public_ticket2)), file_get_contents(PATH . 'content/' . MS_TEMPLATE_SET . '/html/ticket-attachment-restrictions.htm')); } // System messages.. if (isset($_GET['msg'])) { switch ($_GET['msg']) { case 'added': $ticketSystemMsg = $msg_public_ticket12; break; case 'replied': $ticketSystemMsg = $msg_showticket7; break; } }
?> ><?php echo $i; ?> </option> <?php } ?> </select></td> <td> <?php echo $ATT->name ? mswSpecialChars($ATT->name) : ($ATT->remote ? $ATT->remote : $ATT->path); ?> <span class="tdCellInfo"> <?php echo str_replace(array('{type}', '{size}'), array(strtoupper(substr(strrchr(strtolower($ATT->remote ? $ATT->remote : $ATT->path), '.'), 1)), $ATT->size > 0 ? mswFileSizeConversion($ATT->size) : 'N/A'), $msg_attachments11); ?> </span> </td> <td><a href="?p=faqman&attached=<?php echo $ATT->id; ?> "><?php echo @number_format($ATT->queCount); ?> </a></td> <td class="ms-options-links"> <span class="enableDisable"><i class="<?php echo $ATT->enAtt == 'yes' ? 'icon-flag' : 'icon-flag-alt'; ?> " onclick="ms_enableDisable(this,'<?php
if (strpos($SETTINGS->backupEmails, ',') !== false) { // Multiple addresses.. $emails = array_map('trim', explode(',', $SETTINGS->backupEmails)); // First email is main address.. if (isset($emails[0])) { $em = $emails[0]; // Now remove it from array.. unset($emails[0]); } // Implode additional addresses.. if (!empty($emails)) { $em_add = implode(',', $emails); } } else { // Just main address.. $em = $SETTINGS->backupEmails; } if ($em) { $MSMAIL->addTag('{HELPDESK}', mswCleanData($SETTINGS->website)); $MSMAIL->addTag('{DATE_TIME}', $MSDT->mswDateTimeDisplay($MSDT->mswTimeStamp(), $SETTINGS->dateformat) . ' @ ' . $MSDT->mswDateTimeDisplay($MSDT->mswTimeStamp(), $SETTINGS->timeformat)); $MSMAIL->addTag('{VERSION}', SCRIPT_VERSION); $MSMAIL->addTag('{FILE}', basename($filepath)); $MSMAIL->addTag('{SCRIPT}', SCRIPT_NAME); $MSMAIL->addTag('{SIZE}', mswFileSizeConversion(@filesize($filepath))); $MSMAIL->attachments[$filepath] = basename($filepath); $MSMAIL->sendMSMail(array('from_email' => $SETTINGS->email, 'from_name' => $SETTINGS->website, 'to_email' => $em, 'to_name' => $em, 'subject' => str_replace(array('{website}'), array($SETTINGS->website), $emailSubjects['db-backup']), 'replyto' => array('name' => $SETTINGS->website, 'email' => $SETTINGS->replyto ? $SETTINGS->replyto : $SETTINGS->email), 'template' => PATH . 'content/language/' . $SETTINGS->language . '/mail-templates/backup.txt', 'language' => $SETTINGS->language, 'alive' => $em_add ? 'yes' : 'no', 'add-emails' => $em_add)); // Remove file.. @unlink($filepath); } } echo $msg_script32;
?> <td>[<?php echo substr(strtoupper($ext), 1); ?> ] <a href="?attachment=<?php echo $ATT->id; ?> " title="<?php echo mswSpecialChars($msg_viewticket50); ?> "><?php echo substr($ATT->fileName, 0, strpos($ATT->fileName, '.')); ?> </a></td> <td><?php echo mswFileSizeConversion($ATT->fileSize); ?> </td> </tr> <?php } ?> </tbody> </table> <?php if (USER_DEL_PRIV == 'yes') { ?> <div class="btn-toolbar" style="margin-top:0;padding-top:0;text-align:center" id="but_ar_<?php echo $aTickID; ?>
$folder = $MSAPI->uploadEmailAttachment($n, strtr($file, ' ', '+')); if ($folder && file_exists($SETTINGS->attachpath . '/' . $folder . $n)) { $fSize = filesize($SETTINGS->attachpath . '/' . $folder . $n); if ($fSize > 0) { if (!$MSTICKET->size($fSize)) { $MSAPI->log('[' . strtoupper($MSAPI->handler) . '] Size (' . mswFileSizeConversion($fSize) . ') too big and attachment ignored/deleted'); @unlink($SETTINGS->attachpath . '/' . $folder . $n); } else { // Try and determine mime type.. $mime = $DL->mime($SETTINGS->attachpath . '/' . $folder . $n, ''); $MSAPI->log('[' . strtoupper($MSAPI->handler) . '] Mime type determined as ' . $mime); // Add attachment data to database.. $atID = $MSAPI->addAttachmentToDB($ID, 0, $n, $fSize, $deptID, $mime); if ($atID > 0) { $attString[] = $SETTINGS->scriptpath . '/?attachment=' . $atID; $MSAPI->log('[' . strtoupper($MSAPI->handler) . '] Attachment (' . basename($n) . ') accepted. ID: ' . $atID . ' @ ' . mswFileSizeConversion($fSize)); } else { $MSAPI->log('[' . strtoupper($MSAPI->handler) . '] Fatal error, attachment could not be added: ' . mysql_error()); } } } else { $MSAPI->log('[' . strtoupper($MSAPI->handler) . '] File size of attachment 0 bytes. Ignored. Maybe permissions or error reading file.'); } } } } else { $MSAPI->log('[' . strtoupper($MSAPI->handler) . '] No attachments found.'); } // Write log entry.. $MSAPI->log('[' . strtoupper($MSAPI->handler) . '] Writing to history log if enabled.'); $MSTICKET->historyLog($ID, str_replace(array('{visitor}'), array($name), $msg_ticket_history['new-ticket-visitor-api']));
public function attachments($ticket, $reply = 0) { $data = ''; // Are attachments enabled? if ($this->settings->attachment == 'no') { return ''; } $q = mysql_query("SELECT *,DATE(FROM_UNIXTIME(`ts`)) AS `addDate` FROM `" . DB_PREFIX . "attachments`\n WHERE `ticketID` = '{$ticket}'\n AND `replyID` = '{$reply}'\n ORDER BY `id`\n ") or die(mswMysqlErrMsg(mysql_errno(), mysql_error(), __LINE__, __FILE__)); if (mysql_num_rows($q) > 0) { while ($ATT = mysql_fetch_object($q)) { $split = explode('-', $ATT->addDate); $base = $this->settings->attachpath . '/'; // Check for newer folder structure.. if (file_exists($this->settings->attachpath . '/' . $split[0] . '/' . $split[1] . '/' . $ATT->fileName)) { $base = $this->settings->attachpath . '/' . $split[0] . '/' . $split[1] . '/'; } $fileName = substr($ATT->fileName, 0, strpos($ATT->fileName, '.')); // Only show file if it exists.. if (file_exists($base . $ATT->fileName)) { $data .= str_replace(array('{ext}', '{id}', '{file}', '{size}', '{file_name}'), array(substr(strrchr(strtoupper($ATT->fileName), '.'), 1), $ATT->id, substr($ATT->fileName, 0, strpos($ATT->fileName, '.')), mswFileSizeConversion($ATT->fileSize), tickets::ATTACH_FILE_NAME_TRUNCATION > 0 ? strlen($fileName) > tickets::ATTACH_FILE_NAME_TRUNCATION ? substr($fileName, 0, tickets::ATTACH_FILE_NAME_TRUNCATION) . '..' : $fileName : $fileName), file_get_contents(PATH . 'content/' . MS_TEMPLATE_SET . '/html/ticket-attachment.htm')); } } } return $data ? trim($data) : ''; }
<th style="width:77%"><?php echo $msg_attachments16; ?> </th> <th style="width:17%"><?php echo $msg_kbase49; ?> </th> </tr> </thead> <tbody> <?php if (mysql_num_rows($qA) > 0) { while ($ATT = mysql_fetch_object($qA)) { $ext = substr(strrchr(strtolower($ATT->remote ? $ATT->remote : $ATT->path), '.'), 1); $info = '[' . strtoupper($ext) . '] ' . ($ATT->size > 0 ? mswFileSizeConversion($ATT->size) : 'N/A'); ?> <tr> <td><input type="checkbox" name="att[]" value="<?php echo $ATT->id; ?> "<?php echo mswCheckedArrItem($attachments, $ATT->id); ?> ></td> <td><?php echo $ATT->name ? mswSpecialChars($ATT->name) : ($ATT->remote ? $ATT->remote : $ATT->path); ?> </td> <td><a href="?fattachment=<?php echo $ATT->id;
if ($folder && file_exists($SETTINGS->attachpath . '/' . $folder . $n)) { $fSize = filesize($SETTINGS->attachpath . '/' . $folder . $n); if ($fSize > 0) { if (!$MSTICKET->size($fSize)) { $MSIMAP->log('Size (' . mswFileSizeConversion($fSize) . ') too big and attachment ignored/deleted'); @unlink($SETTINGS->attachpath . '/' . $folder . $n); } else { // Try and determine mime type.. $mime = $DL->mime($attachments[$aCount]['file'], ''); $MSIMAP->log('Mime type determined as ' . $mime); // Add attachment data to database.. $atID = $MSIMAP->addAttachmentToDB($ID, $replyID, $n, $fSize, $mime); if ($atID > 0) { $pipes[3] = ++$pipes[3]; $attString[] = $SETTINGS->scriptpath . '/?attachment=' . $atID; $MSIMAP->log('Attachment (' . basename($n) . ') accepted. ID: ' . $atID . ' @ ' . mswFileSizeConversion($fSize)); } else { $MSIMAP->log('Fatal error, attachment could not be added: ' . mysql_error()); } } } else { $MSIMAP->log('File size 0 bytes, ignored.'); } } } else { $MSIMAP->log('Type (' . strrchr(strtolower($attachments[$aCount]['file']), '.') . ') invalid and attachment ignored.'); } } } } else { $MSIMAP->log('Attachments not enabled and ignored');
} ?> </tbody> </table> </div> <div class="well" style="margin-bottom:10px;padding-bottom:0"> <div class="row-fluid"> <div class="span5"> <label class="checkbox"> <input type="checkbox" name="download" value="yes" checked="checked"> <?php echo $msg_backup11; ?> <b>(<?php echo $msg_settings102 . ' ' . mswFileSizeConversion($totalBackup); ?> )</b> </label> <label class="checkbox"> <input type="checkbox" name="compress" value="yes"> <?php echo $msg_backup13; ?> <b>(GZ)</b> </label> </div> <div class="span7"> <label><?php echo $msg_backup12; ?> :</label>