267,271c267,271
< function flag_content_add_submit($form_id, $form_values) {
<   global $user;
<   $eid = $form_values['eid'];
<   $type = $form_values['type'];
<   if ($eid && $type) {
---
> /* Helper function for flag_content_add_submit() to separate data
>  * from presentation better
>  */
> function flag_content_add_flag($uid = 0, $eid = 0, $type = FLAG_CONTENT_TYPE_NODE){
>   if (is_numeric($uid) && is_numeric($eid) && $type) {
274c274
<       $eid, $user->uid, $type, time());
---
>       $eid, $uid, $type, time());
300a301,307
> 	
> 	return true;
> 	
>   }
>   
>   return false;
> }
301a309,313
> function flag_content_add_submit($form_id, $form_values) {
>   global $user;
>   $eid = $form_values['eid'];
>   $type = $form_values['type'];
>   if(flag_content_add_flag($user->uid, $eid, $type)){
