View Issue Details

This bug affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
04248Bug reportsTheme editorpublic2010-05-05 10:28
Reporteruser7171Assigned Touser7171 
PrioritynormalSeverityminor 
Status closedResolutionopen 
Product Version1.87+ 
Summary04248: No Proper Error Message
Description

If the tmp folder of the installation is not set as writable, then the template editor doesn't give a proper error message, rather just the error thrown by php is shown as it is, which may not be understandable to a non-techie.

Steps To Reproduce

Just go to template section without changing the tmp folder permission to writable.

TagsNo tags attached.
Attached Files
permissionerror.patch (2,238 bytes)   
--- templates.php	2010-03-09 01:40:00.000000000 +0530
+++ /var/www/limesurvey1/admin/templates.php	2010-03-27 13:44:58.900728052 +0530
@@ -980,7 +980,7 @@ if (is_template_editable($templatename)=
     ."<tr><td>"
     ."<input type='submit' value='".$clang->gT("Delete")."' onclick=\"javascript:return confirm('".$clang->gT("Are you sure you want to delete this file?","js")."')\"";
     if (!is_template_editable($templatename))  {
-		    $templatesoutput.= " style='color: #BBBBBB;' disabled='disabled' alt='".$clang->gT("Files in a standard template cannot be deleted.")."'";
+$templatesoutput.= " style='color: #BBBBBB;' disabled='disabled' alt='".$clang->gT("Files in a standard template cannot be deleted.")."'";
     }
     $templatesoutput.= " />\n"
     ."<input type='hidden' name='screenname' value='".html_escape($screenname)."' />\n"
@@ -1026,22 +1026,26 @@ $templatesoutput.= "\t<div class='header
 
 // The following lines are forcing the browser to refresh the templates on each save
 $time=date("ymdHis");
-$fnew=fopen("$tempdir/template_temp_$time.html", "w+");
-fwrite ($fnew, getHeader());
+@$fnew=fopen("$tempdir/template_temp_$time.html", "w+"); 
+@fwrite ($fnew, getHeader());
 foreach ($cssfiles as $cssfile)
 {
     $myoutput=str_replace($cssfile['name'],$cssfile['name']."?t=$time",$myoutput);
 }
-
 foreach($myoutput as $line) {
-	fwrite($fnew, $line);
+	@fwrite($fnew, $line);
 }
-fclose($fnew);
+@fclose($fnew);
 $langdir_template="$publicurl/locale/".$_SESSION['adminlang']."/help";
-$templatesoutput.= "<p>\n"
-."<iframe id='previewiframe' src='$tempurl/template_temp_$time.html' width='95%' height='768' name='previewiframe' style='background-color: white;'>Embedded Frame</iframe>\n"
-."</p></div>\n";
+if(!$fnew){
+	echo "<center><h2>";
+	echo sprintf($clang->gT("Please change the directory permission to writable for the directory %s"), $tempdir);
+	echo "</center></h2>";
 }
+else
+{
+$templatesoutput.= "<p>\n"."<iframe id='previewiframe' src='$tempurl/template_temp_$time.html' width='95%' height='768' name='previewiframe' style='background-color: white;'>Embedded Frame</iframe>\n"."</p></div>\n";
+}}
 
 function doreplacement($file) { //Produce sample page from template file
 	$output=array();
permissionerror.patch (2,238 bytes)   
Bug heat6
Complete LimeSurvey version number (& build)8498
I will donate to the project if issue is resolved
BrowserFirefox
Database type & versionMysql 5.1.37
Server OS (if known)Ubuntu
Webserver software & version (if known)Apache
PHP Version5.2.10

Users monitoring this issue

There are no users monitoring this issue.

Activities

c_schmitz

c_schmitz

2010-03-27 00:08

administrator   ~11517

As we talked about it: Please attach a SVN patch instead. Thank you!

user7171

2010-03-27 06:52

  ~11520

done!

jcleeland

jcleeland

2010-03-27 09:12

reporter   ~11521

Nice.. just note the $clang->gT function (translations) as per our IRC conversation!

user7171

2010-03-27 09:20

  ~11522

done

c_schmitz

c_schmitz

2010-03-27 11:12

administrator   ~11524

Looks good, please commit - please contact me, macduy or jasebo so we can give you commit access to SVN.

Issue History

Date Modified Username Field Change
2010-03-26 18:04 user7171 New Issue
2010-03-26 18:04 user7171 File Added: templates.php
2010-03-27 00:08 c_schmitz Status new => assigned
2010-03-27 00:08 c_schmitz Assigned To => c_schmitz
2010-03-27 00:08 c_schmitz Note Added: 11517
2010-03-27 06:49 user7171 File Added: anish.patch
2010-03-27 06:52 user7171 Note Added: 11520
2010-03-27 09:12 jcleeland Note Added: 11521
2010-03-27 09:19 user7171 File Added: permissionerror.patch
2010-03-27 09:20 user7171 Note Added: 11522
2010-03-27 11:09 c_schmitz File Deleted: templates.php
2010-03-27 11:11 c_schmitz File Deleted: anish.patch
2010-03-27 11:12 c_schmitz Note Added: 11524
2010-03-27 11:13 c_schmitz Assigned To c_schmitz => user7171
2010-03-27 22:17 user7171 Status assigned => resolved
2010-05-05 10:28 c_schmitz Status resolved => closed
2015-12-11 14:40 c_schmitz Category Templates => Theme editor