diff --git a/src/messenger/.idea/codeStyleSettings.xml b/src/messenger/.idea/codeStyleSettings.xml
index bb3694e4..08116dc6 100644
--- a/src/messenger/.idea/codeStyleSettings.xml
+++ b/src/messenger/.idea/codeStyleSettings.xml
@@ -3,27 +3,26 @@
   
     
         
           
-            
+            
           
         
       
     
+    
   
 
 
diff --git a/src/messenger/webim/libs/common.php b/src/messenger/webim/libs/common.php
index 4e8fa8b8..43f2c976 100644
--- a/src/messenger/webim/libs/common.php
+++ b/src/messenger/webim/libs/common.php
@@ -349,7 +349,7 @@ function connect()
 		die('Mysql extension is not loaded');
 	}
 	$link = @mysql_connect($mysqlhost, $mysqllogin, $mysqlpass)
-			or die('Could not connect: ' . mysql_error());
+		or die('Could not connect: ' . mysql_error());
 	mysql_select_db($mysqldb, $link) or die('Could not select database');
 	if ($force_charset_in_connection) {
 		mysql_query("SET NAMES '$dbencoding'", $link);
@@ -392,7 +392,7 @@ function db_build_select($fields, $table, $conditions, $orderandgroup)
 function db_rows_count($table, $conditions, $countfields, $link)
 {
 	$result = mysql_query(db_build_select("count(" . ($countfields ? $countfields : "*") . ")", $table, $conditions, ""), $link)
-			or die(' Count query failed: ' . mysql_error($link));
+		or die(' Count query failed: ' . mysql_error($link));
 	$line = mysql_fetch_array($result, MYSQL_NUM);
 	mysql_free_result($result);
 	return $line[0];
@@ -542,9 +542,9 @@ function get_app_location($showhost, $issecure)
 function is_secure_request()
 {
 	return
-			isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443'
-			|| isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on"
-			|| isset($_SERVER["HTTP_HTTPS"]) && $_SERVER["HTTP_HTTPS"] == "on";
+		isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443'
+		|| isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on"
+		|| isset($_SERVER["HTTP_HTTPS"]) && $_SERVER["HTTP_HTTPS"] == "on";
 }
 
 function get_month_selection($fromtime, $totime)
@@ -713,7 +713,7 @@ function print_csrf_token_input()
 {
 	setcsrftoken();
 
-	echo "";
+	echo "\n";
 }
 
 /* print csrf token in url format */
diff --git a/src/messenger/webim/operator/avatar.php b/src/messenger/webim/operator/avatar.php
index 26f062b5..5dec6dc1 100644
--- a/src/messenger/webim/operator/avatar.php
+++ b/src/messenger/webim/operator/avatar.php
@@ -45,7 +45,7 @@ if (!$op) {
 		$errors[] = getlocal('page_agent.cannot_modify');
 
 	} else if (isset($_FILES['avatarFile']) && $_FILES['avatarFile']['name']) {
-		$valid_types = array("gif", "jpg", "png", "tif");
+		$valid_types = array("gif", "jpg", "png", "tif", "jpeg");
 
 		$orig_filename = $_FILES['avatarFile']['name'];
 		$tmp_file_name = $_FILES['avatarFile']['tmp_name'];
@@ -65,7 +65,7 @@ if (!$op) {
 			if (file_exists($full_file_path)) {
 				unlink($full_file_path);
 			}
-			if (!move_uploaded_file($_FILES['avatarFile']['tmp_name'], $full_file_path)) {
+			if (!@move_uploaded_file($_FILES['avatarFile']['tmp_name'], $full_file_path)) {
 				$errors[] = failed_uploading_file($orig_filename, "errors.file.move.error");
 			} else {
 				$avatar = "$webimroot/images/avatar/$new_file_name";