<commit_before><?php
namespace content_account\profile;


class model
{

	/**
	 * UploAads an avatar.
	 *
	 * @return     boolean  ( description_of_the_return_value )
	 */
	public static function upload_avatar()
	{
		if(\dash\request::files('avatar'))
		{
			$uploaded_file = \dash\app\file::upload(['debug' => false, 'upload_name' => 'avatar']);

			if(isset($uploaded_file['url']))
			{
				\dash\notif::direct();

				return $uploaded_file['url'];
			}
			// if in upload have error return
			if(!\dash\engine\process::status())
			{
				return false;
			}
		}
		return null;
	}


	public static function getPost()
	{
		$post =
		[
			// 'twostep'     => \dash\request::post('twostep'),
			// 'sidebar'     => \dash\request::post('sidebar') ? true : false,
			// 'language'    => \dash\request::post('language'),
			// 'website'     => \dash\request::post('website'),
			// 'instagram'   => \dash\request::post('instagram'),
			// 'linkedin'    => \dash\request::post('linkedin'),
			// 'facebook'    => \dash\request::post('facebook'),
			// 'twitter'     => \dash\request::post('twitter'),
			'firstname'   => \dash\request::post('firstname'),
			'lastname'    => \dash\request::post('lastname'),
			'username'    => \dash\request::post('username'),
			'title'       => \dash\request::post('title'),
			'bio'         => \dash\request::post('bio'),
			'displayname' => \dash\request::post('displayname'),
			// 'birthday'    => \dash\request::post('birthday'),
			// 'fullname'    => \dash\request::post('fullname'),
			// 'gender'      => \dash\request::post('gender'),
			// 'email'       => \dash\request::post('email'),
		];

		$avatar = self::upload_avatar();

		if($avatar)
		{
			$post['avatar'] = $avatar;
		}

		return $post;
	}


	/**
	 * Posts a user add.
	 */
	public static function post()
	{

		$request = self::getPost();

		// ready request
		$id = \dash\coding::encode(\dash\user::id());

		$result = \dash\app\user::edit($request, $id);

		if(\dash\engine\process::status())
		{
			\dash\log::set('editProfileAbout', ['code' => \dash\user::id()]);
			\dash\user::refresh();
			\dash\redirect::pwd();
		}
	}
}
?><commit_msg>refresh user if change name<commit_after><?php
namespace content_account\profile;


class model
{

	/**
	 * UploAads an avatar.
	 *
	 * @return     boolean  ( description_of_the_return_value )
	 */
	public static function upload_avatar()
	{
		if(\dash\request::files('avatar'))
		{
			$uploaded_file = \dash\app\file::upload(['debug' => false, 'upload_name' => 'avatar']);

			if(isset($uploaded_file['url']))
			{
				\dash\notif::direct();

				return $uploaded_file['url'];
			}
			// if in upload have error return
			if(!\dash\engine\process::status())
			{
				return false;
			}
		}
		return null;
	}


	public static function getPost()
	{
		$post =
		[
			// 'twostep'     => \dash\request::post('twostep'),
			// 'sidebar'     => \dash\request::post('sidebar') ? true : false,
			// 'language'    => \dash\request::post('language'),
			// 'website'     => \dash\request::post('website'),
			// 'instagram'   => \dash\request::post('instagram'),
			// 'linkedin'    => \dash\request::post('linkedin'),
			// 'facebook'    => \dash\request::post('facebook'),
			// 'twitter'     => \dash\request::post('twitter'),
			'firstname'   => \dash\request::post('firstname'),
			'lastname'    => \dash\request::post('lastname'),
			'username'    => \dash\request::post('username'),
			'title'       => \dash\request::post('title'),
			'bio'         => \dash\request::post('bio'),
			'displayname' => \dash\request::post('displayname'),
			// 'birthday'    => \dash\request::post('birthday'),
			// 'fullname'    => \dash\request::post('fullname'),
			// 'gender'      => \dash\request::post('gender'),
			// 'email'       => \dash\request::post('email'),
		];

		$avatar = self::upload_avatar();

		if($avatar)
		{
			$post['avatar'] = $avatar;
		}

		return $post;
	}


	/**
	 * Posts a user add.
	 */
	public static function post()
	{

		$request = self::getPost();

		// ready request
		$id = \dash\coding::encode(\dash\user::id());

		$result = \dash\app\user::edit($request, $id);

		if(\dash\engine\process::status())
		{
			\dash\log::set('editProfileAbout', ['code' => \dash\user::id()]);
			\dash\user::refresh();
			\dash\notif::direct();
			\dash\redirect::pwd();
		}
	}
}
?>
{'fraction_non_alphanumeric': 0.22702078521939953, 'fraction_numerical': 0.0, 'mean_word_length': 3.0288372093023255, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6599979', 'n_tokens_mistral': 1723, 'n_tokens_neox': 1494, 'n_words': 223}