예제 #1
0
 function getAgentPksFromRequest($upload_pk)
 {
     $agents = array("monk", "nomos", "ninka");
     $agent_pks = array();
     foreach ($agents as $agent) {
         if (GetParm("agentToInclude_" . $agent, PARM_STRING)) {
             /* get last nomos agent_pk that has data for this upload */
             $AgentRec = AgentARSList($agent . "_ars", $upload_pk, 1);
             if ($AgentRec !== false) {
                 $agent_pks[$agent] = $AgentRec[0]["agent_fk"];
             } else {
                 $agent_pks[$agent] = false;
             }
         }
     }
     return $agent_pks;
 }
예제 #2
0
 /**
  * \brief Display the package info associated with
  * the rpm/debian package.
  */
 function ShowPackageInfo($Upload, $Item, $ShowMenu = 0)
 {
     global $PG_CONN;
     $V = "";
     $Require = "";
     $MIMETYPE = "";
     $Count = 0;
     $rpm_info = array("Package" => "pkg_name", "Alias" => "pkg_alias", "Architecture" => "pkg_arch", "Version" => "version", "License" => "license", "Group" => "pkg_group", "Packager" => "packager", "Release" => "release", "BuildDate" => "build_date", "Vendor" => "vendor", "URL" => "url", "Summary" => "summary", "Description" => "description", "Source" => "source_rpm");
     $deb_binary_info = array("Package" => "pkg_name", "Architecture" => "pkg_arch", "Version" => "version", "Section" => "section", "Priority" => "priority", "Installed Size" => "installed_size", "Maintainer" => "maintainer", "Homepage" => "homepage", "Source" => "source", "Summary" => "summary", "Description" => "description");
     $deb_source_info = array("Format" => "format", "Source" => "source", "Binary" => "pkg_name", "Architecture" => "pkg_arch", "Version" => "version", "Maintainer" => "maintainer", "Uploaders" => "uploaders", "Standards-Version" => "standards_version");
     if (empty($Item) || empty($Upload)) {
         return;
     }
     /**********************************
        Check if pkgagent disabled
        ***********************************/
     $sql = "SELECT agent_enabled FROM agent WHERE agent_name ='pkgagent' order by agent_ts LIMIT 1;";
     $result = pg_query($PG_CONN, $sql);
     DBCheckResult($result, $sql, __FILE__, __LINE__);
     $row = pg_fetch_assoc($result);
     pg_free_result($result);
     if (isset($row) && $row['agent_enabled'] == 'f') {
         return;
     }
     /**********************************
        Display package info
        **********************************/
     $text = _("Package Info");
     $V .= "<H2>{$text}</H2>\n";
     /* If pkgagent_ars table didn't exists, don't show the result. */
     $sql = "SELECT typlen  FROM pg_type where typname='pkgagent_ars' limit 1;";
     $result = pg_query($PG_CONN, $sql);
     DBCheckResult($result, $sql, __FILE__, __LINE__);
     $numrows = pg_num_rows($result);
     pg_free_result($result);
     if ($numrows <= 0) {
         $V .= _("No data available. Use Jobs > Agents to schedule a pkgagent scan.");
         return $V;
     }
     /* If pkgagent_ars table didn't have record for this upload, don't show the result. */
     $agent_status = AgentARSList('pkgagent_ars', $Upload);
     if (empty($agent_status)) {
         /** schedule pkgagent */
         $V .= ActiveHTTPscript("Schedule");
         $V .= "<script language='javascript'>\n";
         $V .= "function Schedule_Reply()\n";
         $V .= "  {\n";
         $V .= "  if ((Schedule.readyState==4) && (Schedule.status==200))\n";
         $V .= "    document.getElementById('msgdiv').innerHTML = Schedule.responseText;\n";
         $V .= "  }\n";
         $V .= "</script>\n";
         $V .= "<form name='formy' method='post'>\n";
         $V .= "<div id='msgdiv'>\n";
         $V .= _("No data available.");
         $V .= "<input type='button' name='scheduleAgent' value='Schedule Agent'";
         $V .= "onClick='Schedule_Get(\"" . Traceback_uri() . "?mod=schedule_agent&upload={$Upload}&agent=agent_pkgagent \")'>\n";
         $V .= "</input>";
         $V .= "</div> \n";
         $V .= "</form>\n";
         return $V;
     }
     $sql = "SELECT mimetype_name\n        FROM uploadtree\n        INNER JOIN pfile ON uploadtree_pk = {$Item}\n        AND pfile_fk = pfile_pk\n        INNER JOIN mimetype ON pfile_mimetypefk = mimetype_pk;";
     $result = pg_query($PG_CONN, $sql);
     DBCheckResult($result, $sql, __FILE__, __LINE__);
     while ($row = pg_fetch_assoc($result)) {
         if (!empty($row['mimetype_name'])) {
             $MIMETYPE = $row['mimetype_name'];
         }
     }
     pg_free_result($result);
     /** RPM Package Info **/
     if ($MIMETYPE == "application/x-rpm") {
         $sql = "SELECT *\n                FROM pkg_rpm\n                INNER JOIN uploadtree ON uploadtree_pk = {$Item}\n                AND uploadtree.pfile_fk = pkg_rpm.pfile_fk;";
         $result = pg_query($PG_CONN, $sql);
         DBCheckResult($result, $sql, __FILE__, __LINE__);
         $R = pg_fetch_assoc($result);
         if (!empty($R['source_rpm']) and trim($R['source_rpm']) != "(none)") {
             $V .= _("RPM Binary Package");
         } else {
             $V .= _("RPM Source Package");
         }
         $Count = 1;
         $V .= "<table border='1' name='pkginfo'>\n";
         $text = _("Item");
         $text1 = _("Type");
         $text2 = _("Value");
         $V .= "<tr><th width='5%'>{$text}</th><th width='20%'>{$text1}</th><th>{$text2}</th></tr>\n";
         if (!empty($R['pkg_pk'])) {
             $Require = $R['pkg_pk'];
             foreach ($rpm_info as $key => $value) {
                 $text = _($key);
                 $V .= "<tr><td align='right'>{$Count}</td><td>{$text}";
                 $V .= "</td><td>" . htmlentities($R["{$value}"]) . "</td></tr>\n";
                 $Count++;
             }
             pg_free_result($result);
             $sql = "SELECT * FROM pkg_rpm_req WHERE pkg_fk = {$Require};";
             $result = pg_query($PG_CONN, $sql);
             DBCheckResult($result, $sql, __FILE__, __LINE__);
             while ($R = pg_fetch_assoc($result) and !empty($R['req_pk'])) {
                 $text = _("Requires");
                 $V .= "<tr><td align='right'>{$Count}</td><td>{$text}";
                 $Val = htmlentities($R['req_value']);
                 $Val = preg_replace("@((http|https|ftp)://[^{}<>&[:space:]]*)@i", "<a href='\$1'>\$1</a>", $Val);
                 $V .= "</td><td>{$Val}</td></tr>\n";
                 $Count++;
             }
             pg_free_result($result);
         }
         $V .= "</table>\n";
         $Count--;
     } else {
         if ($MIMETYPE == "application/x-debian-package") {
             $V .= _("Debian Binary Package\n");
             $sql = "SELECT *\n                FROM pkg_deb\n                INNER JOIN uploadtree ON uploadtree_pk = {$Item}\n                AND uploadtree.pfile_fk = pkg_deb.pfile_fk;";
             $result = pg_query($PG_CONN, $sql);
             DBCheckResult($result, $sql, __FILE__, __LINE__);
             $Count = 1;
             $V .= "<table border='1'>\n";
             $text = _("Item");
             $text1 = _("Type");
             $text2 = _("Value");
             $V .= "<tr><th width='5%'>{$text}</th><th width='20%'>{$text1}</th><th>{$text2}</th></tr>\n";
             if (pg_num_rows($result)) {
                 $R = pg_fetch_assoc($result);
                 $Require = $R['pkg_pk'];
                 foreach ($deb_binary_info as $key => $value) {
                     $text = _($key);
                     $V .= "<tr><td align='right'>{$Count}</td><td>{$text}";
                     $V .= "</td><td>" . htmlentities($R["{$value}"]) . "</td></tr>\n";
                     $Count++;
                 }
                 pg_free_result($result);
                 $sql = "SELECT * FROM pkg_deb_req WHERE pkg_fk = {$Require};";
                 $result = pg_query($PG_CONN, $sql);
                 DBCheckResult($result, $sql, __FILE__, __LINE__);
                 while ($R = pg_fetch_assoc($result) and !empty($R['req_pk'])) {
                     $text = _("Depends");
                     $V .= "<tr><td align='right'>{$Count}</td><td>{$text}";
                     $Val = htmlentities($R['req_value']);
                     $Val = preg_replace("@((http|https|ftp)://[^{}<>&[:space:]]*)@i", "<a href='\$1'>\$1</a>", $Val);
                     $V .= "</td><td>{$Val}</td></tr>\n";
                     $Count++;
                 }
                 pg_free_result($result);
             }
             $V .= "</table>\n";
             $Count--;
         } else {
             if ($MIMETYPE == "application/x-debian-source") {
                 $V .= _("Debian Source Package\n");
                 $sql = "SELECT *\n                FROM pkg_deb\n                INNER JOIN uploadtree ON uploadtree_pk = {$Item}\n                AND uploadtree.pfile_fk = pkg_deb.pfile_fk;";
                 $result = pg_query($PG_CONN, $sql);
                 DBCheckResult($result, $sql, __FILE__, __LINE__);
                 $Count = 1;
                 $V .= "<table border='1'>\n";
                 $text = _("Item");
                 $text1 = _("Type");
                 $text2 = _("Value");
                 $V .= "<tr><th width='5%'>{$text}</th><th width='20%'>{$text1}</th><th>{$text2}</th></tr>\n";
                 if (pg_num_rows($result)) {
                     $R = pg_fetch_assoc($result);
                     $Require = $R['pkg_pk'];
                     foreach ($deb_source_info as $key => $value) {
                         $text = _($key);
                         $V .= "<tr><td align='right'>{$Count}</td><td>{$text}";
                         $V .= "</td><td>" . htmlentities($R["{$value}"]) . "</td></tr>\n";
                         $Count++;
                     }
                     pg_free_result($result);
                     $sql = "SELECT * FROM pkg_deb_req WHERE pkg_fk = {$Require};";
                     $result = pg_query($PG_CONN, $sql);
                     DBCheckResult($result, $sql, __FILE__, __LINE__);
                     while ($R = pg_fetch_assoc($result) and !empty($R['req_pk'])) {
                         $text = _("Build-Depends");
                         $V .= "<tr><td align='right'>{$Count}</td><td>{$text}";
                         $Val = htmlentities($R['req_value']);
                         $Val = preg_replace("@((http|https|ftp)://[^{}<>&[:space:]]*)@i", "<a href='\$1'>\$1</a>", $Val);
                         $V .= "</td><td>{$Val}</td></tr>\n";
                         $Count++;
                     }
                     pg_free_result($result);
                 }
                 $V .= "</table>\n";
                 $Count--;
             } else {
                 /* Not a package */
                 return "";
             }
         }
     }
     return $V;
 }
예제 #3
0
/**
 * @brief get monk license list of one specified uploadtree_id
 *
 * @param int $uploadtree_pk - uploadtree id
 * @param int $upload_pk - upload id
 * @param int $showContainer - include container or not, 1: yes, 0: no 
 * @param string $excluding
 * @param bool $ignore ignore files without license
 */
function GetLicenseList($uploadtree_pk, $upload_pk, $showContainer, $excluding, $ignore)
{
    /* @var $dbManager DbManager */
    $dbManager = $GLOBALS['container']->get('db.manager');
    /* @var $uploadDao UploadDao */
    $uploadDao = $GLOBALS['container']->get("dao.upload");
    /* @var $licenseDao LicenseDao */
    $licenseDao = $GLOBALS['container']->get("dao.license");
    if (empty($uploadtree_pk)) {
        $uploadtreeRec = $dbManager->getSingleRow('SELECT uploadtree_pk FROM uploadtree WHERE parent IS NULL AND upload_fk=$1', array($upload_pk), __METHOD__ . '.find.uploadtree.to.use.in.browse.link');
        $uploadtree_pk = $uploadtreeRec['uploadtree_pk'];
    }
    /* get last monk agent_pk that has data for this upload */
    $AgentRec = AgentARSList("monk_ars", $upload_pk, 1);
    if ($AgentRec === false) {
        echo _("No data available \n");
        return;
    }
    $agent_pk = $AgentRec[0]["agent_fk"];
    $uploadtreeTablename = GetUploadtreeTableName($upload_pk);
    /** @var ItemTreeBounds */
    $itemTreeBounds = $uploadDao->getItemTreeBounds($uploadtree_pk, $uploadtreeTablename);
    $licensesPerFileName = $licenseDao->getLicensesPerFileNameForAgentId($itemTreeBounds, array($agent_pk), true, array(), $excluding, $ignore);
    foreach ($licensesPerFileName as $fileName => $licenseNames) {
        if (!$ignore || $licenseNames !== false && $licenseNames !== array()) {
            if ($licenseNames !== false) {
                print $fileName . ': ' . implode($licenseNames, ', ') . "\n";
            } else {
                if ($showContainer) {
                    print $filename . "\n";
                }
            }
        }
    }
}
/**
 * \brief get nomos license list of one specified uploadtree_id
 *
 * \param $uploadtree_pk - uploadtree id
 * \param $upload_pk - upload id
 * \param $container - include container or not, 1: yes, 0: no (default)
 */
function GetLicenseList($uploadtree_pk, $upload_pk, $container = 0)
{
    global $PG_CONN;
    if (empty($uploadtree_pk)) {
        /* Find the uploadtree_pk for this upload so that it can be used in the browse link */
        $uploadtreeRec = GetSingleRec("uploadtree", "where parent is NULL and upload_fk='{$upload_pk}'");
        $uploadtree_pk = $uploadtreeRec['uploadtree_pk'];
    }
    //  print "Upload ID:$upload_pk; Uploadtree ID:$uploadtree_pk\n";
    /* get last nomos agent_pk that has data for this upload */
    $Agent_name = "nomos";
    $AgentRec = AgentARSList("nomos_ars", $upload_pk, 1);
    $agent_pk = $AgentRec[0]["agent_fk"];
    if ($AgentRec === false) {
        echo _("No data available");
        return;
    }
    /* get the top of tree */
    $sql = "SELECT upload_fk, lft, rgt from uploadtree where uploadtree_pk='{$uploadtree_pk}';";
    $result = pg_query($PG_CONN, $sql);
    DBCheckResult($result, $sql, __FILE__, __LINE__);
    $toprow = pg_fetch_assoc($result);
    pg_free_result($result);
    $uploadtree_tablename = GetUploadtreeTableName($toprow['upload_fk']);
    /* loop through all the records in this tree */
    $sql = "select uploadtree_pk, ufile_name, lft, rgt from {$uploadtree_tablename} \n              where upload_fk='{$toprow['upload_fk']}' \n                    and lft>'{$toprow['lft']}'  and rgt<'{$toprow['rgt']}'\n                    and ((ufile_mode & (1<<28)) = 0)";
    $container_sql = " and ((ufile_mode & (1<<29)) = 0)";
    /* include container or not */
    if (empty($container)) {
        $sql .= $container_sql;
        // do not include container
    }
    $sql .= "order by uploadtree_pk";
    $outerresult = pg_query($PG_CONN, $sql);
    DBCheckResult($outerresult, $sql, __FILE__, __LINE__);
    /* Select each uploadtree row in this tree, write out text:
     * filepath : license list
     * e.g. Pound-2.4.tgz/Pound-2.4/svc.c: GPL_v3+, Indemnity
     */
    while ($row = pg_fetch_assoc($outerresult)) {
        $filepatharray = Dir2Path($row['uploadtree_pk'], $uploadtree_tablename);
        $filepath = "";
        foreach ($filepatharray as $uploadtreeRow) {
            if (!empty($filepath)) {
                $filepath .= "/";
            }
            $filepath .= $uploadtreeRow['ufile_name'];
        }
        $V = $filepath . ": " . GetFileLicenses_string($agent_pk, 0, $row['uploadtree_pk'], $uploadtree_tablename);
        #$V = $filepath;
        print "{$V}";
        print "\n";
    }
    pg_free_result($outerresult);
}
예제 #5
0
 /**
  * \brief This function returns the scheduler status.
  */
 function Output()
 {
     global $SysConf;
     global $PG_CONN;
     if (!$PG_CONN) {
         echo _("NO DB connection");
     }
     if ($this->State != PLUGIN_STATE_READY) {
         return 0;
     }
     $V = "";
     $uploadtree_pk = GetParm("item", PARM_INTEGER);
     if (empty($uploadtree_pk)) {
         return;
     }
     $upload_pk = GetParm("upload", PARM_INTEGER);
     if (empty($upload_pk)) {
         return;
     }
     if (!$this->uploadDao->isAccessible($upload_pk, Auth::getGroupId())) {
         $text = _("Permission Denied");
         return "<h2>{$text}</h2>";
     }
     $dltext = GetParm("output", PARM_STRING) == 'dltext';
     /* get last nomos agent_pk that has data for this upload */
     $AgentRec = AgentARSList("nomos_ars", $upload_pk, 1);
     $agent_pk = $AgentRec[0]["agent_fk"];
     if ($AgentRec === false) {
         return _("No data available");
     }
     /* how many lines of data do you want to display */
     $NomostListNum = @$SysConf['SYSCONFIG']['NomostListNum'];
     /* get the top of tree */
     $toprow = $this->uploadDao->getUploadEntry($uploadtree_pk);
     /* loop through all the records in this tree */
     $sql = "select uploadtree_pk, ufile_name, lft, rgt from uploadtree\n              where upload_fk='{$toprow['upload_fk']}' \n                    and lft>'{$toprow['lft']}'  and rgt<'{$toprow['rgt']}'\n                    and (ufile_mode & (3<<28)) = 0 limit {$NomostListNum}";
     $outerresult = pg_query($PG_CONN, $sql);
     DBCheckResult($outerresult, $sql, __FILE__, __LINE__);
     /* Select each uploadtree row in this tree, write out text:
      * filepath : license list
      * e.g. Pound-2.4.tgz/Pound-2.4/svc.c: GPL_v3+, Indemnity
      */
     $uploadtreeTablename = $this->uploadDao->getUploadtreeTableName($toprow['upload_fk']);
     $lines = array();
     while ($row = pg_fetch_assoc($outerresult)) {
         $filepatharray = Dir2Path($row['uploadtree_pk'], $uploadtreeTablename);
         $filepath = "";
         foreach ($filepatharray as $uploadtreeRow) {
             if (!empty($filepath)) {
                 $filepath .= "/";
             }
             $filepath .= $uploadtreeRow['ufile_name'];
         }
         $lines[] = $filepath . ": " . GetFileLicenses_string($agent_pk, 0, $row['uploadtree_pk'], $uploadtreeTablename);
     }
     $RealNumber = pg_num_rows($outerresult);
     pg_free_result($outerresult);
     if ($RealNumber == $NomostListNum) {
         $V .= _("<br><b>Warning: Only the last {$NomostListNum} lines are displayed.  To see the whole list, run fo_nomos_license_list from the command line.</b><br>");
     }
     if ($dltext) {
         $request = $this->getRequest();
         $itemId = intval($request->get('item'));
         $path = Dir2Path($itemId, $uploadtreeTablename);
         $fileName = $path[count($path) - 1]['ufile_name'] . ".txt";
         $headers = array("Content-Type" => "text", "Content-Disposition" => "attachment; filename=\"{$fileName}\"");
         $response = new Response(implode("\n", $lines), Response::HTTP_OK, $headers);
         return $response;
     } else {
         return $V . '<pre>' . implode("\n", $lines) . '</pre>';
     }
 }
예제 #6
0
/**
 * \brief Given an upload_pk, find the latest enabled agent_pk with results.
 *
 * \param $upload_pk - upload id
 * \param $arsTableName - name of ars table to check for the requested agent
 *
 * \returns nomos agent_pk or 0 if none
 */
function LatestAgentpk($upload_pk, $arsTableName)
{
    $AgentRec = AgentARSList($arsTableName, $upload_pk, 1);
    if ($AgentRec === false) {
        $Agent_pk = 0;
    } else {
        $Agent_pk = intval($AgentRec[0]['agent_fk']);
    }
    return $Agent_pk;
}
 /**
  * \brief This function returns the scheduler status.
  */
 function Output()
 {
     global $SysConf;
     global $PG_CONN;
     if (!$PG_CONN) {
         echo _("NO DB connection");
     }
     if ($this->State != PLUGIN_STATE_READY) {
         return 0;
     }
     $V = "";
     $uploadtree_pk = GetParm("item", PARM_INTEGER);
     if (empty($uploadtree_pk)) {
         return;
     }
     $upload_pk = GetParm("upload", PARM_INTEGER);
     if (empty($upload_pk)) {
         return;
     }
     $UploadPerm = GetUploadPerm($upload_pk);
     if ($UploadPerm < PERM_READ) {
         $text = _("Permission Denied");
         echo "<h2>{$text}<h2>";
         return;
     }
     if (GetParm("output", PARM_STRING) == 'dltext') {
         $dltext = true;
     } else {
         $dltext = false;
     }
     /* get last nomos agent_pk that has data for this upload */
     $Agent_name = "nomos";
     $AgentRec = AgentARSList("nomos_ars", $upload_pk, 1);
     $agent_pk = $AgentRec[0]["agent_fk"];
     if ($AgentRec === false) {
         echo _("No data available");
         return;
     }
     /* how many lines of data do you want to display */
     $NomostListNum = @$SysConf['SYSCONFIG']['NomostListNum'];
     /* get the top of tree */
     $sql = "SELECT upload_fk, lft, rgt from uploadtree where uploadtree_pk='{$uploadtree_pk}'";
     $result = pg_query($PG_CONN, $sql);
     DBCheckResult($result, $sql, __FILE__, __LINE__);
     $toprow = pg_fetch_assoc($result);
     pg_free_result($result);
     /* loop through all the records in this tree */
     $sql = "select uploadtree_pk, ufile_name, lft, rgt from uploadtree\n              where upload_fk='{$toprow['upload_fk']}' \n                    and lft>'{$toprow['lft']}'  and rgt<'{$toprow['rgt']}'\n                    and ((ufile_mode & (1<<28)) = 0) and ((ufile_mode & (1<<29)) = 0) limit {$NomostListNum}";
     $outerresult = pg_query($PG_CONN, $sql);
     DBCheckResult($outerresult, $sql, __FILE__, __LINE__);
     /* Select each uploadtree row in this tree, write out text:
      * filepath : license list
      * e.g. Pound-2.4.tgz/Pound-2.4/svc.c: GPL_v3+, Indemnity
      */
     $uploadtree_tablename = GetUploadtreeTableName($toprow['upload_fk']);
     while ($row = pg_fetch_assoc($outerresult)) {
         $filepatharray = Dir2Path($row['uploadtree_pk'], $uploadtree_tablename);
         $filepath = "";
         foreach ($filepatharray as $uploadtreeRow) {
             if (!empty($filepath)) {
                 $filepath .= "/";
             }
             $filepath .= $uploadtreeRow['ufile_name'];
         }
         $V .= $filepath . ": " . GetFileLicenses_string($agent_pk, 0, $row['uploadtree_pk'], $uploadtree_tablename);
         if ($dltext) {
             $V .= "\n";
         } else {
             $V .= "<br>";
         }
     }
     $RealNumber = pg_num_rows($outerresult);
     pg_free_result($outerresult);
     if ($RealNumber == $NomostListNum) {
         $V .= _("<br><B>Warning: Only the last {$NomostListNum} lines are displayed.  To see the whole list, run fo_nomos_license_list from the command line.</B><br>");
     }
     if (!$this->OutputToStdout) {
         return $V;
     }
     print "{$V}";
     return;
 }
/**
 * @brief get nomos license list of one specified uploadtree_id
 *
 * @param int $uploadtree_pk - uploadtree id
 * @param int $upload_pk - upload id
 * @param int $showContainer - include container or not, 1: yes, 0: no 
 * @param string $excluding
 * @param bool $ignore ignore files without license
 */
function GetLicenseList($uploadtree_pk, $upload_pk, $showContainer, $excluding, $ignore)
{
    /* @var $dbManager DbManager */
    $dbManager = $GLOBALS['container']->get('db.manager');
    if (empty($uploadtree_pk)) {
        $uploadtreeRec = $dbManager->getSingleRow('SELECT uploadtree_pk FROM uploadtree WHERE parent IS NULL AND upload_fk=$1', array($upload_pk), __METHOD__ . '.find.uploadtree.to.use.in.browse.link');
        $uploadtree_pk = $uploadtreeRec['uploadtree_pk'];
    }
    /* get last nomos agent_pk that has data for this upload */
    $AgentRec = AgentARSList("nomos_ars", $upload_pk, 1);
    $agent_pk = $AgentRec[0]["agent_fk"];
    if ($AgentRec === false) {
        echo _("No data available \n");
        return;
    }
    $bottomItem = $dbManager->getSingleRow("SELECT upload_fk, ufile_name path, lft, rgt FROM uploadtree WHERE uploadtree_pk=\$1", array($uploadtree_pk), __METHOD__ . '.get.top.of.tree');
    $bottomItem['uploadtree_pk'] = $uploadtree_pk;
    $bottomItem['include'] = empty($excluding) || false === strpos("/{$bottomItem['path']}/", $excluding);
    $pathStack = array();
    $uploadtree_tablename = GetUploadtreeTableName($bottomItem['upload_fk']);
    $sql = "SELECT uploadtree_pk, ufile_name, lft, rgt, ufile_mode FROM {$uploadtree_tablename}\n              WHERE (lft BETWEEN \$1 AND \$2) AND (ufile_mode & (1<<28)) = 0";
    $params = array($bottomItem['lft'] + 1, $bottomItem['rgt']);
    $stmt = __METHOD__ . '.loop.through';
    if ($uploadtree_tablename == 'uploadtree_a') {
        $sql .= ' AND upload_fk=$3';
        $params[] = $bottomItem['upload_fk'];
        $stmt .= '.ut_a';
    }
    $sql .= ' ORDER BY lft';
    $dbManager->prepare($stmt, $sql);
    $res = $dbManager->execute($stmt, $params);
    while ($item = $dbManager->fetchArray($res)) {
        while ($bottomItem['rgt'] <= $item['lft']) {
            $bottomItem = array_pop($pathStack);
        }
        if (!$bottomItem['include']) {
            continue;
        }
        $item['path'] = "{$bottomItem['path']}/{$item['ufile_name']}";
        if (($item['ufile_mode'] & 1 << 29) == 0) {
            $license_name = GetFileLicenses_string($agent_pk, 0, $item['uploadtree_pk'], $uploadtree_tablename);
            if (!$ignore || !empty($license_name) && 'No_license_found' != $license_name) {
                print "{$item['path']}: {$license_name}\n";
            }
            continue;
        }
        $item['include'] = $bottomItem['include'] && (empty($excluding) || false === strpos("/{$item['ufile_name']}/", $excluding));
        if ($item['include'] && $showContainer) {
            print "{$item['path']}\n";
        }
        array_push($pathStack, $bottomItem);
        $bottomItem = $item;
    }
    $dbManager->freeResult($res);
}