Changeset 1115
- Timestamp:
- 03/20/10 16:49:35 (2 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 2 edited
-
common/attachment.php (modified) (1 diff)
-
scripts/attach-endline-fix (added)
-
www/controllers/attachment.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/common/attachment.php
r1018 r1115 118 118 } 119 119 120 function is_grader_testfile($file_name) { 121 $pattern = '/^grader_test(\d)*\.(ok|in)$/'; 122 if (preg_match($pattern, $file_name) == false) { 123 return false; 124 } else { 125 return true; 126 } 127 } 128 129 function is_problem_page($page_name) { 130 $pattern = '/^problema\/' . IA_RE_TASK_ID . '$/'; 131 if (preg_match($pattern, $page_name) == false) { 132 return false; 133 } else { 134 return true; 135 } 136 } 137 138 function add_ending_newline($file_path) { 139 $content = file_get_contents($file_path); 140 if ($content[strlen($content) - 1] != "\n") { 141 $content .= "\n"; 142 file_put_contents($file_path, $content); 143 return true; 144 } 145 return false; 146 } 147 120 148 ?> -
trunk/www/controllers/attachment.php
r1086 r1115 175 175 if (is_textfile($file_att['type'])) { 176 176 dos_to_unix($file_att['disk_name']); 177 if (is_grader_testfile($file_att['name']) && 178 is_problem_page($page_name)) { 179 add_ending_newline($file_att['disk_name']); 180 } 177 181 $file_att['size'] = filesize($file_att['disk_name']); 178 182 }
Note: See TracChangeset
for help on using the changeset viewer.
![[infoarena] development](/chrome/site/logo.png)