Changeset 330

Show
Ignore:
Timestamp:
05/09/06 22:55:00 (3 years ago)
Author:
sven
Message:

tagging - strip out empty terms, caused by extraneous commas/whitespace, before saving.
profile only for now, as tag-saving could do with being functionised.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/profile/edit.php

    r324 r330  
    9292                        if (sizeof($keyword_list) > 0) { 
    9393                            foreach($keyword_list as $key => $list_item) { 
    94                                 if ($key > 0) { 
    95                                     $keywords .= ", "; 
     94                                $list_item = trim($list_item); 
     95                                if ($list_item) { 
     96                                    if ($key > 0) { 
     97                                        $keywords .= ", "; 
     98                                    } 
     99                                    $keywords .= $list_item; 
     100                                    $t = new StdClass; 
     101                                    $t->tagtype = $field; 
     102                                    $t->access = $access; 
     103                                    $t->tag = $list_item; 
     104                                    $t->ref = $insert_id; 
     105                                    $t->owner = $owner; 
     106                                    insert_record('tags',$t); 
    96107                                } 
    97                                 $keywords .= ($list_item); 
    98                                 $list_item = (trim($list_item)); 
    99                                 $t = new StdClass; 
    100                                 $t->tagtype = $field; 
    101                                 $t->access = $access; 
    102                                 $t->tag = $list_item; 
    103                                 $t->ref = $insert_id; 
    104                                 $t->owner = $owner; 
    105                                 insert_record('tags',$t); 
    106108                            } 
    107109                        } 
  • devel/units/profile/function_actions.php

    r269 r330  
    4141                        if (sizeof($keyword_list) > 0) { 
    4242                            foreach($keyword_list as $key => $list_item) { 
    43                                 if ($key > 0) { 
    44                                     $keywords .= ", "; 
     43                                $list_item = trim($list_item); 
     44                                if ($list_item) { 
     45                                    if ($key > 0) { 
     46                                        $keywords .= ", "; 
     47                                    } 
     48                                    $keywords .= $list_item; 
     49                                    $t = new StdClass; 
     50                                    $t->tagtype = $field; 
     51                                    $t->access = $access; 
     52                                    $t->tag = $list_item; 
     53                                    $t->ref = $insert_id; 
     54                                    $t->owner = $owner; 
     55                                    insert_record('tags',$t); 
    4556                                } 
    46                                 $keywords .= ($list_item); 
    47                                 $list_item = (trim($list_item)); 
    48                                 $t = new StdClass; 
    49                                 $t->tagtype = $field; 
    50                                 $t->access = $access; 
    51                                 $t->tag = $list_item; 
    52                                 $t->ref = $insert_id; 
    53                                 $t->owner = $owner; 
    54                                 insert_record('tags',$t); 
    5557                            } 
    5658                        }