Changeset 1091 for trunk/common
- Timestamp:
- 12/23/09 00:26:25 (2 years ago)
- Location:
- trunk/common
- Files:
-
- 2 edited
-
db/user.php (modified) (2 diffs)
-
security.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/common/db/user.php
r1070 r1091 131 131 // $user must be a valid user struct, user_id ignored 132 132 // Returns created $user or throws up on error. 133 function user_create($user )133 function user_create($user, $remote_ip_info=null) 134 134 { 135 135 log_assert_valid(user_validate($user)); … … 150 150 $replace = array("user_id" => $user['username']); 151 151 textblock_copy_replace("template/newuser", IA_USER_TEXTBLOCK_PREFIX.$user['username'], 152 $replace, "public", $new_user['id'], remote_ip_info());152 $replace, "public", $new_user['id'], $remote_ip_info); 153 153 154 154 // Create SMF user -
trunk/common/security.php
r1087 r1091 129 129 case 'task-create': 130 130 case 'task-delete': 131 case 'task-tag': 131 132 case 'round-delete': 132 133 case 'textblock-delete': … … 143 144 case 'textblock-change-security': 144 145 case 'task-edit-owner': 145 case 'task-tag':146 146 case 'round-tag': 147 147 case 'textblock-tag': … … 280 280 // FIXME: attach-grader? 281 281 function security_attach($user, $action, $attach) { 282 283 282 $att_name = $attach['name']; 284 283 $att_page = normalize_page_name($attach['page']); … … 296 295 } 297 296 298 // HACK: magic prefix. 299 if (preg_match('/^grader\_/', $att_name)) { 297 // Speed hack: avatars are always visible. This is good. 298 if ($action == 'attach-download' && $att_name == 'avatar' && 299 starts_with($att_page, IA_USER_TEXTBLOCK_PREFIX)) { 300 return true; 301 } 302 303 // Forward to textblock. 304 $tb = textblock_get_revision($attach['page']); 305 if (!$tb) { 306 log_print_r($attach); 307 } 308 log_assert($tb, "Orphan attachment"); 309 310 // Convert action into a grader action if the textblock is a task 311 // textblock and the attachment has the grader_ prefix. 312 if (preg_match("/^ \s* task: \s* (".IA_RE_TASK_ID.") \s* $/xi", $tb["security"]) && 313 preg_match('/^grader\_/', $att_name)) { 300 314 $newaction = preg_replace('/^attach/', 'grader', $action); 301 315 if (IA_LOG_SECURITY) { … … 304 318 $action = $newaction; 305 319 } 306 307 // Speed hack: avatars are always visible. This is good.308 if ($action == 'attach-download' && $att_name = 'avatar' &&309 strstr($att_page, IA_USER_TEXTBLOCK_PREFIX) === $att_page) {310 return true;311 }312 313 // Forward to textblock.314 $tb = textblock_get_revision($attach['page']);315 if (!$tb) {316 log_print_r($attach);317 }318 log_assert($tb, "Orphan attachment");319 320 320 321 return security_textblock($user, $action, $tb);
Note: See TracChangeset
for help on using the changeset viewer.
![[infoarena] development](/chrome/site/logo.png)