Changeset 997
- Timestamp:
- 01/29/09 14:55:38 (3 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 34 edited
-
common/common.php (modified) (2 diffs)
-
common/db/attachment.php (modified) (5 diffs)
-
common/db/db.php (modified) (1 diff)
-
common/db/job.php (modified) (6 diffs)
-
common/db/round.php (modified) (2 diffs)
-
common/db/task.php (modified) (2 diffs)
-
common/db/textblock.php (modified) (8 diffs)
-
common/db/user.php (modified) (1 diff)
-
common/job.php (modified) (3 diffs)
-
common/log.php (modified) (1 diff)
-
common/security.php (modified) (6 diffs)
-
common/textblock.php (modified) (2 diffs)
-
junk/userpage-fix.php (modified) (1 diff)
-
scripts/init-blog-comments (modified) (2 diffs)
-
scripts/link-task-forum (modified) (1 diff)
-
scripts/migrate-newsletters-to-html (modified) (1 diff)
-
scripts/migrate-remote-ip (added)
-
scripts/textblock-add-topic-id (modified) (2 diffs)
-
www/controllers/account.php (modified) (1 diff)
-
www/controllers/account_validator.php (modified) (1 diff)
-
www/controllers/attachment.php (modified) (1 diff)
-
www/controllers/job_filters.php (modified) (1 diff)
-
www/controllers/monitor.php (modified) (1 diff)
-
www/controllers/round.php (modified) (1 diff)
-
www/controllers/submit.php (modified) (1 diff)
-
www/controllers/task.php (modified) (1 diff)
-
www/controllers/textblock.php (modified) (1 diff)
-
www/controllers/textblock_copy.php (modified) (1 diff)
-
www/controllers/textblock_edit.php (modified) (1 diff)
-
www/static/css/screen.css (modified) (1 diff)
-
www/utilities.php (modified) (1 diff)
-
www/views/changes.php (modified) (1 diff)
-
www/views/job_detail.php (modified) (2 diffs)
-
www/views/listattach.php (modified) (2 diffs)
-
www/views/textblock_history.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/common/common.php
r935 r997 38 38 define("IA_RE_USER_NAME", '[_@a-z0-9][a-z0-9_\-\.\@]*'); 39 39 40 // IPv4 address, doesn't check for values greater than 255. 41 define("IA_RE_IPV4", '(?:\d{1,3}\.){3}\d{1,3}'); 42 // Full IPv6 address, doesn't match compressed IPv6 formats. 43 define("IA_RE_IPV6_NO_COMPRESS", '(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}'); 44 // IP address, matches IPv4 and non-compressed IPv6. 45 define("IA_RE_IP_ADDRESS", IA_RE_IPV4."|".IA_RE_IPV6_NO_COMPRESS); 46 40 47 // Valid email. A complete check is not possible, see 41 48 // http://www.regular-expressions.info/email.html … … 101 108 } 102 109 return true; 110 } 111 112 // Check for (apparently) valid IP address. 113 // It will match IPv4 and only non-compressed IPv6. Doesn't check 114 // for values greater than 255. 115 function is_valid_ip_address($ip_address) { 116 return preg_match('/^'.IA_RE_IP_ADDRESS.'$/xi', $ip_address); 103 117 } 104 118 -
trunk/common/db/attachment.php
r852 r997 65 65 66 66 // Update an attachment. FIXME: hash args. 67 function attachment_update($id, $name, $size, $mime_type, $page, $user_id) { 67 function attachment_update($id, $name, $size, $mime_type, $page, $user_id, 68 $remote_ip_info) { 68 69 $attachment = array( 69 70 'id' => $id, … … 74 75 'user_id' => $user_id, 75 76 'timestamp' => db_date_format(), 77 'remote_ip_info' => $remote_ip_info, 76 78 ); 77 79 … … 82 84 83 85 // Inserts an attachment in the db 84 function attachment_insert($name, $size, $mime_type, $page, $user_id) { 86 function attachment_insert($name, $size, $mime_type, $page, $user_id, 87 $remote_ip_info) { 85 88 $attachment = array( 86 89 'name' => $name, … … 90 93 'user_id' => $user_id, 91 94 'timestamp' => db_date_format(), 95 'remote_ip_info' => $remote_ip_info, 92 96 ); 93 97 … … 95 99 $attachment['id'] = db_insert_id(); 96 100 _attachment_cache_add($attachment); 97 101 98 102 return $attachment['id']; 99 103 } -
trunk/common/db/db.php
r909 r997 262 262 } 263 263 264 // FIXME: This shouldn't be here. Move it in common/db/task.php or 265 // common/db/round.php 264 266 function db_get_task_filter_clause($filter, $table_alias) { 265 267 if ($filter == IA_TLF_SOLVED) { -
trunk/common/db/job.php
r996 r997 22 22 23 23 // Creates new eval job 24 function job_create($task_id, $round_id, $user_id, $compiler_id, $file_contents) { 24 function job_create($task_id, $round_id, $user_id, $compiler_id, $file_contents, 25 $remote_ip_info = null) { 25 26 $query = <<<SQL 26 27 INSERT INTO ia_job 27 (`task_id`, `round_id`, `user_id`, `compiler_id`, `file_contents`, `submit_time`) 28 VALUES (%s, %s, %s, %s, %s, %s) 28 (`task_id`, `round_id`, `user_id`, `compiler_id`, `file_contents`, 29 `submit_time`, `remote_ip_info`) 30 VALUES (%s, %s, %s, %s, %s, %s, %s) 29 31 SQL; 30 32 $query = sprintf($query, 31 33 db_quote($task_id), db_quote($round_id), db_quote($user_id), 32 db_quote($compiler_id), db_quote($file_contents), db_quote(db_date_format())); 34 db_quote($compiler_id), db_quote($file_contents), 35 db_quote(db_date_format()), db_quote($remote_ip_info)); 33 36 return db_query($query); 34 37 } … … 40 43 SELECT `job`.`id`, `job`.`user_id`, `job`.`task_id`, `job`.`round_id`, 41 44 `job`.`compiler_id`, `job`.`status`, `job`.`submit_time`, 42 `job`.`eval_message`, `job`.`score`, `job`.`file_contents` 45 `job`.`eval_message`, `job`.`score`, `job`.`file_contents`, 46 `job`.`remote_ip_info` 43 47 FROM `ia_job` AS `job` 44 48 WHERE `job`.`id` = ( … … 83 87 log_assert(is_whole_number($job_id)); 84 88 $field_list = "`job`.`id`, job.`user_id`, `job`.`compiler_id`, `job`.`status`, 85 `job`.`submit_time`, `job`.`eval_message`, `job`.`score`, `job`.`eval_log`, 89 `job`.`submit_time`, `job`.`eval_message`, `job`.`score`, 90 `job`.`eval_log`, `job`.`remote_ip_info`, 86 91 OCTET_LENGTH(`job`.`file_contents`) AS `job_size`, 87 92 `user`.`username` AS `user_name`, `user`.`full_name` AS `user_fullname`, … … 128 133 $score_end = getattr($filters, 'score_end'); 129 134 $eval_msg = getattr($filters, 'eval_msg'); 135 $remote_ip_info = getattr($filters, 'remote_ip_info'); 130 136 131 137 $wheres = array("TRUE"); … … 172 178 if (!is_null($eval_msg)) { 173 179 $wheres[] = sprintf("`job`.`eval_message` LIKE '%s%%'", db_escape($eval_msg)); 180 } 181 if (!is_null($remote_ip_info)) { 182 // We allow remote_ip_info to contain % wildcards. This will make it a bit 183 // easier to search for IP classes. 184 $wheres[] = sprintf("`job`.`remote_ip_info` LIKE '%s'", db_escape($remote_ip_info)); 174 185 } 175 186 … … 232 243 `job`.`eval_message`, 233 244 `job`.`eval_log`, 245 `job`.`remote_ip_info`, 234 246 OCTET_LENGTH(`job`.`file_contents`) AS `job_size`, 235 247 `user`.`username` AS `user_name`, -
trunk/common/db/round.php
r992 r997 29 29 // Create new round 30 30 // Return success. 31 function round_create($round, $round_params, $user_id ) {31 function round_create($round, $round_params, $user_id, $remote_ip_info = null) { 32 32 log_assert(is_user_id($user_id)); 33 33 log_assert_valid(round_validate($round)); … … 45 45 $replace = array("round_id" => $round['id']); 46 46 textblock_copy_replace("template/newround", $round['page_name'], 47 $replace, "round: {$round['id']}", $user_id );47 $replace, "round: {$round['id']}", $user_id, $remote_ip_info); 48 48 49 49 _round_cache_add($round); -
trunk/common/db/task.php
r982 r997 35 35 36 36 // Create new task 37 function task_create($task, $task_params ) {37 function task_create($task, $task_params, $remote_ip_info = null) { 38 38 log_assert_valid(task_validate($task)); 39 39 log_assert_valid(task_validate_parameters($task['type'], $task_params)); … … 48 48 $replace = array("task_id" => $task['id'], "task_title" => ucfirst($task['id'])); 49 49 textblock_copy_replace("template/newtask", $task['page_name'], 50 $replace, "task: {$task['id']}", $task['user_id'] );50 $replace, "task: {$task['id']}", $task['user_id'], $remote_ip_info); 51 51 52 52 _task_cache_add($task); -
trunk/common/db/textblock.php
r987 r997 15 15 function textblock_add_revision( 16 16 $name, $title, $content, $user_id, $security = "public", 17 $forum_topic = null, $timestamp = null, $creation_timestamp = null) { 17 $forum_topic = null, $timestamp = null, $creation_timestamp = null, 18 $remote_ip_info = null) { 18 19 $name = normalize_page_name($name); 19 20 $tb = array( … … 26 27 'timestamp' => $timestamp, 27 28 'creation_timestamp' => $creation_timestamp, 29 'remote_ip_info' => $remote_ip_info, 28 30 ); 29 31 log_assert_valid(textblock_validate($tb)); … … 59 61 } 60 62 $query = sprintf("INSERT INTO ia_textblock 61 (name, `text`, `title`, `creation_timestamp`, `timestamp`, `user_id`, `security`, `forum_topic`) 62 VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', %s)", 63 db_escape($name), db_escape($content), 64 db_escape($title), db_escape($creation_timestamp), 65 db_escape($timestamp), db_escape($user_id), 66 db_escape($security), 67 is_null($forum_topic) ? "NULL" : db_escape($forum_topic)); 63 (name, `text`, `title`, `creation_timestamp`, 64 `timestamp`, `user_id`, `security`, `forum_topic`, 65 `remote_ip_info`) 66 VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', %s, %s)", 67 db_escape($name), db_escape($content), db_escape($title), 68 db_escape($creation_timestamp), db_escape($timestamp), 69 db_escape($user_id), db_escape($security), db_quote($forum_topic), 70 db_quote($remote_ip_info)); 68 71 return db_query($query); 69 72 } … … 74 77 // log_print_r($options); 75 78 76 $field_list = "`name`, `title`, `creation_timestamp`, `timestamp`, `security`, `user_id`, `forum_topic`"; 79 $field_list = "`name`, `title`, `creation_timestamp`, `timestamp`, `security`, `user_id`, 80 `forum_topic`, `remote_ip_info`"; 77 81 78 82 // Select content. … … 212 216 $compare = "REGEXP"; 213 217 } 214 $query = sprintf("SELECT `name`, `title`, `creation_timestamp`, `timestamp`, `user_id`, `security`, `forum_topic` 218 $query = sprintf("SELECT `name`, `title`, `creation_timestamp`, `timestamp`, 219 `user_id`, `security`, `forum_topic`, 220 `remote_ip_info` 215 221 FROM ia_textblock 216 222 WHERE `name` LIKE '%s' AND … … 289 295 } 290 296 291 function textblock_copy($old_name, $new_name ) {297 function textblock_copy($old_name, $new_name, $user_id, $remote_ip_info) { 292 298 $old_name = normalize_page_name($old_name); 293 299 $new_name = normalize_page_name($new_name); … … 297 303 $new_textblock = textblock_get_revision($old_name); 298 304 $new_textblock['name'] = $new_name; 299 $new_textblock['user_id'] = identity_get_user_id();305 $new_textblock['user_id'] = $user_id; 300 306 textblock_add_revision($new_textblock['name'], $new_textblock['title'], 301 307 $new_textblock['text'], $new_textblock['user_id'], 302 308 $new_textblock['security'], 303 $new_textblock['forum_topic'], null, null); 309 $new_textblock['forum_topic'], null, null, 310 $remote_ip_info); 304 311 305 312 // Get a list of attachments. … … 309 316 foreach ($files as $file) { 310 317 // Copy in db and get new id 311 $new_id = attachment_insert($file['name'], $file['size'], $file['mime_type'], $new_name, identity_get_user_id()); 318 $new_id = attachment_insert($file['name'], $file['size'], 319 $file['mime_type'], $new_name, $user_id, $remote_ip_info); 312 320 313 321 // Copy on hard drive -
trunk/common/db/user.php
r911 r997 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'] );152 $replace, "public", $new_user['id'], null); 153 153 154 154 // Create SMF user -
trunk/common/job.php
r993 r997 78 78 if (array_key_exists('round_id', $args)) { 79 79 job_create($args['task_id'], $args['round_id'], $user['id'], 80 $args['compiler_id'], $args['solution']); 80 $args['compiler_id'], $args['solution'], 81 getattr($args, 'remote_ip_info')); 81 82 } else { 82 83 $parent_rounds = task_get_parent_rounds($args['task_id']); … … 84 85 // some jobs just don't have a round 85 86 job_create($args['task_id'], '', $user['id'], 86 $args['compiler_id'], $args['solution']); 87 $args['compiler_id'], $args['solution'], 88 getattr($args, 'remote_ip_info')); 87 89 } 88 90 else { … … 90 92 if (security_query($user, 'round-submit', round_get($round_id))) { 91 93 job_create($args['task_id'], $round_id, $user['id'], 92 $args['compiler_id'], $args['solution']); 94 $args['compiler_id'], $args['solution'], 95 getattr($args, 'remote_ip_info')); 93 96 } 94 97 } -
trunk/common/log.php
r934 r997 112 112 113 113 // Use this for warning messages. 114 function log_warn($message, $include_origin = false ) {114 function log_warn($message, $include_origin = false, $backtrace_level = 0) { 115 115 if ($include_origin) { 116 $message = format_message_backtrace($message );116 $message = format_message_backtrace($message, $backtrace_level); 117 117 } 118 118 trigger_error_split($message, E_USER_WARNING); -
trunk/common/security.php
r996 r997 103 103 case 'round-register-view': 104 104 return 'simple-view'; 105 106 // View IP. 107 case 'attach-view-ip': 108 case 'textblock-view-ip': 109 case 'job-view-ip': 110 return 'sensitive-info'; 105 111 106 112 // Reversible edits access. … … 245 251 } 246 252 253 case 'sensitive-info': 254 return ($usersec == 'admin' || $usersec == 'helper'); 255 247 256 // Reversible modifications. 248 257 case 'simple-rev-edit': … … 410 419 } 411 420 return $can_view || $is_owner || $is_admin; 421 422 case 'sensitive-info': 423 return ($usersec == 'admin' || $usersec == 'helper'); 412 424 413 425 default: … … 466 478 } 467 479 480 case 'sensitive-info': 481 return ($usersec == 'admin' || $usersec == 'helper'); 482 468 483 default: 469 484 log_error('Invalid round action: '.$action); … … 520 535 $can_view_score = ($job['round_public_eval'] == true) || $is_task_owner || $is_admin; 521 536 $can_view_partial_feedback = $is_owner || $is_admin; 537 $can_view_sensitive_info = ($usersec == 'admin' || $usersec == 'helper'); 522 538 523 539 // Log query response. … … 550 566 return $can_view_job && $can_view_partial_feedback; 551 567 568 case 'sensitive-info': 569 return $can_view_job && $can_view_sensitive_info; 570 552 571 default: 553 572 log_error('Invalid job action: '.$action); -
trunk/common/textblock.php
r970 r997 149 149 // 150 150 // Use this like textblock_copy_replace('template/newtask', 'problema/capsuni'); 151 function textblock_copy_replace($srcprefix, $dstprefix, $replace, $security, $user_id)152 {151 function textblock_copy_replace($srcprefix, $dstprefix, $replace, $security, 152 $user_id, $remote_ip_info = null) { 153 153 assert($srcprefix != $dstprefix); 154 154 assert(is_textblock_security_descriptor($security)); … … 174 174 $textblock['text'], $user_id, $textblock['security'], 175 175 $textblock['forum_topic'], null, 176 $first_textblock['creation_timestamp'] );176 $first_textblock['creation_timestamp'], $remote_ip_info); 177 177 } 178 178 } -
trunk/junk/userpage-fix.php
r852 r997 24 24 $replace = array("user_id" => $user['username']); 25 25 textblock_copy_replace("template/newuser", $tbname, $replace, 26 "public", $user['id'] );26 "public", $user['id'], null); 27 27 } 28 28 } -
trunk/scripts/init-blog-comments
r864 r997 38 38 $new_page['timestamp'] = null; 39 39 $new_page['user_id'] = 1; // update as "domino" :) 40 $new_page['remote_ip_info'] = getattr($post, 'remote_ip_info'); 40 41 41 42 // It worked … … 44 45 $new_page['text'], $new_page['user_id'], 45 46 $new_page['security'], $new_page['timestamp'], 46 $new_page['creation_timestamp']); 47 $new_page['creation_timestamp'], 48 $new_page['remote_ip_info']); 47 49 } else { 48 50 log_error('Eroare la validarea textblock-ului!'); -
trunk/scripts/link-task-forum
r945 r997 39 39 $new_page['text'], $new_page['user_id'], 40 40 $new_page['security'], $new_page['timestamp'], 41 $new_page['creation_timestamp']); 41 $new_page['creation_timestamp'], 42 $new_page['remote_ip_info']); 42 43 } else { 43 44 log_error('Eroare la validarea textblock-ului!'); -
trunk/scripts/migrate-newsletters-to-html
r987 r997 74 74 textblock_add_revision($textblock['name'], $textblock['title'], 75 75 $new_text, $textblock['user_id'], $textblock['security'], 76 $textblock['forum_topic'], null, $textblock['creation_timestamp']); 76 $textblock['forum_topic'], null, $textblock['creation_timestamp'], 77 getattr($textblock. 'remote_ip_info')); 77 78 } 78 79 -
trunk/scripts/textblock-add-topic-id
r961 r997 21 21 $page['user_id'], $page['security'], 22 22 $page["forum_topic"], $page['timestamp'], 23 $page['creation_timestamp']); 23 $page['creation_timestamp'], 24 getattr($page, 'remote_ip_info')); 24 25 } else { 25 26 log_error('Eroare la procesarea ia_blog_forum!'); … … 48 49 $page['user_id'], $page['security'], 49 50 $page["forum_topic"], $page['timestamp'], 50 $page['creation_timestamp']); 51 $page['creation_timestamp'], 52 getattr($page, 'remote_ip_info')); 51 53 } else { 52 54 log_error('Eroare la procesarea paginii ' . $page["name"] . '!'); -
trunk/www/controllers/account.php
r852 r997 108 108 // Attachment already exists, overwrite. 109 109 attachment_update($attach['id'], $file_name, $avatar_size, 110 $mime_type, $user_page, $user['id']); 110 $mime_type, $user_page, $user['id'], 111 remote_ip_info()); 111 112 } else { 112 113 // New attachment. Insert. 113 114 attachment_insert($file_name, $avatar_size, 114 $mime_type, $user_page, $user['id']); 115 $mime_type, $user_page, $user['id'], 116 remote_ip_info()); 115 117 } 116 118 -
trunk/www/controllers/account_validator.php
r986 r997 7 7 $errors = validate_user_data($data, true, null); 8 8 9 if (!IA_DEVELOPMENT_MODE) {9 if (!IA_DEVELOPMENT_MODE) { 10 10 $resp = recaptcha_check_answer(IA_CAPTCHA_PRIVATE_KEY, 11 11 $_SERVER["REMOTE_ADDR"], -
trunk/www/controllers/attachment.php
r938 r997 178 178 // Attachment already exists, overwrite. 179 179 identity_require('attach-overwrite', $attach); 180 attachment_update($attach['id'], $file_att['name'], $file_att['size'], 181 $file_att['type'], $page_name, $identity_user['id']); 180 attachment_update($attach['id'], $file_att['name'], 181 $file_att['size'], $file_att['type'], $page_name, 182 $identity_user['id'], remote_ip_info()); 182 183 $rewrite_count++; 183 184 } 184 185 else { 185 186 // New attachment. Insert. 186 attachment_insert($file_att['name'], $file_att['size'], $file_att['type'], 187 $page_name, $identity_user['id']); 187 attachment_insert($file_att['name'], $file_att['size'], 188 $file_att['type'], $page_name, $identity_user['id'], 189 remote_ip_info()); 188 190 } 189 191 -
trunk/www/controllers/job_filters.php
r852 r997 7 7 'job_id', 'time_begin', 'time_end', 'compiler', 8 8 'status', 'score_begin', 'score_end', 9 'eval_msg', 'task_hidden' );9 'eval_msg', 'task_hidden', 'remote_ip_info'); 10 10 11 11 $filters = array(); -
trunk/www/controllers/monitor.php
r996 r997 13 13 $view['filters'] = job_get_filters(); 14 14 $view['user_name'] = getattr($identity_user, 'username'); 15 15 16 // First row. 16 17 // FIXME: shouldn't this constant be in config.php? -
trunk/www/controllers/round.php
r911 r997 218 218 219 219 // This should never fail. 220 log_assert(round_create( 221 $round, 222 $round_params, 223 identity_get_user_id() 224 )); 220 log_assert(round_create($round, $round_params, 221 identity_get_user_id(), remote_ip_info())); 225 222 flash("O noua runda a fost creata, acum poti sa editezi detalii."); 226 223 redirect(url_round_edit($round['id'])); -
trunk/www/controllers/submit.php
r852 r997 13 13 $values = array( 14 14 'task_id' => getattr($_POST, 'task_id'), 15 'compiler_id' => getattr($_POST, 'compiler_id') 15 'compiler_id' => getattr($_POST, 'compiler_id'), 16 'remote_ip_info' => remote_ip_info(), 16 17 ); 17 18 -
trunk/www/controllers/task.php
r996 r997 176 176 177 177 // This should never fail. 178 log_assert(task_create($task, $task_params ));178 log_assert(task_create($task, $task_params, remote_ip_info())); 179 179 flash("Un nou task a fost creeat, acum poti sa-l editezi"); 180 180 redirect(url_task_edit($task['id'])); -
trunk/www/controllers/textblock.php
r987 r997 144 144 getattr($identity_user, 'id'), $rev['security'], 145 145 $rev['forum_topic'], null, 146 $rev['creation_timestamp']); 146 $rev['creation_timestamp'], 147 remote_ip_info()); 147 148 flash("Pagina a fost inlocuita cu revizia {$rev_num}"); 148 149 redirect(url_textblock($page_name)); -
trunk/www/controllers/textblock_copy.php
r989 r997 31 31 32 32 if (!$errors) { 33 textblock_copy($page_name, $new_name); 33 textblock_copy($page_name, $new_name, identity_get_user_id(), 34 remote_ip_info()); 34 35 flash("Pagina a fost copiata."); 35 36 redirect(url_textblock($new_name)); -
trunk/www/controllers/textblock_edit.php
r964 r997 79 79 $new_page['forum_topic'], 80 80 $new_page['timestamp'], 81 $new_page['creation_timestamp']); 81 $new_page['creation_timestamp'], 82 remote_ip_info()); 82 83 if (identity_can('textblock-tag', $new_page)) { 83 84 tag_update("textblock", $new_page['name'], $values['tags']); -
trunk/www/static/css/screen.css
r992 r997 88 88 list-style-type: disc; 89 89 } 90 91 92 90 93 91 /* block quotes */ -
trunk/www/utilities.php
r934 r997 207 207 } 208 208 209 // Return information about the remote IP address. Useful for logging. 210 // This isn't necessarily just an IP address. It might contain proxy 211 // information when available. 212 function remote_ip_info() { 213 $ip_address = getattr($_SERVER, 'REMOTE_ADDR'); 214 if ($ip_address && !is_valid_ip_address($ip_address)) { 215 log_warn("Invalid IP address: {$ip_address}", true, 1); 216 } 217 // FIXME: Also validate XFF header. 218 if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { 219 return getattr($_SERVER, 'REMOTE_ADDR')."; " 220 .$_SERVER['HTTP_X_FORWARDED_FOR']; 221 } else { 222 return getattr($_SERVER, 'REMOTE_ADDR'); 223 } 224 } 225 209 226 ?> -
trunk/www/views/changes.php
r934 r997 29 29 "diff"); 30 30 $tstamp = format_date($rev['timestamp']); 31 echo "$tstamp: $userlink a modificat $pagelink ($difflink)."; 31 if (identity_can('textblock-view-ip', $rev) && $rev['remote_ip_info']) { 32 $remote_ip = '('.$rev['remote_ip_info'].') '; 33 } else { 34 $remote_ip = ''; 35 } 36 echo "$tstamp: $userlink {$remote_ip}a modificat $pagelink ($difflink)."; 32 37 ?> 33 38 </li> -
trunk/www/views/job_detail.php
r996 r997 23 23 <th class="task-id">Problema</th> 24 24 <td class="task-id"><?= format_link(url_textblock($job['task_page_name']), $job['task_title']) ?></td> 25 <th class="score">Scor</th>26 <td class="score"><?= html_escape(is_null($job['score']) ? "Ascuns" : $job['score']) ?></td>27 </tr>28 </tr>29 <tr>30 <th class="compiler-id">Compilator</th>31 <td class="compiler-id"><?= html_escape($job['compiler_id']) ?></td>32 25 <th class="status">Status</th> 33 26 <td class="status"><strong><?= html_escape($job['status']) ?></strong></td> … … 35 28 <tr> 36 29 <th class="round-id">Runda</th> 37 <td class="round-id" colspan="<?= identity_can('job-view-source', $job) ? 1 : 3 ?>">30 <td class="round-id"> 38 31 <?= format_link(url_textblock($job['round_page_name']), $job['round_title']) ?></td> 39 <?php if (identity_can('job-view-source', $job)) { ?> 40 <th class="source">Sursa</th> 41 <td class="source"><?= format_link(url_job_view_source($job['id']), "Vezi sursa") ?></td> 32 <th class="compiler-id">Compilator</th> 33 <td class="compiler-id"> 34 <?= html_escape($job['compiler_id']) ?> 35 <?php if (identity_can('job-view-source', $job)) { ?> 36 | <?= format_link(url_job_view_source($job['id']), "Vezi sursa") ?> 37 <?php } ?> 38 </td> 39 </tr> 40 <tr> 41 <th class="score">Scor</th> 42 <td class="score" colspan="<?= identity_can('job-view-ip', $job) ? 1 : 3 ?>"> 43 <?= html_escape(is_null($job['score']) ? "Ascuns" : $job['score']) ?></td> 44 <?php if (identity_can('job-view-ip', $job)) { ?> 45 <th class="ip">IP</th> 46 <td class="ip"><?= $job['remote_ip_info'] ? html_escape($job['remote_ip_info']) : '<em>lipseste</em>' ?></td> 42 47 <?php } ?> 43 48 </tr> -
trunk/www/views/listattach.php
r980 r997 48 48 } 49 49 50 function format_ip($row) { 51 if ($row['remote_ip_info'] && identity_can('attach-view-ip', $row)) { 52 return html_escape($row['remote_ip_info']); 53 } else { 54 return 'N/A'; 55 } 56 } 57 50 58 function format_operations($row) { 51 59 global $page_name; … … 88 96 ), 89 97 array( 98 'title' => 'IP', 99 'rowform' => 'format_ip', 100 ), 101 array( 90 102 'title' => 'Operatii', 91 103 'rowform' => 'format_operations', -
trunk/www/views/textblock_history.php
r984 r997 20 20 $title = html_escape($row['title']); 21 21 return "$title"; 22 } 23 24 function format_ip($row) { 25 if ($row['remote_ip_info'] && identity_can('textblock-view-ip', $row)) { 26 return html_escape($row['remote_ip_info']); 27 } else { 28 return 'N/A'; 29 } 22 30 } 23 31 … … 83 91 'valform' => 'format_date', 84 92 ), 85 93 array( 94 'title' => 'IP', 95 'rowform' => 'format_ip', 96 ), 86 97 array( 87 98 'title' => 'Operatii',
Note: See TracChangeset
for help on using the changeset viewer.
![[infoarena] development](/chrome/site/logo.png)