1 | <?
|
---|
2 |
|
---|
3 | /***************************************************************************
|
---|
4 | * Dolphin Smart Community Builder
|
---|
5 | * -----------------
|
---|
6 | * begin : Mon Mar 23 2006
|
---|
7 | * copyright : (C) 2006 BoonEx Group
|
---|
8 | * website : http://www.boonex.com/
|
---|
9 | * This file is part of Dolphin - Smart Community Builder
|
---|
10 | *
|
---|
11 | * Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License.
|
---|
12 | * http://creativecommons.org/licenses/by/3.0/
|
---|
13 | *
|
---|
14 | * Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
---|
15 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
---|
16 | * See the Creative Commons Attribution 3.0 License for more details.
|
---|
17 | * You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin,
|
---|
18 | * see license.txt file; if not, write to marketing@boonex.com
|
---|
19 | ***************************************************************************/
|
---|
20 |
|
---|
21 | require_once( 'header.inc.php' );
|
---|
22 | require_once( BX_DIRECTORY_PATH_INC . 'db.inc.php' );
|
---|
23 | require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
|
---|
24 | require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' );
|
---|
25 | require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' );
|
---|
26 | require_once( BX_DIRECTORY_PATH_CLASSES . 'BxDolTags.php' );
|
---|
27 |
|
---|
28 |
|
---|
29 | function explodeTags( $text )
|
---|
30 | {
|
---|
31 | //$text = preg_replace( '/[^a-zA-Z0-9_\'-]/', ' ', $text );
|
---|
32 |
|
---|
33 | $aTags = preg_split( '/[' . BX_DOL_TAGS_DIVIDER . ']/', $text, 0, PREG_SPLIT_NO_EMPTY );
|
---|
34 |
|
---|
35 | foreach( $aTags as $iInd => $sTag )
|
---|
36 | {
|
---|
37 | if( strlen( $sTag ) < 3 )
|
---|
38 | unset( $aTags[$iInd] );
|
---|
39 | else
|
---|
40 | $aTags[$iInd] = trim(mb_strtolower( $sTag , 'UTF-8'));
|
---|
41 | }
|
---|
42 | $aTags = array_unique( $aTags );
|
---|
43 | $sTagsNotParsed = getParam( 'tags_non_parsable' );
|
---|
44 | $aTagsNotParsed = preg_split( '/[' . BX_DOL_TAGS_DIVIDER . ']/', $sTagsNotParsed, 0, PREG_SPLIT_NO_EMPTY );
|
---|
45 |
|
---|
46 | $aTags = array_diff( $aTags, $aTagsNotParsed ); //drop non parsable tags
|
---|
47 |
|
---|
48 | return $aTags;
|
---|
49 | }
|
---|
50 |
|
---|
51 | function storeTags( $iID, $sTags, $sType )
|
---|
52 | {
|
---|
53 | $aTags = explodeTags( $sTags );
|
---|
54 | db_res( "DELETE FROM `sys_tags` WHERE `ID` = $iID AND `Type` = '$sType'" ); //re-store if exist
|
---|
55 |
|
---|
56 | foreach( $aTags as $sTag )
|
---|
57 | {
|
---|
58 | $sTag = addslashes( $sTag );
|
---|
59 | db_res( "INSERT INTO `sys_tags` VALUES ( '$sTag', $iID, '$sType', CURRENT_TIMESTAMP )", 0 );
|
---|
60 | }
|
---|
61 | }
|
---|
62 |
|
---|
63 | function reparseObjTags( $sType, $iID ) {
|
---|
64 | $oTags = new BxDolTags();
|
---|
65 | $oTags->reparseObjTags($sType, $iID);
|
---|
66 | }
|
---|
67 |
|
---|
68 | ?>
|
---|