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/** 9* Smarty function plugin 10* ------------------------------------------------------------- 11* Type: function 12* Name: page_in_structure 13* Purpose: returns true if a pag eis in a structure 14* Parameters: pagechecked - mandatory 15* ------------------------------------------------------------- 16*/ 17//this script may only be included - so its better to die if called directly. 18if (strpos($_SERVER['SCRIPT_NAME'], basename(__FILE__)) !== false) { 19 header('location: index.php'); 20 exit; 21} 22 23function smarty_function_page_in_structure($params, $smarty) 24{ 25 $structlib = TikiLib::lib('struct'); 26 extract($params, EXTR_SKIP); 27 28 if (! isset($pagechecked)) { 29 return ('<b>missing pagechecked parameter for Smarty function testing whether page is in a structure</b><br/>'); 30 } 31 32 if ($structlib->page_is_in_structure($pagechecked)) { 33 $result = true; 34 $smarty->assign('page_in_structure', $result); 35 return; 36 } 37 $result = false; 38 $smarty->assign('page_in_structure', $result); 39} 40