Example #1
0
 function replaceFromUpload($f)
 {
     $md5 = md5_file($f['tmp_name']);
     $this->path = appPATH . 'qg/file/' . $md5;
     move_uploaded_file($f['tmp_name'], $this->path);
     $ext = strtolower(preg_replace('/.*\\./', '', $f['name']));
     $type = $f['type'] === 'application/octet-stream' ? File::extensionToMime($ext) : $f['type'];
     $type = preg_replace('/;.*/', '', $type);
     $this->setVs(array('name' => $f['name'], 'mime' => $type, 'md5' => $md5, 'size' => $this->size(), 'text' => $this->getText()));
 }
Example #2
0
		<button class=q1Rst id=saveButton style="position:fixed; right:-1px; top:10px; z-index:10; padding:10px 12px; display:none;">
			<?php 
echo is_writable($file) ? 'save' : 'rechte zum speichern fehlen!';
?>
		</button>
		<div style="height:100%; width:100%">
			<textarea id=editor style="width:100%; height:100%;"><?php 
echo hee(file_get_contents($file));
?>
</textarea>
		</div>

		<?php 
$ext = preg_replace('/.*\\.([^.])/', '$1', $file);
$mime = File::extensionToMime($ext);
$mime = str_replace('application/x-javascript', 'text/javascript', $mime);
?>

		<script>
		btn = document.getElementById('saveButton');
		editorEl = document.getElementById('editor');

		saveFile = function(content){
			btn.style.background = '#fea';
			Ask({save: content},{
				onComplete: function(asw){
					if (asw) {
						btn.style.background = '';
						btn.style.display = 'none';
					}
Example #3
0
if (isset($_GET['showit'])) {
    while (ob_get_level()) {
        ob_end_clean();
    }
    header('Content-Type: text/html; charset=utf-8');
    $html = $Mail->getHtml();
    /* inline-images */
    preg_match_all("#<img.*?src=['\"]cid:([^'\"]+)#i", $html, $matches);
    $matches = array_unique($matches[1]);
    if ($matches) {
        foreach ($matches as $hash) {
            $filename = D()->one("SELECT path FROM mail_attachment WHERE mail_id = " . $Mail . " AND hash = " . D()->quote($hash));
            if (!is_readable($filename)) {
                continue;
            }
            $base64 = 'data:image/' . File::extensionToMime(preg_replace('/.*\\.([^.]+$)/', '$1', $filename)) . ';base64,' . base64_encode(file_get_contents($filename));
            $html = str_replace('cid:' . $hash, $base64, $html);
        }
    }
    echo '<script>' . 'alert("Your Browser doas not support the sandbox-attribute! Please choose an other Browser"); ' . 'location.href = "about:blank"; ' . 'window.stop();' . 'document.execCommand("Stop");' . 'document.write(\'<scr\'+\'ipt>\');' . 'document.write(\'<!--\');' . '</script>' . $html;
    exit;
}
?>
	<div style="width:800px">
		<h1>Mail-Details</h1>
		<div class=be_contentTextBox>
			<table class=c1-style>
				<tr>
					<td style="width:100px"> Datum
					<td> <?php 
echo date('d.m.Y H:i', D()->one("SELECT time FROM log WHERE id = " . $Mail->log_id . ""));
Example #4
0
 function send()
 {
     $this->save();
     // save
     $SET = G()->SET['qg']['mail'];
     require_once sysPATH . 'Zend/Mail.php';
     if (G()->SET['qg']['mail']['smtp']['host']->v) {
         require_once sysPATH . 'Zend/Mail/Transport/Smtp.php';
         $config = array('ssl' => 'tls');
         if ($SET['smtp']['port']->v) {
             $config['port'] = $SET['smtp']['port']->v;
         }
         if ($SET['smtp']['username']->v) {
             $config['auth'] = 'login';
             $config['username'] = $SET['smtp']['username']->v;
             $config['password'] = $SET['smtp']['password']->v;
         }
         $tr = new \Zend_Mail_Transport_Smtp($SET['smtp']['host']->v, $config);
     } else {
         require_once sysPATH . 'Zend/Mail/Transport/Sendmail.php';
         $tr = new \Zend_Mail_Transport_Sendmail('-f' . $SET['replay']->v);
     }
     \Zend_Mail::setDefaultTransport($tr);
     $toWebmaster = debug ? $SET['on debugmode to']->v : false;
     foreach (D()->mail_recipient->selectEntries("WHERE mail_id = " . $this . " AND sent = 0") as $Item) {
         $ZendMail = new \Zend_Mail('utf-8');
         $ZendMail->setFrom($this->sender, $this->sendername ? $this->sendername : $this->sender);
         $ZendMail->setSubject(($toWebmaster ? 'Debug! ' : '') . $this->subject);
         $html = $this->getHtml($Item, $ZendMail);
         // dirty hack for thunderbird, it needs multipart/related for inline-images
         if (strpos($html, 'cid:') !== false) {
             $ZendMail->setType(Zend_Mime::MULTIPART_RELATED);
             // ok?
         }
         $ZendMail->setBodyHtml(($toWebmaster ? 'original receiver :' . $Item->email . '<br><br>' : '') . $html);
         $ZendMail->setBodyText(($toWebmaster ? 'original receiver :' . $Item->email . "\n\n" : '') . $this->getText($Item, $ZendMail));
         $ZendMail->addTo($toWebmaster ? $toWebmaster : $Item->email, $Item->name);
         foreach (D()->query("SELECT * FROM mail_attachment WHERE mail_id = " . $this->id) as $vs) {
             $At = $ZendMail->createAttachment(file_get_contents($vs['path']));
             $At->filename = $vs['name'] ? $vs['name'] : basename($vs['path']);
             $At->type = $vs['type'] ? $vs['type'] : File::extensionToMime(preg_replace('/.*\\.([^.]+$)/', '$1', $vs['path']));
             $At->disposition = $vs['inline'] ? Zend_Mime::DISPOSITION_INLINE : Zend_Mime::DISPOSITION_ATTACHMENT;
             $At->id = $vs['hash'];
         }
         $sent = false;
         try {
             $sent = $ZendMail->send();
         } catch (Exception $e) {
             var_dump($this->sender);
             trigger_error('mail sending failed :' . $e);
         }
         if ($sent) {
             $Item->sent = time();
             $Item->save();
             // save
         }
     }
 }
Example #5
0
				<input value="<?php 
echo $F->mime();
?>
" onchange="$fn('page::fileSetMime')(<?php 
echo $Cont;
?>
,'<?php 
echo $param['name'];
?>
', this.value).run()" style="width:100%">
				<?php 
if ($F->mime() != File::extensionToMime($F->extension())) {
    ?>
					<a onclick="$(this).getPrevious().value=$(this).innerHTML; this.getPrevious().onchange(); this.dispose()" title="Mime anhand der Endung übernehmen"
					><?php 
    echo File::extensionToMime($F->extension());
    ?>
</a>
				<?php 
}
?>
		<tr class="expert">
			<th style="text-align:left">md5:
			<td><?php 
echo $F->md5();
?>
	</table>
	<br>
	<br>
	<h1><?php 
echo L('an folgenden Orten vorhanden');
Example #6
0
 function mime()
 {
     $ext = $this->extension();
     $mime = $ext ? File::extensionToMime($ext) : 'application/octet-stream';
 }