From: <mo...@us...> - 2004-11-23 17:38:43
|
Update of /cvsroot/tikiwiki/tiki/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9165/modules Added Files: Tag: BRANCH-1-9 mod-change_category.php Log Message: added forgotten modules --- NEW FILE: mod-change_category.php --- <?php // $Header: /cvsroot/tikiwiki/tiki/modules/Attic/mod-change_category.php,v 1.1.2.1 2004/11/23 17:38:32 mose Exp $ //this script may only be included - so its better to die if called directly. if (strpos($_SERVER["SCRIPT_NAME"],basename(__FILE__)) !== false) { header("location: index.php"); exit; } if ($feature_categories == 'y' and isset($_REQUEST['page'])) { $id = 0; if (isset($module_params['id'])) { $id = $module_params['id']; } global $categlib; if (!is_object($categlib)) require ("lib/categories/categlib.php"); global $logslib; $cat_type = 'wiki page'; $cat_objid = $_REQUEST['page']; $categs = $categlib->get_child_categories($id); $num = count($categs); for ($i=0;$i<$num;$i++) { $categsid[] = $categs[$i]['categId']; } if (isset($_REQUEST["modcatid"]) and $_REQUEST["modcatid"] == $id) { $cats = $categlib->get_object_categories($cat_type, $cat_objid); $catObjectId = $categlib->is_categorized($cat_type, $_REQUEST['page']); foreach ($cats as $cs) { if (in_array($cs,$categsid)) { $query = "delete from `tiki_category_objects` where `catObjectId`=? and `categId`=?"; $result = $tikilib->query($query,array((int) $catObjectId, (int) $cs)); } } $categlib->categorize_page($_REQUEST['page'], $_REQUEST['modcatchange']); $logslib->add_log('step',"changed ".$_REQUEST['page']." from $cs to ".$_REQUEST['modcatchange']); } $incategs = $categlib->get_object_categories($cat_type, $cat_objid); for ($i=0;$i<$num;$i++) { $cid = $categs[$i]['categId']; $modcatlist[$cid] = $categs[$i]; if (in_array($cid,$incategs)) { $modcatlist[$cid]['incat'] = 'y'; } else { $modcatlist[$cid]['incat'] = 'n'; } } $smarty->assign('modcatlist',$modcatlist); $smarty->assign('modcatid',$id); } ?> |