function genIndexTree0($xnpsid)
{
    $criteria = array('orders' => array(array('name' => 'parent_index_id', 'order' => 'ASC'), array('name' => 'sort_number', 'order' => 'ASC')));
    $indexes = array();
    xnp_get_all_indexes($xnpsid, $criteria, $indexes);
    if (empty($indexes)) {
        return array();
    }
    return $indexes;
}
function xoonipsGetIndexCountInfo($xnpsid, $xid)
{
    $index = array();
    $result = xnp_get_index($xnpsid, $xid, $index);
    if ($result != RES_OK) {
        redirect_header(XOOPS_URL . '/index.php', 3, "ERROR");
        break;
    }
    $openLevel = $index['open_level'];
    $indexes = array();
    $result = xnp_get_all_indexes($xnpsid, array(), $indexes);
    if ($result != RES_OK) {
        redirect_header(XOOPS_URL . '/index.php', 3, "ERROR");
        break;
    }
    $indexesLen = count($indexes);
    if ($openLevel == OL_PRIVATE) {
        $indexUID = $index['owner_uid'];
        $indexCount = 0;
        for ($i = 0; $i < $indexesLen; $i++) {
            if ($indexes[$i]['owner_uid'] == $indexUID) {
                $indexCount++;
            }
        }
        global $account;
        $indexNumberLimit = $account['index_number_limit'];
        $limitLabel = _MD_XOONIPS_INDEX_NUMBER_OF_PRIVATE_INDEX_LABEL;
    } else {
        if ($openLevel == OL_GROUP_ONLY) {
            $xgroup_handler =& xoonips_gethandler('xoonips', 'group');
            $indexGID = $index['owner_gid'];
            $xg_obj =& $xgroup_handler->getGroupObject($indexGID);
            if (!is_object($xg_obj)) {
                redirect_header(XOOPS_URL . '/', 3, _MD_XOONIPS_ERROR_GROUP_SELECT);
                exit;
            }
            $indexCount = 0;
            for ($i = 0; $i < $indexesLen; $i++) {
                if ($indexes[$i]['owner_gid'] == $indexGID) {
                    $indexCount++;
                }
            }
            $indexNumberLimit = $xg_obj->get('group_index_number_limit');
            $limitLabel = _MD_XOONIPS_INDEX_NUMBER_OF_GROUP_INDEX_LABEL;
        } else {
            return array(false, false, false);
        }
    }
    return array($limitLabel, $indexCount, $indexNumberLimit);
}