commit 15bb8b6e7f8660ab90ff70121993c9862fbc7785
parent 5192743bbd4889f63807a2421ef2165c934dc84c
Author: Jan Dankert <devnull@localhost>
Date: Thu, 29 Nov 2018 00:54:24 +0100
Fix: Beim Filtern von Textdateien muss die richtige temporäre Datei benutzt und ggf. gelöscht werde.
Diffstat:
6 files changed, 41 insertions(+), 7 deletions(-)
diff --git a/modules/cms-core/action/PageAction.class.php b/modules/cms-core/action/PageAction.class.php
@@ -413,6 +413,7 @@ class PageAction extends ObjectAction
$template = new Template( $this->page->templateid );
$template->load();
$this->setTemplateVar('template_name',$template->name);
+ $this->setTemplateVar('tmp_filename',$this->page->tmpfile() );
}
diff --git a/modules/cms-core/model/File.class.php b/modules/cms-core/model/File.class.php
@@ -64,6 +64,8 @@ class File extends BaseObject
public $filterid;
+ public $public = false ;
+
/**
* Konstruktor
@@ -384,6 +386,9 @@ EOF
if ( $this->storeValueAsBase64 )
$this->value = base64_decode( $this->value );
+ if ( $this->public )
+ $this->filterValue();
+
// Store in cache.
$f = fopen( $this->tmpfile(),'w' );
fwrite( $f,$this->value );
@@ -393,13 +398,18 @@ EOF
}
+ public function deleteTmpFile() {
+
+ if ( is_file($this->tmpfile()) )
+ @unlink( $this->tmpfile() );
+ }
+
/**
* Speichert den Inhalt in der Datenbank.
*/
function saveValue( $value = '' )
{
- if ( is_file($this->tmpfile()) )
- @unlink( $this->tmpfile() );
+ $this->deleteTmpFile();
$db = db_connection();
@@ -454,12 +464,13 @@ EOF
public function publish()
{
+ $this->public = true;
+ $this->deleteTmpFile();
if ( ! is_object($this->publish) )
$this->publish = new \Publish( $this->projectid );
$this->write();
- $this->filterValue();
$this->publish->copy( $this->tmpfile(),$this->full_filename(),$this->lastchangeDate );
$this->publish->publishedObjects[] = $this->getProperties();
@@ -474,7 +485,7 @@ EOF
if ( $this->tmpfile == '' )
{
$db = db_connection();
- $this->tmpfile = \FileUtils::getTempFileName( array('db'=>$db->id,'o'.$this->objectid) );
+ $this->tmpfile = \FileUtils::getTempFileName( array('db'=>$db->id,'o'=>$this->objectid,'p'=>intval($this->public)) );
}
return $this->tmpfile;
}
diff --git a/modules/cms-ui/themes/default/html/views/file/edit.php b/modules/cms-ui/themes/default/html/views/file/edit.php
@@ -9,7 +9,7 @@
<div class="input">
<br/>
- <input size="40" id="req15434469071543274202_file" type="file" name="file" class="upload" />
+ <input size="40" id="req1543449177373010490_file" type="file" name="file" class="upload" />
<br/>
diff --git a/modules/cms-ui/themes/default/html/views/login/login.php b/modules/cms-ui/themes/default/html/views/login/login.php
@@ -44,7 +44,7 @@
</div>
<div class="input">
<?php $if6=!(isset($$force_username)); if($if6){?>
- <div class="inputholder"><input placeholder="<?php echo lang('USER_USERNAME') ?>" id="<?php echo REQUEST_ID ?>_login_name" name="login_name<?php if ('') echo '_disabled' ?>" required="required" autofocus="autofocus" type="text" maxlength="128" class="name" value="<?php echo Text::encodeHtml(@$login_name) ?>" /><?php if ('') { ?><input type="hidden" name="login_name" value="<?php $login_name ?>"/><?php } ?></div>
+ <div class="inputholder"><input placeholder="<?php echo lang('USER_USERNAME') ?>" id="<?php echo REQUEST_ID ?>_login_name" name="<?php if ('') echo ''.'_' ?>login_name<?php if ('') echo '_disabled' ?>" required="required" autofocus="autofocus" type="text" maxlength="128" class="name" value="<?php echo Text::encodeHtml(@$login_name) ?>" /><?php if ('') { ?><input type="hidden" name="login_name" value="<?php $login_name ?>"/><?php } ?></div>
<?php } ?>
<?php if(!$if6){?>
@@ -127,7 +127,7 @@
</label>
</div>
<div class="input">
- <div class="inputholder"><input id="<?php echo REQUEST_ID ?>_user_token" name="user_token<?php if ('') echo '_disabled' ?>" type="text" maxlength="30" class="text" value="<?php echo Text::encodeHtml('') ?>" /><?php if ('') { ?><input type="hidden" name="user_token" value="<?php '' ?>"/><?php } ?></div>
+ <div class="inputholder"><input id="<?php echo REQUEST_ID ?>_user_token" name="<?php if ('') echo ''.'_' ?>user_token<?php if ('') echo '_disabled' ?>" type="text" maxlength="30" class="" value="<?php echo Text::encodeHtml('') ?>" /><?php if ('') { ?><input type="hidden" name="user_token" value="<?php '' ?>"/><?php } ?></div>
</div>
</div>
diff --git a/modules/cms-ui/themes/default/html/views/page/info.php b/modules/cms-ui/themes/default/html/views/page/info.php
@@ -50,6 +50,18 @@
</div>
<div class="line">
<div class="label">
+ <label for="<?php echo REQUEST_ID ?>_full_filename" class="label">
+ <span class="text"><?php echo nl2br(encodeHtml(htmlentities(lang('global_full_filename')))); ?></span>
+
+ </label>
+ </div>
+ <div class="input">
+ <span class="filename"><?php echo nl2br(encodeHtml(htmlentities($tmp_filename))); ?></span>
+
+ </div>
+ </div>
+ <div class="line">
+ <div class="label">
<label for="<?php echo REQUEST_ID ?>_template_name" class="label">
<span class="text"><?php echo nl2br(encodeHtml(htmlentities(lang('global_template')))); ?></span>
diff --git a/modules/cms-ui/themes/default/html/views/page/info.tpl.src.xml b/modules/cms-ui/themes/default/html/views/page/info.tpl.src.xml
@@ -41,6 +41,16 @@
</part>
<part class="line">
<part class="label">
+ <label for="full_filename">
+ <text text="global_full_filename"></text>
+ </label>
+ </part>
+ <part class="input">
+ <text var="tmp_filename" class="filename"></text>
+ </part>
+ </part>
+ <part class="line">
+ <part class="label">
<label for="template_name">
<text text="global_template"></text>
</label>