diff --git a/codepot/README b/codepot/README index 1dcf8455..c0361ae9 100644 --- a/codepot/README +++ b/codepot/README @@ -223,8 +223,8 @@ LICENSE CodeIgniter 1.7.2 See src/system/license.txt Google code prettify Apache License 2.0 JavaScript Creole 1.0 Wiki Markup Parser See src/js/creole.js - jQuery JavaScript Library v1.4.2 See http://jquery.org/license - jQuery UI 1.8 MIT or GPL + jQuery JavaScript Library v1.11.2 MIT See http://jquery.org/license + jQuery UI 1.9.2 MIT See http://jquery.org/license PHPGraphLib MIT CLOC 1.62 GPL Flot https://github.com/flot/flot/blob/master/LICENSE.txt diff --git a/codepot/src/codepot/controllers/user.php b/codepot/src/codepot/controllers/user.php index 84e0bc10..4169bec2 100644 --- a/codepot/src/codepot/controllers/user.php +++ b/codepot/src/codepot/controllers/user.php @@ -199,12 +199,18 @@ class User extends Controller } } + // + // make sure that these field also exist in the database + // also change the sanity check in LoginModel/getUser() + // if you add/delete fields to the settings object. + // $settings->code_hide_line_num = $this->input->post('code_hide_line_num'); $settings->code_hide_metadata = $this->input->post('code_hide_metadata'); - $settings->icon_name = $icon_fname; - $settings->uploaded_icon_name = $uploaded_fname; - if ($this->users->storeSettings ($login['id'], $settings) === FALSE) + /* $uploaded_fname will be renamed to this name in users->storeSettings() */ + $settings->icon_name = $icon_fname; + + if ($this->users->storeSettings ($login['id'], $settings, $uploaded_fname) === FALSE) { @unlink (CODEPOT_USERICON_DIR . '/' . $uploaded_fname); $data['message'] = 'DATABASE ERROR'; @@ -249,6 +255,25 @@ class User extends Controller if ($userid_len > 0) { $icon_path = CODEPOT_USERICON_DIR . '/' . $userid . '.png'; + + $stat = @stat($icon_path); + if ($stat !== FALSE) + { + $etag = sprintf ('%x-%x-%x-%x', $stat['dev'], $stat['ino'], $stat['size'], $stat['mtime']); + $lastmod = gmdate ('D, d M Y H:i:s', $stat['mtime']); + + header ('Last-Modified: ' . $lastmod . ' GMT'); + header ('Etag: ' . $etag); + + if ((isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $etag) || + (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $stat['mtime'])) + { + header('Not Modified', true, 304); + flush (); + return; + } + } + $icon_size = @filesize ($icon_path); if (@file_exists($icon_path) === TRUE && ($icon_size = @filesize($icon_path)) !== FALSE && diff --git a/codepot/src/codepot/models/loginmodel.php b/codepot/src/codepot/models/loginmodel.php index fc8eca82..b83a648b 100644 --- a/codepot/src/codepot/models/loginmodel.php +++ b/codepot/src/codepot/models/loginmodel.php @@ -43,6 +43,12 @@ class LoginModel extends Model { $settings = @unserialize ($settings); if ($settings === FALSE) $settings = NULL; + + // Sanity check on the session/cookie data + // See Controller/User->settings() for required fields. + if (!isset($settings->code_hide_line_num)) $settings->code_hide_line_num = ''; + if (!isset($settings->code_hide_metadata)) $settings->code_hide_metadata = ''; + if (!isset($settings->icon_name)) $settings->icon_name = ''; } } diff --git a/codepot/src/codepot/models/usermodel.php b/codepot/src/codepot/models/usermodel.php index c18247e2..f7900f01 100644 --- a/codepot/src/codepot/models/usermodel.php +++ b/codepot/src/codepot/models/usermodel.php @@ -33,7 +33,7 @@ class UserModel extends Model return $result[0]; } - function storeSettings ($userid, $settings) + function storeSettings ($userid, $settings, $uploaded_icon_name) { $icon_name_set = strlen($settings->icon_name) > 0; @@ -74,7 +74,7 @@ class UserModel extends Model if ($icon_name_set) { - if (@rename (CODEPOT_USERICON_DIR . '/' . $settings->uploaded_icon_name, + if (@rename (CODEPOT_USERICON_DIR . '/' . $uploaded_icon_name, CODEPOT_USERICON_DIR . '/' . $settings->icon_name) === FALSE) { $this->db->trans_rollback (); diff --git a/codepot/src/codepot/views/code_blame.php b/codepot/src/codepot/views/code_blame.php index 57d7a5dc..15751a1c 100644 --- a/codepot/src/codepot/views/code_blame.php +++ b/codepot/src/codepot/views/code_blame.php @@ -176,7 +176,14 @@ print anchor ("code/fetch/{$project->id}/${xpar}{$revreq}", $this->lang->line('D
diff --git a/codepot/src/codepot/views/code_file.php b/codepot/src/codepot/views/code_file.php index a7552ec3..dccec44c 100644 --- a/codepot/src/codepot/views/code_file.php +++ b/codepot/src/codepot/views/code_file.php @@ -213,7 +213,14 @@ $this->load->view ( id}/${xpar}/{$file['prev_rev']}", '<<'); - printf ('%s: %s', $this->lang->line('Revision'), $file['created_rev']); + print ' '; + + // anchor to the revision history at the root directory + print anchor ( + "code/revision/{$project->id}/!/{$file['created_rev']}", + sprintf("%s %s", $this->lang->line('Revision'), $file['created_rev']) + ); + if (!empty($file['created_tag'])) { print ' '; @@ -221,6 +228,8 @@ $this->load->view ( print htmlspecialchars($file['created_tag']); print (''); } + + print ' '; print anchor ("code/file/{$project->id}/${xpar}/{$file['next_rev']}", '>>'); print ' | '; @@ -229,6 +238,11 @@ $this->load->view ( lang->line('Metadata')?>
@@ -319,11 +335,6 @@ if (array_key_exists('properties', $file) && count($file['properties']) > 0)
+