1<?php
2/**
3 * @package tikiwiki
4 */
5// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
6//
7// All Rights Reserved. See copyright.txt for details and a complete list of authors.
8// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
9// $Id$
10
11//smarty is not there - we need setup
12
13if (basename($_SERVER['SCRIPT_NAME']) === basename(__FILE__)) {
14	die('This script may only be included.');
15}
16
17require_once('tiki-setup.php');
18
19global $prefs;
20global $tiki_p_freetags_tag;
21
22if ($prefs['feature_freetags'] == 'y' and $tiki_p_freetags_tag == 'y') {
23	$freetaglib = TikiLib::lib('freetag');
24
25	if (isset($_REQUEST['freetag_string'])) {
26		$tag_string = $_REQUEST['freetag_string'];
27	} else {
28		$tag_string = '';
29	}
30
31	global $user;
32
33	if (! isset($cat_desc)) {
34		$cat_desc = '';
35	}
36	if (! isset($cat_name)) {
37		$cat_name = '';
38	}
39	if (! isset($cat_href)) {
40		$cat_href = '';
41	}
42	if (! isset($cat_lang)) {
43		$cat_lang = null;
44	}
45
46	$freetaglib->add_object($cat_type, $cat_objid, false, $cat_desc, $cat_name, $cat_href);
47	$freetaglib->update_tags($user, $cat_objid, $cat_type, $tag_string, false, $cat_lang);
48	require_once 'lib/search/refresh-functions.php';
49	refresh_index($cat_type, $cat_objid);
50}
51