View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
05066 | Bug reports | Theme editor | public | 2011-03-29 11:41 | 2011-05-04 19:31 |
Reporter | Assigned To | c_schmitz | |||
Priority | urgent | Severity | partial_block | ||
Status | closed | Resolution | fixed | ||
Product Version | 1.91RC5 | ||||
Fixed in Version | 1.91 | ||||
Summary | 05066: GSOC: Template editor malfunction: Cannot change editing file; and Incorrect filename in template file upload | ||||
Description |
| ||||
Steps To Reproduce | fresh install 1.91RC5 then go to template editor, copy any stock templates, try switching Standard files: always go back to File 'startpage.pstpl' | ||||
Tags | No tags attached. | ||||
Attached Files | modifiedsanitize.diff (1,037 bytes)
--- B:\sanitize.php 2011-03-08 13:50:46.000000000 +0530 +++ C:\xampp\htdocs\limesurvey\classes\core\sanitize.php 2011-04-06 19:34:08.132812500 +0530 @@ -103,10 +103,12 @@ $strip = array("~", "`", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "=", "+", "[", "{", "]", "}", "\\", "|", ";", ":", "\"", "'", "‘", "’", "“", "”", "–", "—", "—", "–", ",", "<", ".", ">", "/", "?"); - $clean = trim(str_replace($strip, "_", strip_tags($string))); + $lastdot=strrpos($string, "."); + $clean = trim(str_replace($strip, "_", strip_tags($string))); $clean = preg_replace('/\s+/', "-", $clean); $clean = ($alphanumeric) ? preg_replace("/[^a-zA-Z0-9]/", "", $clean) : $clean ; - return ($force_lowercase) ? + $clean= substr_replace ( $clean , '.' , $lastdot , 1 ); + return ($force_lowercase) ? (function_exists('mb_strtolower')) ? mb_strtolower($clean, 'UTF-8') : strtolower($clean) : finversanitize.diff (1,074 bytes)
--- B:\sanitize.php 2011-03-08 13:50:46.000000000 +0530 +++ C:\xampp\htdocs\limesurvey\classes\core\sanitize.php 2011-04-07 02:20:44.971679600 +0530 @@ -103,10 +103,14 @@ $strip = array("~", "`", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "=", "+", "[", "{", "]", "}", "\\", "|", ";", ":", "\"", "'", "‘", "’", "“", "”", "–", "—", "—", "–", ",", "<", ".", ">", "/", "?"); - $clean = trim(str_replace($strip, "_", strip_tags($string))); + $lastdot=strrpos($string, "."); + $clean = trim(str_replace($strip, "_", strip_tags($string))); $clean = preg_replace('/\s+/', "-", $clean); $clean = ($alphanumeric) ? preg_replace("/[^a-zA-Z0-9]/", "", $clean) : $clean ; - return ($force_lowercase) ? + if ($lastdotpos !== false) { + $clean= substr_replace ( $clean , '.' , $lastdot , 1 ); + } + return ($force_lowercase) ? (function_exists('mb_strtolower')) ? mb_strtolower($clean, 'UTF-8') : strtolower($clean) : | ||||
Bug heat | 18 | ||||
Complete LimeSurvey version number (& build) | 9872 | ||||
I will donate to the project if issue is resolved | No | ||||
Browser | |||||
Database type & version | MySQL | ||||
Server OS (if known) | Debian 2.6.26-25lenny1 | ||||
Webserver software & version (if known) | Nginx | ||||
PHP Version | 5 | ||||
Please check it and give feedback if there is any problem. |
|
murarivivek, that patch is bogus. With the suggested change all invalid characters are replaced with dots but all invalid chars shoudl be replaced with an underscore. Please submit an new patch. |
|
Well, there was a '.' in the forbidden symbols. Removing it solves the problem :) |
|
@dodev yes, that seems to solve the problem |
|
Hello, You need to remove all dot (.) in the filename except the last one for extension. For extension, you can remove all non alphanumeric carater, or use the same condition of the filename if you want. With this patch you can have a file...............name.exte....sio....n |
|
this first takes note of position of last dot in the string. After replacing all not allowed chars, it changes the _ at last dot position to dot again. Hope this solves the issue |
|
And if lastdot == -1 ? |
|
I made changes such that if lastdot== -1 it will do nothing and leave the filename as before! |
|
Assign it again to Carsten for reviewing :) |
|
Thanks! |
|
Can't reproduce #1. Works just fine here. Maybe a permission problem in your template folder? Check the permissions on /upload/templates and subfolders/files |
|
Same problem persists even after tried "chmod -R 777 upload/", it also happens on windows server. |
|
I can't reproduce it either(on windows server)! |
|
Check your global settings and see if you have set a valid template as default. |
|
I get the same on 1.91RC6. I can I cannot |
|
yong, did you check your global settings as requested? |
|
same problem here. I can copy each default/basic-template but cannot edit them. The navigation on the left (welcome etc. and the *.css-files) always "jumps back" to startpage.pstl. My Global Settings say "default" as default-template. I am on RC6. Windows Server 2003. In the log-file of limesurvey nothing related appears. In script-console (new stable release of chrome and firefox) no errors appear. I did the upgrade from 1.90 to RC6, because of issues with conditional questions. |
|
oh and when I try to save the current pstpl-file - which is startpage.pstpl - I get an error: Invalid template filename Update: I've tested something (I added a testoutput "echo "$editfile";" and found out, that the filename, which is tried to be saved startpage_pstpl instead of startpage.pstpl. Probably this line "if (!isset($editfile)) {$editfile = sanitize_filename(returnglobal('editfile'));}" contains an error? (see template.php) |
|
Sorry, Schmitz. I was not posting feedback earlier. |
|
seriously yong, I assumed you had tested that. Please check and report back. Thank you! |
|
Confirming the patch fixed both problem #1 and #2. |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2011-03-29 11:41 |
|
New Issue | |
2011-03-29 20:03 | c_schmitz | Assigned To | => c_schmitz |
2011-03-29 20:03 | c_schmitz | Status | new => assigned |
2011-03-29 20:03 | c_schmitz | Summary | Template editor malfunction: Cannot change editing file; and Incorrect filename in template file upload => GSOC: Template editor malfunction: Cannot change editing file; and Incorrect filename in template file upload |
2011-03-31 02:26 |
|
Issue Monitored: user13064 | |
2011-03-31 03:07 |
|
File Added: sanitize.diff | |
2011-03-31 03:10 |
|
Note Added: 14622 | |
2011-04-04 13:44 | c_schmitz | Note Added: 14652 | |
2011-04-04 13:44 | c_schmitz | Status | assigned => feedback |
2011-04-05 17:47 | dodev | File Added: fix_santize.diff | |
2011-04-05 17:48 | dodev | Note Added: 14678 | |
2011-04-05 18:47 | dodev | Issue Monitored: dodev | |
2011-04-05 23:48 |
|
Note Added: 14680 | |
2011-04-05 23:48 |
|
Note Edited: 14680 | |
2011-04-06 15:11 | DenisChenu | Assigned To | c_schmitz => DenisChenu |
2011-04-06 15:11 | DenisChenu | Status | feedback => assigned |
2011-04-06 15:13 | DenisChenu | Note Added: 14697 | |
2011-04-06 16:11 |
|
File Added: modifiedsanitize.diff | |
2011-04-06 16:14 |
|
Note Added: 14699 | |
2011-04-06 17:40 | DenisChenu | Note Added: 14700 | |
2011-04-06 22:52 |
|
Note Added: 14709 | |
2011-04-06 22:52 |
|
File Added: finversanitize.diff | |
2011-04-07 10:12 | DenisChenu | Assigned To | DenisChenu => c_schmitz |
2011-04-07 10:13 | DenisChenu | Note Added: 14719 | |
2011-04-11 13:44 | c_schmitz | File Deleted: sanitize.diff | |
2011-04-11 13:44 | c_schmitz | File Deleted: fix_santize.diff | |
2011-04-11 13:54 | c_schmitz | Status | assigned => resolved |
2011-04-11 13:54 | c_schmitz | Fixed in Version | => 1.91 |
2011-04-11 13:54 | c_schmitz | Resolution | open => fixed |
2011-04-12 10:37 |
|
Note Added: 14790 | |
2011-04-12 10:37 |
|
Status | resolved => feedback |
2011-04-12 10:37 |
|
Resolution | fixed => reopened |
2011-04-12 13:33 | c_schmitz | Note Added: 14795 | |
2011-04-12 13:38 | c_schmitz | Note Edited: 14795 | |
2011-04-13 04:51 |
|
Note Added: 14804 | |
2011-04-13 04:51 |
|
Status | feedback => assigned |
2011-04-13 16:19 |
|
Note Added: 14809 | |
2011-04-13 16:29 | c_schmitz | Note Added: 14810 | |
2011-04-14 20:31 | ftrifoglio | Note Added: 14816 | |
2011-04-16 16:48 | c_schmitz | Note Added: 14826 | |
2011-04-16 16:48 | c_schmitz | Status | assigned => feedback |
2011-04-18 18:16 |
|
Note Added: 14841 | |
2011-04-18 21:09 |
|
Note Edited: 14841 | |
2011-04-18 21:10 |
|
Note Added: 14842 | |
2011-04-18 21:25 |
|
Note Edited: 14842 | |
2011-04-18 21:32 |
|
Note Edited: 14842 | |
2011-04-18 21:34 |
|
Note Edited: 14842 | |
2011-04-26 09:56 |
|
Note Added: 14862 | |
2011-04-26 09:56 |
|
Status | feedback => assigned |
2011-04-27 18:19 | c_schmitz | Note Added: 14865 | |
2011-04-27 18:19 | c_schmitz | Status | assigned => resolved |
2011-04-27 18:19 | c_schmitz | Resolution | reopened => fixed |
2011-04-28 05:22 |
|
Note Added: 14868 | |
2011-05-04 19:31 | c_schmitz | Status | resolved => closed |
2015-12-11 14:40 | c_schmitz | Category | Templates => Theme editor |
2021-08-04 06:10 | guest | Bug heat | 16 => 18 |