示例#1
0
 function display($tpl = null)
 {
     $fileid = FSS_Input::getInt('fileid');
     $key = FSS_Input::getCmd('key');
     $decoded = FSS_Helper::decrypt(FSS_Helper::base64url_decode($key), FSS_Helper::getEncKey("file"));
     if ($fileid != $decoded) {
         exit;
     }
     $db = JFactory::getDBO();
     $sql = "SELECT * FROM #__fss_ticket_attach WHERE id = " . $fileid;
     $db->setQuery($sql);
     $attach = $db->loadObject();
     $image = in_array(strtolower(pathinfo($attach->filename, PATHINFO_EXTENSION)), array('jpg', 'jpeg', 'png', 'gif'));
     $image_file = JPATH_SITE . DS . FSS_Settings::get('attach_location') . DS . "support" . DS . $attach->diskfile;
     require_once JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'helper' . DS . 'files.php';
     FSS_File_Helper::OutputImage($image_file, pathinfo($attach->filename, PATHINFO_EXTENSION));
 }
示例#2
0
 static function attachView($ticketid, $fileid, $for_user = false)
 {
     $ticket = new SupportTicket();
     if ($ticket->load($ticketid, $for_user)) {
         $attach = $ticket->getAttach($fileid);
         $image = in_array(strtolower(pathinfo($attach->filename, PATHINFO_EXTENSION)), array('jpg', 'jpeg', 'png', 'gif'));
         if (!$image) {
             exit;
         }
         $image_file = JPATH_SITE . DS . FSS_Settings::get('attach_location') . DS . "support" . DS . $attach->diskfile;
         require_once JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'helper' . DS . 'files.php';
         FSS_File_Helper::OutputImage($image_file, pathinfo($attach->filename, PATHINFO_EXTENSION));
     }
     exit;
 }