コード例 #1
0
ファイル: RemoteApi.php プロジェクト: dabielkabuto/eventum
 /**
  * @param int $file_id
  * @return struct
  * @access protected
  */
 public function getFile($file_id)
 {
     $res = Attachment::getDetails($file_id);
     if (empty($res)) {
         throw new RemoteApiException('The requested file could not be found');
     }
     return $res;
 }
コード例 #2
0
ファイル: class.support.php プロジェクト: korusdipl/eventum
 /**
  * Method used to build the headers of a web-based message.
  *
  * @param   integer $issue_id The issue ID
  * @param   string $message_id The message-id
  * @param   string $from The sender of this message
  * @param   string $to The primary recipient of this message
  * @param   string $cc The extra recipients of this message
  * @param   string $body The message body
  * @param   string $in_reply_to The message-id that we are replying to
  * @param   array $iaf_ids Array with attachment file id-s
  * @return  string The full email
  */
 public static function buildFullHeaders($issue_id, $message_id, $from, $to, $cc, $subject, $body, $in_reply_to, $iaf_ids = null)
 {
     // hack needed to get the full headers of this web-based email
     $mail = new Mail_Helper();
     $mail->setTextBody($body);
     // FIXME: $body unused, but does mime->get() have side effects?
     $body = $mail->mime->get(array('text_charset' => APP_CHARSET, 'head_charset' => APP_CHARSET, 'text_encoding' => APP_EMAIL_ENCODING));
     if (!empty($issue_id)) {
         $mail->setHeaders(array('Message-Id' => $message_id));
     } else {
         $issue_id = 0;
     }
     // if there is no existing in-reply-to header, get the root message for the issue
     if ($in_reply_to == false && !empty($issue_id)) {
         $in_reply_to = Issue::getRootMessageID($issue_id);
     }
     if ($in_reply_to) {
         $mail->setHeaders(array('In-Reply-To' => $in_reply_to));
     }
     if ($iaf_ids) {
         foreach ($iaf_ids as $iaf_id) {
             $attachment = Attachment::getDetails($iaf_id);
             $mail->addAttachment($attachment['iaf_filename'], $attachment['iaf_file'], $attachment['iaf_filetype']);
         }
     }
     $cc = trim($cc);
     if (!empty($cc)) {
         $cc = str_replace(',', ';', $cc);
         $ccs = explode(';', $cc);
         foreach ($ccs as $address) {
             if (!empty($address)) {
                 $mail->addCc($address);
             }
         }
     }
     return $mail->getFullHeaders($from, $to, $subject);
 }
コード例 #3
0
ファイル: download.php プロジェクト: juliogallardo1326/proc
// | 59 Temple Place - Suite 330                                          |
// | Boston, MA 02111-1307, USA.                                          |
// +----------------------------------------------------------------------+
// | Authors: João Prado Maia <*****@*****.**>                             |
// +----------------------------------------------------------------------+
//
// @(#) $Id: s.download.php 1.14 04/01/26 20:37:04-06:00 joao@kickass. $
//
include_once "config.inc.php";
include_once APP_INC_PATH . "class.auth.php";
include_once APP_INC_PATH . "class.attachment.php";
include_once APP_INC_PATH . "db_access.php";
Auth::checkAuthentication(APP_COOKIE);
if (stristr(APP_BASE_URL, 'https:')) {
    // fix for IE 5.5/6 with SSL sites
    header('Pragma: cache');
}
// fix for IE6 (KB812935)
header('Cache-Control: must-revalidate');
if ($HTTP_GET_VARS['cat'] == 'attachment') {
    $file = Attachment::getDetails($HTTP_GET_VARS["id"]);
    if (!empty($file)) {
        if (!Issue::canAccess($file['iat_iss_id'], Auth::getUserID())) {
            $tpl = new Template_API();
            $tpl->setTemplate("permission_denied.tpl.html");
            $tpl->displayTemplate();
            exit;
        }
        Attachment::outputDownload($file['iaf_file'], $file["iaf_filename"], $file['iaf_filesize'], $file['iaf_filetype']);
    }
}
コード例 #4
0
ファイル: xmlrpc.php プロジェクト: juliogallardo1326/proc
function getFile($p)
{
    $email = XML_RPC_decode($p->getParam(0));
    $password = XML_RPC_decode($p->getParam(1));
    $auth = authenticate($email, $password);
    if (is_object($auth)) {
        return $auth;
    }
    $file_id = XML_RPC_decode($p->getParam(2));
    $res = Attachment::getDetails($file_id);
    if (empty($res)) {
        return new XML_RPC_Response(0, $XML_RPC_erruser + 1, "The requested file could not be found");
    } else {
        $res['iaf_file'] = base64_encode($res['iaf_file']);
        return new XML_RPC_Response(XML_RPC_Encode($res));
    }
}
コード例 #5
0
ファイル: download.php プロジェクト: korusdipl/eventum
// |                                                                      |
// | You should have received a copy of the GNU General Public License    |
// | along with this program; if not, write to:                           |
// |                                                                      |
// | Free Software Foundation, Inc.                                       |
// | 51 Franklin Street, Suite 330                                          |
// | Boston, MA 02110-1301, USA.                                          |
// +----------------------------------------------------------------------+
// | Authors: João Prado Maia <*****@*****.**>                             |
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../init.php';
Auth::checkAuthentication(APP_COOKIE);
if (stristr(APP_BASE_URL, 'https:')) {
    // fix for IE 5.5/6 with SSL sites
    header('Pragma: cache');
}
// fix for IE6 (KB812935)
header('Cache-Control: must-revalidate');
if ($_GET['cat'] == 'attachment') {
    $file = Attachment::getDetails($_GET['id']);
    if (!empty($file)) {
        if (!Issue::canAccess($file['iat_iss_id'], Auth::getUserID())) {
            $tpl = new Template_Helper();
            $tpl->setTemplate('permission_denied.tpl.html');
            $tpl->displayTemplate();
            exit;
        }
        $force_inline = filter_input(INPUT_GET, 'force_inline');
        Attachment::outputDownload($file['iaf_file'], $file['iaf_filename'], $file['iaf_filesize'], $file['iaf_filetype'], $force_inline);
    }
}