mirror of
				https://github.com/Mibew/tray.git
				synced 2025-10-03 00:03:34 +03:00 
			
		
		
		
	fix move_uploaded_file errors
This commit is contained in:
		
							parent
							
								
									dd6632ffdf
								
							
						
					
					
						commit
						c50d60730c
					
				@ -3,27 +3,26 @@
 | 
				
			|||||||
  <component name="ProjectCodeStyleSettingsManager">
 | 
					  <component name="ProjectCodeStyleSettingsManager">
 | 
				
			||||||
    <option name="PER_PROJECT_SETTINGS">
 | 
					    <option name="PER_PROJECT_SETTINGS">
 | 
				
			||||||
      <value>
 | 
					      <value>
 | 
				
			||||||
        <XML>
 | 
					        <option name="OTHER_INDENT_OPTIONS">
 | 
				
			||||||
          <option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
 | 
					          <value>
 | 
				
			||||||
        </XML>
 | 
					            <option name="INDENT_SIZE" value="4" />
 | 
				
			||||||
        <ADDITIONAL_INDENT_OPTIONS fileType="sass">
 | 
					 | 
				
			||||||
          <option name="INDENT_SIZE" value="2" />
 | 
					 | 
				
			||||||
        </ADDITIONAL_INDENT_OPTIONS>
 | 
					 | 
				
			||||||
        <ADDITIONAL_INDENT_OPTIONS fileType="yml">
 | 
					 | 
				
			||||||
          <option name="INDENT_SIZE" value="2" />
 | 
					 | 
				
			||||||
        </ADDITIONAL_INDENT_OPTIONS>
 | 
					 | 
				
			||||||
        <codeStyleSettings language="JavaScript">
 | 
					 | 
				
			||||||
          <indentOptions>
 | 
					 | 
				
			||||||
            <option name="CONTINUATION_INDENT_SIZE" value="8" />
 | 
					            <option name="CONTINUATION_INDENT_SIZE" value="8" />
 | 
				
			||||||
          </indentOptions>
 | 
					            <option name="TAB_SIZE" value="4" />
 | 
				
			||||||
        </codeStyleSettings>
 | 
					            <option name="USE_TAB_CHARACTER" value="true" />
 | 
				
			||||||
 | 
					            <option name="SMART_TABS" value="false" />
 | 
				
			||||||
 | 
					            <option name="LABEL_INDENT_SIZE" value="0" />
 | 
				
			||||||
 | 
					            <option name="LABEL_INDENT_ABSOLUTE" value="false" />
 | 
				
			||||||
 | 
					            <option name="USE_RELATIVE_INDENTS" value="false" />
 | 
				
			||||||
 | 
					          </value>
 | 
				
			||||||
 | 
					        </option>
 | 
				
			||||||
        <codeStyleSettings language="PHP">
 | 
					        <codeStyleSettings language="PHP">
 | 
				
			||||||
          <indentOptions>
 | 
					          <indentOptions>
 | 
				
			||||||
            <option name="CONTINUATION_INDENT_SIZE" value="8" />
 | 
					            <option name="USE_TAB_CHARACTER" value="true" />
 | 
				
			||||||
          </indentOptions>
 | 
					          </indentOptions>
 | 
				
			||||||
        </codeStyleSettings>
 | 
					        </codeStyleSettings>
 | 
				
			||||||
      </value>
 | 
					      </value>
 | 
				
			||||||
    </option>
 | 
					    </option>
 | 
				
			||||||
 | 
					    <option name="USE_PER_PROJECT_SETTINGS" value="true" />
 | 
				
			||||||
  </component>
 | 
					  </component>
 | 
				
			||||||
</project>
 | 
					</project>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -349,7 +349,7 @@ function connect()
 | 
				
			|||||||
		die('Mysql extension is not loaded');
 | 
							die('Mysql extension is not loaded');
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	$link = @mysql_connect($mysqlhost, $mysqllogin, $mysqlpass)
 | 
						$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');
 | 
						mysql_select_db($mysqldb, $link) or die('Could not select database');
 | 
				
			||||||
	if ($force_charset_in_connection) {
 | 
						if ($force_charset_in_connection) {
 | 
				
			||||||
		mysql_query("SET NAMES '$dbencoding'", $link);
 | 
							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)
 | 
					function db_rows_count($table, $conditions, $countfields, $link)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	$result = mysql_query(db_build_select("count(" . ($countfields ? $countfields : "*") . ")", $table, $conditions, ""), $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);
 | 
						$line = mysql_fetch_array($result, MYSQL_NUM);
 | 
				
			||||||
	mysql_free_result($result);
 | 
						mysql_free_result($result);
 | 
				
			||||||
	return $line[0];
 | 
						return $line[0];
 | 
				
			||||||
@ -542,9 +542,9 @@ function get_app_location($showhost, $issecure)
 | 
				
			|||||||
function is_secure_request()
 | 
					function is_secure_request()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return
 | 
						return
 | 
				
			||||||
			isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443'
 | 
							isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443'
 | 
				
			||||||
			|| isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on"
 | 
							|| isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on"
 | 
				
			||||||
			|| isset($_SERVER["HTTP_HTTPS"]) && $_SERVER["HTTP_HTTPS"] == "on";
 | 
							|| isset($_SERVER["HTTP_HTTPS"]) && $_SERVER["HTTP_HTTPS"] == "on";
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function get_month_selection($fromtime, $totime)
 | 
					function get_month_selection($fromtime, $totime)
 | 
				
			||||||
@ -713,7 +713,7 @@ function print_csrf_token_input()
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	setcsrftoken();
 | 
						setcsrftoken();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	echo "<input name='csrf_token' type='hidden' value='" . $_SESSION['csrf_token'] . "' />";
 | 
						echo "<input name='csrf_token' type='hidden' value='" . $_SESSION['csrf_token'] . "' />\n";
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* print csrf token in url format */
 | 
					/* print csrf token in url format */
 | 
				
			||||||
 | 
				
			|||||||
@ -45,7 +45,7 @@ if (!$op) {
 | 
				
			|||||||
		$errors[] = getlocal('page_agent.cannot_modify');
 | 
							$errors[] = getlocal('page_agent.cannot_modify');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	} else if (isset($_FILES['avatarFile']) && $_FILES['avatarFile']['name']) {
 | 
						} 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'];
 | 
							$orig_filename = $_FILES['avatarFile']['name'];
 | 
				
			||||||
		$tmp_file_name = $_FILES['avatarFile']['tmp_name'];
 | 
							$tmp_file_name = $_FILES['avatarFile']['tmp_name'];
 | 
				
			||||||
@ -65,7 +65,7 @@ if (!$op) {
 | 
				
			|||||||
			if (file_exists($full_file_path)) {
 | 
								if (file_exists($full_file_path)) {
 | 
				
			||||||
				unlink($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");
 | 
									$errors[] = failed_uploading_file($orig_filename, "errors.file.move.error");
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				$avatar = "$webimroot/images/avatar/$new_file_name";
 | 
									$avatar = "$webimroot/images/avatar/$new_file_name";
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user