added usericon_dir. also added some functions useful for showing a user icon
This commit is contained in:
		| @ -154,6 +154,11 @@ file_dir = "@DEPOTDIR@/files" | |||||||
| ;------------------------------------------------------------------------------ | ;------------------------------------------------------------------------------ | ||||||
| attachment_dir = "@DEPOTDIR@/attachments" | attachment_dir = "@DEPOTDIR@/attachments" | ||||||
|  |  | ||||||
|  | ;------------------------------------------------------------------------------ | ||||||
|  | ; directory to store user icons | ||||||
|  | ;------------------------------------------------------------------------------ | ||||||
|  | usericon_dir = "@DEPOTDIR@/usericons" | ||||||
|  |  | ||||||
| ;------------------------------------------------------------------------------ | ;------------------------------------------------------------------------------ | ||||||
| ; log threshold | ; log threshold | ||||||
| ;------------------------------------------------------------------------------ | ;------------------------------------------------------------------------------ | ||||||
|  | |||||||
| @ -199,7 +199,7 @@ class Project extends Controller | |||||||
| 			$project->description = $this->input->post('project_description'); | 			$project->description = $this->input->post('project_description'); | ||||||
| 			$project->commitable = $this->input->post('project_commitable'); | 			$project->commitable = $this->input->post('project_commitable'); | ||||||
| 			$project->public = $this->input->post('project_public'); | 			$project->public = $this->input->post('project_public'); | ||||||
| 			$project->members = explode (',', $this->input->post('project_members')); | 			$project->members = array_unique (preg_split ('/[[:space:],]+/', $this->input->post('project_members'))); | ||||||
|  |  | ||||||
| 			// validate the form | 			// validate the form | ||||||
| 			if ($this->form_validation->run()) | 			if ($this->form_validation->run()) | ||||||
|  | |||||||
| @ -460,6 +460,35 @@ class ProjectModel extends Model | |||||||
| 		foreach ($files as $file) | 		foreach ($files as $file) | ||||||
| 			@unlink (CODEPOT_FILE_DIR . "/{$file->encname}"); | 			@unlink (CODEPOT_FILE_DIR . "/{$file->encname}"); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	function getUserIcons ($users) | ||||||
|  | 	{ | ||||||
|  | 		$this->db->trans_start (); | ||||||
|  |  | ||||||
|  | 		$this->db->select ('userid,icon_name'); | ||||||
|  | 		$this->db->where_in ('userid', $users); | ||||||
|  | 		$this->db->where ('icon_name IS NOT NULL', null); | ||||||
|  |  | ||||||
|  | 		$query = $this->db->get ('user_settings'); | ||||||
|  | 		if ($this->db->trans_status() === FALSE) | ||||||
|  | 		{ | ||||||
|  | 			$this->db->trans_complete (); | ||||||
|  | 			return FALSE; | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		$out = array(); | ||||||
|  | 		$result = $query->result(); | ||||||
|  | 		 | ||||||
|  | 		if (!empty($result)) | ||||||
|  | 		{ | ||||||
|  | 			foreach ($result as $t) $out[$t->userid] = $t->icon_name; | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		$this->db->trans_complete (); | ||||||
|  | 		if ($this->db->trans_status() === FALSE) return FALSE; | ||||||
|  |  | ||||||
|  | 		return $out; | ||||||
|  | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| ?> | ?> | ||||||
|  | |||||||
| @ -77,13 +77,34 @@ $this->load->view ( | |||||||
| 	$member_count = count($members); | 	$member_count = count($members); | ||||||
| 	$members = array_unique ($members); | 	$members = array_unique ($members); | ||||||
| 	$priority = 0; | 	$priority = 0; | ||||||
|  |  | ||||||
|  | 	$icons = $this->projects->getUserIcons($members); | ||||||
|  | 	if ($icons === FALSE) $icons = array(); // can't get the icon array for members. | ||||||
|  |  | ||||||
| 	for ($i = 0; $i < $member_count; $i++) | 	for ($i = 0; $i < $member_count; $i++) | ||||||
| 	{ | 	{ | ||||||
| 		if (!array_key_exists($i, $members)) continue; | 		if (!array_key_exists($i, $members)) continue; | ||||||
|  |  | ||||||
| 		$m = $members[$i]; | 		$m = $members[$i]; | ||||||
| 		if ($m == '') continue; | 		if ($m == '') continue; | ||||||
| 		print "<li>{$m}</li>"; |  | ||||||
|  | 		$icon = ''; | ||||||
|  | 		if (array_key_exists($m, $icons)) | ||||||
|  | 		{ | ||||||
|  | 			// old browsers don't support image data URI. | ||||||
|  | 			$icon_path = CODEPOT_USERICON_DIR . '/' . $icons[$m]; | ||||||
|  | 			$icon_image = file_get_contents($icon_path); | ||||||
|  | 			if ($icon_image) | ||||||
|  | 			{ | ||||||
|  | 				$icon = sprintf ( | ||||||
|  | 					'<img style="vertical-align:middle;" src="data:%s;base64,%s" alt="" /> ', | ||||||
|  | 					mime_content_type($icon_path), | ||||||
|  | 					base64_encode($icon_image) | ||||||
|  | 				); | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		print "<li>{$icon}{$m}</li>"; | ||||||
| 	} | 	} | ||||||
| ?> | ?> | ||||||
| </ul> | </ul> | ||||||
|  | |||||||
| @ -70,6 +70,7 @@ function load_ini ($file) | |||||||
| 		array ('svnrepo_dir',                  'string',      CODEPOT_DEPOT_DIR.'/svnrepo'), | 		array ('svnrepo_dir',                  'string',      CODEPOT_DEPOT_DIR.'/svnrepo'), | ||||||
| 		array ('file_dir',                     'string',      CODEPOT_DEPOT_DIR.'/files'), | 		array ('file_dir',                     'string',      CODEPOT_DEPOT_DIR.'/files'), | ||||||
| 		array ('attachment_dir',               'string',      CODEPOT_DEPOT_DIR.'/attachments'), | 		array ('attachment_dir',               'string',      CODEPOT_DEPOT_DIR.'/attachments'), | ||||||
|  | 		array ('usericon_dir',                 'string',      CODEPOT_DEPOT_DIR.'/usericons'), | ||||||
|  |  | ||||||
| 		array ('log_threshold',                'integer',     0), | 		array ('log_threshold',                'integer',     0), | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user