function trove_genfullpaths($mynode, $myfullpath, $myfullpathids) { // first generate own path $res_update = db_query('UPDATE trove_cat SET fullpath=\'' . $myfullpath . '\',fullpath_ids=\'' . $myfullpathids . '\' WHERE trove_cat_id=' . $mynode); $res_child = db_query('SELECT trove_cat_id,fullname FROM ' . 'trove_cat WHERE parent=' . $mynode); while ($row_child = db_fetch_array($res_child)) { trove_genfullpaths($row_child['trove_cat_id'], $myfullpath . ' :: ' . $row_child['fullname'], $myfullpathids . ' :: ' . $row_child['trove_cat_id']); } }
/** * trove_genfullpaths() - Regenerates full path entries for $node and all subnodes * * @param int The node * @param string The full path for this node * @param int The full path IDs */ function trove_genfullpaths($mynode, $myfullpath, $myfullpathids) { // first generate own path $res_update = db_query('UPDATE trove_cat SET fullpath=\'' . $myfullpath . '\',fullpath_ids=\'' . $myfullpathids . '\' WHERE trove_cat_id=' . $mynode); // now generate paths for all children by recursive call if ($mynode != 0) { $res_child = db_query("\n\t\t\tSELECT trove_cat_id,fullname\n\t\t\tFROM trove_cat\n\t\t\tWHERE parent='{$mynode}'\n\t\t\tAND trove_cat_id!=0;\n\t\t", -1, 0, SYS_DB_TROVE); while ($row_child = db_fetch_array($res_child)) { trove_genfullpaths($row_child['trove_cat_id'], addslashes(quotemeta($myfullpath)) . ' :: ' . addslashes(quotemeta($row_child['fullname'])), $myfullpathids . ' :: ' . $row_child['trove_cat_id']); } } }
function trove_genfullpaths($mynode, $myfullpath, $myfullpathids) { // first generate own path $res_update = db_query('UPDATE trove_cat SET fullpath=\'' . db_es($myfullpath) . '\',fullpath_ids=\'' . db_es($myfullpathids) . '\' WHERE trove_cat_id=' . db_ei($mynode)); $res_child = db_query('SELECT trove_cat_id,fullname FROM ' . 'trove_cat WHERE parent=' . db_ei($mynode)); while ($row_child = db_fetch_array($res_child)) { //for the root node everything works a bit different ... if (!$mynode) { trove_genfullpaths($row_child['trove_cat_id'], $row_child['fullname'], $row_child['trove_cat_id']); } else { trove_genfullpaths($row_child['trove_cat_id'], $myfullpath . ' :: ' . $row_child['fullname'], $myfullpathids . ' :: ' . $row_child['trove_cat_id']); } } }
// SourceForge: Breaking Down the Barriers to Open Source Development // Copyright 1999-2000 (c) The SourceForge Crew // http://sourceforge.net // // $Id: trove_cat_edit.php,v 1.2 2003/11/13 11:29:21 helix Exp $ require "pre.php"; require "trove.php"; session_require(array('group' => '1', 'admin_flags' => 'A')); // ######################################################## if ($GLOBALS["Submit"]) { $newroot = trove_getrootcat($GLOBALS['form_parent']); if ($GLOBALS[form_shortname]) { db_query('UPDATE trove_cat ' . 'SET ' . 'shortname=\'' . $GLOBALS[form_shortname] . '\',fullname=\'' . $GLOBALS[form_fullname] . '\',description=\'' . $GLOBALS[form_description] . '\',parent=\'' . $GLOBALS[form_parent] . '\',version=' . date("Ymd", time()) . '01' . ',root_parent=\'' . $newroot . '\' WHERE trove_cat_id=' . $GLOBALS["form_trove_cat_id"]); } // update full paths now trove_genfullpaths($newroot, trove_getfullname($newroot), $newroot); session_redirect("/admin/trove/trove_cat_list.php"); } $res_cat = db_query("SELECT * FROM trove_cat WHERE trove_cat_id={$trove_cat_id}"); if (db_numrows($res_cat) < 1) { exit_error("No Suck Category", "That trove cat does not exist"); } $row_cat = db_fetch_array($res_cat); $HTML->header(array(title => "Trove - Edit Category")); ?> <form action="trove_cat_edit.php" method="post"> <input type="hidden" name="form_trove_cat_id" value="<?php print $GLOBALS['trove_cat_id']; ?> ">
if ($form_shortname) { if ($form_trove_cat_id == $form_parent) { exit_error(_("Error: a category can't be the same as its own parent."), db_error()); } else { $res = db_query("\n\t\t\t\tUPDATE trove_cat\n\t\t\t\tSET\tshortname='" . htmlspecialchars($form_shortname) . "',\n\t\t\t\t\tfullname='" . htmlspecialchars($form_fullname) . "',\n\t\t\t\t\tdescription='" . htmlspecialchars($form_description) . "',\n\t\t\t\t\tparent='{$form_parent}',\n\t\t\t\t\tversion='" . date("Ymd", time()) . "01',\n\t\t\t\t\troot_parent='{$newroot}'\n\t\t\t\tWHERE trove_cat_id='{$form_trove_cat_id}'\n\t\t\t"); } if (!$res || db_affected_rows($res) < 1) { exit_error(_('Error In Trove Operation'), db_error()); } } // update full paths now if ($newroot != 0) { trove_genfullpaths($newroot, trove_getfullname($newroot), $newroot); trove_updaterootparent($form_trove_cat_id, $newroot); } else { trove_genfullpaths($form_trove_cat_id, trove_getfullname($form_trove_cat_id), $form_trove_cat_id); trove_updaterootparent($form_trove_cat_id, $form_trove_cat_id); } db_query("update trove_group_link set trove_cat_root=(select root_parent from trove_cat where trove_cat_id=trove_group_link.trove_cat_id)"); session_redirect("/admin/trove/trove_cat_list.php"); } if (getStringFromRequest("delete")) { $form_trove_cat_id = getIntFromRequest('form_trove_cat_id'); if ($form_trove_cat_id == $default_trove_cat) { exit_error(_('Error In Trove Operation, can\'t delete trove category define as default in local.inc')); } $res = db_query("SELECT * FROM trove_cat WHERE parent='{$form_trove_cat_id}'"); if (!$res) { exit_error(_('Error In Trove Operation'), db_error()); } if (db_numrows($res) > 0) {