function keys_expand($mid, $sep = "-") { global $xoopsDB, $keywords; if (empty($keywords)) { require_once dirname(__FILE__) . "/functions.php"; $keywords = new Keywords(); } $kres = $xoopsDB->query("SELECT keyref FROM " . RELAY . " WHERE midref=" . $mid); $keys = array(); foreach ($keywords->getTree() as $key) { // roots order $keys[$key['keyid']] = array(); } while (list($keyid) = $xoopsDB->fetchRow($kres)) { $root = find_root_id($keyid); $depth = find_root_id($keyid, true); $key = $keywords->get($keyid); if (!empty($key['keyid'])) { $keys[$root][$depth] = $key['name']; } } foreach ($keys as $id => $vals) { if ($vals) { $keys[$id] = join($sep, $vals); } else { unset($keys[$id]); } } return $keys; }
if (!$isadmin || $content->getVar('status') == 'W' && $content->getVar('poster') == $xoopsUser->getVar('uid')) { redirect_header('index.php', 3, _NOPERM); exit; } } $form = array('mid' => $mid); $nop = $mid ? array() : array('mtime', 'ctime', 'poster', 'hits'); keywords_widget($keywidget, $relays, $roots); function squote($x) { return '"' . addslashes($x) . '"'; } $dests = array(); if ($relays) { foreach ($relays as $k => $v) { $rk = find_root_id($v['keyid']); $rt = $v['root']; if (empty($dests[$rk])) { $dests[$rk] = array($rt); } else { if (!in_array($rt, $dests[$rk])) { $dests[$rk][] = $rt; } } $relays[$k]['values'] = "new Array(" . join(',', $v['values']) . ")"; $relays[$k]['labels'] = "new Array(" . join(',', array_map('squote', $v['labels'])) . ")"; } } foreach ($dests as $k => $v) { $dests[$k] = "new Array(" . join(',', $v) . ",0)"; }