From c9f7ae9d63147c885aaccc44e8c119ebd319bf86 Mon Sep 17 00:00:00 2001 From: shizuki Date: Fri, 6 Oct 2006 05:15:59 +0000 Subject: [PATCH] =?utf8?q?=E6=9C=9D=E3=81=AE=E5=88=86=E4=BF=AE=E6=AD=A3/?= =?utf8?q?=E6=9C=AA=E3=83=86=E3=82=B9=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@425 1ca29b6e-896d-4ea0-84a5-967f57386b96 --- trunk/NP_Dtree/NP_Dtree.php | 2 +- trunk/NP_Dtree/dtree/dtreedata.php | 110 ++++++++++++++++++------------------- 2 files changed, 54 insertions(+), 58 deletions(-) diff --git a/trunk/NP_Dtree/NP_Dtree.php b/trunk/NP_Dtree/NP_Dtree.php index 7baea41..db46435 100644 --- a/trunk/NP_Dtree/NP_Dtree.php +++ b/trunk/NP_Dtree/NP_Dtree.php @@ -65,7 +65,7 @@ class NP_Dtree extends NucleusPlugin if ($skinType == 'template') { echo ''; + $randomID . 'a&bid=' . $blogid . '&id=' . $itemid . '">'; echo 'open all' . ' | close all'; return; diff --git a/trunk/NP_Dtree/dtree/dtreedata.php b/trunk/NP_Dtree/dtree/dtreedata.php index 31ae8a7..a69f508 100644 --- a/trunk/NP_Dtree/dtree/dtreedata.php +++ b/trunk/NP_Dtree/dtree/dtreedata.php @@ -1,25 +1,11 @@ getBlog($blogid); $blogurl = $b->getURL(); if (!$blogurl) { if($blog) { - $b_tmp =& $manager->getBlog($CONF['DefaultBlog']); + $b_tmp =& $manager->getBlog($blogid); $blogurl = $b_tmp->getURL(); } if (!$blogurl) { $blogurl = $CONF['IndexURL']; - if (!$usePathInfo){ + if (!$usePathInfo) { if ($data['type'] == 'pageparser') { $blogurl .= 'index.php'; } else { @@ -62,15 +50,16 @@ $CONF['ArchiveListURL'] = $blogurl; $CONF['SearchURL'] = $blogurl; - echo $objectId . " = new dTree('" . htmlspecialchars($objectId) . "');\n"; + echo $objectId . "=new dTree('" . htmlspecialchars($objectId) . "');\n"; echo $objectId . ".add(0,-1,'" . htmlspecialchars($blogname) . "');\n"; - $res = sql_query("SELECT * FROM " . sql_table('category') . " WHERE cblog = " . $blogid); + $resq = 'SELECT * FROM %s WHERE cblog = %d'; + $res = sql_query(sprintf($resq, sql_table('category'), $blogid)); $n = 1; while ($o = mysql_fetch_object($res)) { $catid = intval($o->catid); - $nodeArray[cat][$catid] = $n; + $nodeArray['cat'][$catid] = $n; // $url = createBlogidLink($blogid, array('catid'=>$catid)); $url = createCategoryLink($catid); // $url = createBlogidLink($blogid, array("$CategoryKey"=>$catid)); @@ -84,85 +73,92 @@ $mPlugin =& $manager->getPlugin('NP_MultipleCategories'); $subrequest = $mPlugin->getRequestName(); echo 'document.write(' . $objectId . ');'; - if ($itemid = intval(requestVar('id'))) { - $catid = quickQuery('SELECT icat as result FROM ' . sql_table('item') . ' WHERE inumber = ' . $itemid); - $nodeId = 's' . $objectId . $nodeArray[cat][$catid]; + if ($itemid = intRequestVar('id')) { + $que = 'SELECT icat as result FROM %s WHERE inumber = %d'; + $catid = quickQuery(sprintf($que, sql_table('item'), $itemid)); + $catid = intval($catid); + $nodeId = 's' . $objectId . $nodeArray['cat'][$catid]; echo "document.getElementById('" . htmlspecialchars($nodeId) . "').className = 'selectedNode';"; } return; } if ($catFilter[1]) { - $catFilter = @join(',', $catFilter); + $catFilter = @join(', ', $catFilter); $catFilter = ' IN (' . $catFilter . ')'; } else { $catFilter = '=' . $catFilter; } - $query = "SELECT * FROM " . sql_table('plug_multiple_categories_sub') . " WHERE catid" . $catFilter; - $res = sql_query($query); + $query = 'SELECT * FROM %s WHERE catid %s'; + $res = sql_query(sprintf($query, sql_table('plug_multiple_categories_sub'), $catFilter)); while ($o = mysql_fetch_object($res)) { $scatid = intval($o->scatid); - $nodeArray[subcat][$scatid] = $n; + $nodeArray['subcat'][$scatid] = $n; $n++; } - $query = "SELECT * FROM " . sql_table('plug_multiple_categories_sub') . " WHERE catid" . $catFilter; - $res = sql_query($query); + $query = 'SELECT * FROM %s WHERE catid %s'; + $res = sql_query(sprintf($query, sql_table('plug_multiple_categories_sub'), $catFilter)); while ($u = mysql_fetch_object($res)) { $scatid = intval($u->scatid); + $parent_id = intval($u->parentid); + $cat_id = intval($u->catid); // $url = createBlogidLink($blogid, array('catid'=>$u->catid, 'subcatid'=>$scatid)); $url = createCategoryLink($u->catid, array($subrequest => $scatid)); // $url = createBlogidLink($blogid, array("$CategoryKey"=>$u->catid, 'subcatid'=>$scatid)); - $pnode = ($u->parentid) ? $nodeArray[subcat][$u->parentid] : $nodeArray[cat][$u->catid]; - echo $objectId . ".add(" . $nodeArray[subcat][$u->scatid] . "," . $pnode . ",'" . htmlspecialchars($u->sname) . "','" . $url . "');\n"; + $pnode = (!empty($parent_id)) ? $nodeArray['subcat'][$parent_id] : $nodeArray['cat'][$cat_id]; + echo $objectId . ".add(" . $nodeArray['subcat'][$scatid] . "," . $pnode . ",'" . htmlspecialchars($u->sname) . "','" . $url . "');\n"; } - echo "document.write(".$objectId.");\n"; + echo "document.write(" . $objectId . ");\n"; - if (requestVar('sid')) { - $sid = intval(requestVar('sid')); - $nodeId = 's' . $objectId . $nodeArray[subcat][$sid]; - echo "document.getElementById('" . $nodeId . "').className = 'urlselected';\n"; - echo $objectId . ".openTo(" . $nodeArray[subcat][$sid] . ", true);\n"; - } elseif(requestVar('cid')) { - $cid = intval(requestVar('cid')); - $nodeId = 's' . $objectId . $nodeArray[cat][$cid]; - echo "document.getElementById('" . $nodeId . "').className = 'urlselected';\n"; - echo $objectId . ".openTo(" . $nodeArray[cat][$cid] . ", true);\n"; + if ($sid = intRequestVar('sid')) { +// $sid = intRequestVar('sid'); + $nodeId = 's' . $objectId . $nodeArray['subcat'][$sid]; + echo "document.getElementById('" . $nodeId . "').className='urlselected';\n"; + echo $objectId . ".openTo(" . $nodeArray['subcat'][$sid] . ",true);\n"; + } elseif ($cid = intRequestVar('cid')) { +// $cid = intRequestVar('cid'); + $nodeId = 's' . $objectId . $nodeArray['cat'][$cid]; + echo "document.getElementById('" . $nodeId . "').className='urlselected';\n"; + echo $objectId . ".openTo(" . $nodeArray['cat'][$cid] . ",true);\n"; } - if ($itemid = requestVar('id')) { - $catid = quickQuery('SELECT icat as result FROM ' . sql_table('item') . ' WHERE inumber = ' . intval($itemid)); - $nodeId = 's' . $objectId.$nodeArray[cat][$catid]; - echo "document.getElementById('" . $nodeId . "').className = 'selectedNode';\n"; + if ($itemid = intRequestVar('id')) { + $que = 'SELECT icat as result FROM %s WHERE inumber = %d'; + $catid = quickQuery($que, sql_table('item'), $itemid); + $catid = intva($catid); +// $catid = quickQuery('SELECT icat as result FROM ' . sql_table('item') . ' WHERE inumber = ' . $itemid); + $nodeId = 's' . $objectId.$nodeArray['cat'][$catid]; + echo "document.getElementById('" . $nodeId . "').className='selectedNode';\n"; //multi catid $que = 'SELECT categories as result FROM %s WHERE item_id = %d'; - $catids = quickQuery(sprintf($que, sql_table('plug_multiple_categories'), intval($itemid))); + $catids = quickQuery(sprintf($que, sql_table('plug_multiple_categories'), $itemid)); if ($catids) { $catids = explode(',', $catids); for ($i=0;$i