Index: common/attachment.php =================================================================== --- common/attachment.php (revision 1169) +++ common/attachment.php (working copy) @@ -37,14 +37,13 @@ function attachment_validate($att) { function get_mime_type($filename) { if (function_exists("finfo_open")) { // FIXME: cache. - $finfo = finfo_open(FILEINFO_MIME); + $finfo = finfo_open(FILEINFO_MIME_TYPE); log_assert($finfo !== false, 'fileinfo is active but finfo_open() failed'); $res = finfo_file($finfo, $filename); finfo_close($finfo); - log_print('get_mime_type('.$filename.'): finfo yields '.$res); return $res; } if (function_exists("mime_content_type")) { Index: common/external_libs/class.phpmailer.php =================================================================== --- common/external_libs/class.phpmailer.php (revision 1169) +++ common/external_libs/class.phpmailer.php (working copy) @@ -474,7 +474,7 @@ class PHPMailer { $to .= $this->AddrFormat($this->to[$i]); } - $toArr = split(',', $to); + $toArr = explode(',', $to); $params = sprintf("-oi -f %s", $this->Sender); if ($this->Sender != '' && strlen(ini_get('safe_mode'))< 1) { @@ -596,7 +596,7 @@ class PHPMailer { /* Retry while there is no connection */ while($index < count($hosts) && $connection == false) { $hostinfo = array(); - if(eregi('^(.+):([0-9]+)$', $hosts[$index], $hostinfo)) { + if(preg_match('/^(.+):([0-9]+)$/i', $hosts[$index], $hostinfo)) { $host = $hostinfo[1]; $port = $hostinfo[2]; } else { @@ -1721,7 +1721,7 @@ class PHPMailer { $directory = dirname($url); ($directory == '.')?$directory='':''; $cid = 'cid:' . md5($filename); - $fileParts = split("\.", $filename); + $fileParts = explode(".", $filename); $ext = $fileParts[1]; $mimeType = $this->_mime_types($ext); if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; } @@ -1907,4 +1907,4 @@ class PHPMailer { } } -?> \ No newline at end of file +?> Index: scripts/attach-endline-fix old mode 100644 new mode 100755 =================================================================== --- scripts/attach-endline-fix (revision 1169) +++ scripts/attach-endline-fix (working copy) @@ -19,16 +19,25 @@ foreach ($files as $file) { $file_path = attachment_get_filepath($file); if (is_file($file_path)) { - if (is_textfile($file['mime_type']) && - is_grader_testfile($file['name']) && + if (is_grader_testfile($file['name']) && is_problem_page($file['page'])) { + if (!is_textfile($file['mime_type'])) { + log_print('Test file ' . $file['name'] . ' on page ' . + $file['page'] . ' of size ' . filesize($file_path) . + ' has an unexpected mime type: ' . + $file['mime_type']); + if (read_bool('Do you want to skip file?', true)) { + continue; + } + } + if (add_ending_newline($file_path)) { if ($verbose) { log_print("Added newline to file " . $file_path); } db_query("UPDATE `ia_file`" . - " SET `size` = " . db_quote(filesize($file_path)) . - " WHERE `id` = " . db_quote($file['id'])); + " SET `size` = " . db_quote(filesize($file_path)) . + " WHERE `id` = " . db_quote((int)$file['id'])); $nr_changed++; } } Index: scripts/check-attachments =================================================================== --- scripts/check-attachments (revision 1169) +++ scripts/check-attachments (working copy) @@ -2,6 +2,7 @@ "); - $elems = split(" ", $cmd); + $elems = explode(" ", $cmd); if (1 < count($elems)) { $cmd = $elems[0]; array_shift($elems); Index: www/config.php =================================================================== --- www/config.php (revision 1169) +++ www/config.php (working copy) @@ -71,6 +71,6 @@ define("IA_LATEX_ENABLE", !IA_DEVELOPMENT_MODE); // List of safe MIME types // FIXME: add more? -$IA_SAFE_MIME_TYPES = array('image/jpeg', 'image/pjpeg', 'image/png', 'image/gif', 'image/bmp', 'image/x-ms-bmp'); +$IA_SAFE_MIME_TYPES = array('image/jpeg', 'image/png', 'image/gif', 'image/bmp', 'image/x-ms-bmp'); ?> Index: www/controllers/textblock.php =================================================================== --- www/controllers/textblock.php (revision 1169) +++ www/controllers/textblock.php (working copy) @@ -54,7 +54,9 @@ function controller_textblock_view($page_name, $rev_num = null, $view['page_name'] = $page['name']; $view['textblock'] = $page; $view['forum_topic'] = $page['forum_topic']; - + if ($page_name == 'admin') { + $view['topnav_select'] = 'admin'; + } execute_view_die($display_view, $view); } Index: www/views/header.php =================================================================== --- www/views/header.php (revision 1169) +++ www/views/header.php (working copy) @@ -93,8 +93,8 @@ if (!isset($topnav_select)) { $topnav_select = 'infoarena'; } ia_template_header(); -$smf_admin = ('admin' == getattr($identity_user, 'security_level')); -ia_template_topnav($topnav_select, $smf_admin); +$is_admin = ('admin' == getattr($identity_user, 'security_level')); +ia_template_topnav($topnav_select, $is_admin); ?>