1<?php 2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project 3// 4// All Rights Reserved. See copyright.txt for details and a complete list of authors. 5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. 6// $Id$ 7 8//this script may only be included - so its better to die if called directly. 9if (strpos($_SERVER["SCRIPT_NAME"], basename(__FILE__)) !== false) { 10 header("location: index.php"); 11 exit; 12} 13 14function smarty_function_object_title($params, $smarty) 15{ 16 if (! isset($params['type'], $params['id']) && ! isset($params['identifier'])) { 17 return tra('No object information provided.'); 18 } 19 20 if (isset($params['type'], $params['id'])) { 21 $type = $params['type']; 22 $object = $params['id']; 23 if (substr($type, -7) == 'comment') { 24 $type = substr($type, 0, strlen($type) - 8); 25 $info = TikiLib::lib('comments')->get_comment((int)$object); 26 $object = $info['object']; 27 } 28 } else { 29 list($type, $object) = explode(':', $params['identifier'], 2); 30 } 31 32 $smarty->loadPlugin('smarty_modifier_escape'); 33 return smarty_modifier_escape(TikiLib::lib('object')->get_title($type, $object)); 34} 35