echo FileList();
     echo '<input type="hidden" name="tblfrage" value="0">';
     echo '</div></form>';
     break;
 case 'files':
     $sysfedit = isset($_POST['sysfedit']) ? 1 : 0;
     $sysfedit = isset($_GET['sysfedit']) ? $_GET['sysfedit'] : $sysfedit;
     echo headline($lang['L_FILE_MANAGE']);
     echo $msg > '' ? $msg . '<br>' : '';
     echo $autodel;
     echo '<form name="fm" id="fm" method="post" action="' . $href . '">';
     echo '<input class="Formbutton" name="delete" type="submit" value="' . $lang['L_FM_DELETE'] . '"	onclick="if (!confirm(\'' . $lang['L_FM_ASKDELETE1'] . '\\n\' + GetSelectedFilename() + \'\\n\\n' . $lang['L_FM_ASKDELETE2'] . '\')) return false;">';
     echo '<input class="Formbutton" name="deleteauto" type="submit" value="' . $lang['L_FM_DELETEAUTO'] . '"	onclick="if (!confirm(\'' . $lang['L_FM_ASKDELETE3'] . '\')) return false;">';
     echo '<input class="Formbutton" name="deleteall" type="submit" value="' . $lang['L_FM_DELETEALL'] . '"	onclick="if (!confirm(\'' . $lang['L_FM_ASKDELETE4'] . '\')) return false;">';
     echo '<input class="Formbutton" name="deleteallfilter" type="submit" value="' . $lang['L_FM_DELETEALLFILTER'] . $databases['db_actual'] . $lang['L_FM_DELETEALLFILTER2'] . '"	onclick="if (!confirm(\'' . $lang['L_FM_ASKDELETE5'] . $databases['db_actual'] . $lang['L_FM_ASKDELETE5_2'] . '\')) return false;">';
     echo FileList() . '</form>';
     echo '<h6>' . $lang['L_FM_FILEUPLOAD'] . '</h6>';
     echo '<div align="left"><form action="' . $href . '" method="POST" enctype="multipart/form-data">';
     echo '<input type="file" name="upfile" class="Formtext" size="60">';
     echo '<input type="submit" name="upload" value="' . $lang['L_FM_FILEUPLOAD'] . '" class="Formbutton">';
     echo '<br>' . $lang['L_MAX_UPLOAD_SIZE'] . ': <strong>' . $config['upload_max_filesize'] . '</strong>';
     echo '<br>' . $lang['L_MAX_UPLOAD_SIZE_INFO'];
     echo '</form></div>';
     echo '<h6>Tools</h6><div align="left">';
     echo '<input type="Button" onclick="document.location=\'filemanagement.php?action=convert\'" class="Formbutton" value="' . $lang['L_CONVERTER'] . '">';
     echo '</div>';
     break;
 case "convert":
     // Konverter
     echo headline($lang['L_CONVERTER']);
     echo '<br><br><form action="filemanagement.php?action=convert" method="post">';
    /**
    * @brief Output(): 
    * Requires:\n
           filter: optional filter to apply\n
           item1:  uploadtree_pk of the column 1 tree\n
           item2:  uploadtree_pk of the column 2 tree\n
           freeze: column number (1 or 2) to freeze
    */
    function Output()
    {
        if ($this->State != PLUGIN_STATE_READY) {
            return 0;
        }
        $uTime = microtime(true);
        $V = "";
        /**/
        $UpdCache = GetParm("updcache", PARM_INTEGER);
        /* Remove "updcache" from the GET args and set $this->UpdCache
         * This way all the url's based on the input args won't be
         * polluted with updcache
         * Use Traceback_parm_keep to ensure that all parameters are in order
         */
        $CacheKey = "?mod=" . $this->Name . Traceback_parm_keep(array("item1", "item2", "filter", "col", "freeze", "itemf"));
        if ($UpdCache) {
            $UpdCache = $_GET['updcache'];
            $_SERVER['REQUEST_URI'] = preg_replace("/&updcache=[0-9]*/", "", $_SERVER['REQUEST_URI']);
            unset($_GET['updcache']);
            $V = ReportCachePurgeByKey($CacheKey);
        } else {
            $V = ReportCacheGet($CacheKey);
        }
        /**/
        if (empty($V)) {
            $filter = GetParm("filter", PARM_STRING);
            if (empty($filter)) {
                $filter = "none";
            }
            $FreezeCol = GetParm("freeze", PARM_INTEGER);
            // which column to freeze?  1 or 2 or null
            $ClickedCol = GetParm("col", PARM_INTEGER);
            // which column was clicked on?  1 or 2 or null
            $ItemFrozen = GetParm("itemf", PARM_INTEGER);
            // frozen item or null
            $in_uploadtree_pk1 = GetParm("item1", PARM_INTEGER);
            $in_uploadtree_pk2 = GetParm("item2", PARM_INTEGER);
            if (empty($in_uploadtree_pk1) || empty($in_uploadtree_pk2)) {
                Fatal("Bad input parameters.  Both item1 and item2 must be specified.", __FILE__, __LINE__);
            }
            /* If you click on a item in a frozen column, then you are a dope so ignore $ItemFrozen */
            if ($FreezeCol == $ClickedCol) {
                $ItemFrozen = 0;
                $FreezeCol = 0;
            }
            /* Check item1 upload permission */
            $Item1Row = GetSingleRec("uploadtree", "WHERE uploadtree_pk = {$in_uploadtree_pk1}");
            $UploadPerm = GetUploadPerm($Item1Row['upload_fk']);
            if ($UploadPerm < PERM_READ) {
                $text = _("Permission Denied");
                echo "<h2>{$text} item 1<h2>";
                return;
            }
            /* Check item2 upload permission */
            $Item2Row = GetSingleRec("uploadtree", "WHERE uploadtree_pk = {$in_uploadtree_pk2}");
            $UploadPerm = GetUploadPerm($Item2Row['upload_fk']);
            if ($UploadPerm < PERM_READ) {
                $text = _("Permission Denied");
                echo "<h2>{$text} item 2<h2>";
                return;
            }
            $uploadtree_pk1 = $in_uploadtree_pk1;
            $uploadtree_pk2 = $in_uploadtree_pk2;
            if ($FreezeCol == 1) {
                $uploadtree_pk1 = $ItemFrozen;
            } else {
                if ($FreezeCol == 2) {
                    $uploadtree_pk2 = $ItemFrozen;
                }
            }
            $newURL = Traceback_dir() . "?mod=" . $this->Name . "&item1={$uploadtree_pk1}&item2={$uploadtree_pk2}";
            if (!empty($filter)) {
                $newURL .= "&filter={$filter}";
            }
            // rewrite page with new uploadtree_pks */
            if ($uploadtree_pk1 != $in_uploadtree_pk1 || $uploadtree_pk2 != $in_uploadtree_pk2) {
                print <<<JSOUT
<script type="text/javascript">
  window.location.assign('{$newURL}');
</script>
JSOUT;
            }
            $TreeInfo1 = $this->GetTreeInfo($uploadtree_pk1);
            $TreeInfo2 = $this->GetTreeInfo($uploadtree_pk2);
            $ErrText = _("No license data for tree %d.  Use Jobs > Agents to schedule a license scan.");
            $ErrMsg = '';
            if ($TreeInfo1['agent_pk'] == 0) {
                $ErrMsg = sprintf($ErrText, 1);
            } else {
                if ($TreeInfo2['agent_pk'] == 0) {
                    $ErrMsg = sprintf($ErrText, 2);
                } else {
                    $BucketDefArray = initBucketDefArray($TreeInfo1['bucketpool_pk']);
                    /* Get list of children */
                    $Children1 = GetNonArtifactChildren($uploadtree_pk1);
                    $Children2 = GetNonArtifactChildren($uploadtree_pk2);
                    /* Add fuzzyname to children */
                    FuzzyName($Children1);
                    // add fuzzyname to children
                    FuzzyName($Children2);
                    // add fuzzyname to children
                    /* add element licstr to children */
                    $this->AddBucketStr($TreeInfo1, $Children1, $BucketDefArray);
                    $this->AddBucketStr($TreeInfo2, $Children2, $BucketDefArray);
                    /* Master array of children, aligned.   */
                    $Master = MakeMaster($Children1, $Children2);
                    /* add linkurl to children */
                    FileList($Master, $TreeInfo1['agent_pk'], $TreeInfo2['agent_pk'], $filter, $this, $uploadtree_pk1, $uploadtree_pk2);
                    /* Apply filter */
                    $this->FilterChildren($filter, $Master, $BucketDefArray);
                }
            }
            switch ($this->OutputType) {
                case "XML":
                    break;
                case "HTML":
                    if ($ErrMsg) {
                        $V .= $ErrMsg;
                    } else {
                        $V .= $this->HTMLout($Master, $uploadtree_pk1, $uploadtree_pk2, $in_uploadtree_pk1, $in_uploadtree_pk2, $filter, $TreeInfo1, $TreeInfo2, $BucketDefArray);
                    }
                    break;
                case "Text":
                    break;
                default:
            }
            $Cached = false;
        } else {
            $Cached = true;
        }
        if (!$this->OutputToStdout) {
            return $V;
        }
        print "{$V}";
        $Time = microtime(true) - $uTime;
        // convert usecs to secs
        $text = _("Elapsed time: %.2f seconds");
        printf("<small>{$text}</small>", $Time);
        /**/
        if ($Cached) {
            $text = _("cached");
            $text1 = _("Update");
            echo " <i>{$text}</i>   <a href=\"{$_SERVER['REQUEST_URI']}&updcache=1\"> {$text1} </a>";
        } else {
            //  Cache Report if this took longer than 1/2 second
            if ($Time > 0.5) {
                ReportCachePut($CacheKey, $V);
            }
        }
        /**/
        return;
    }
Exemple #3
0
?>

<h2><?= $fillbl ?> <?= $lstlbl ?></h2>

<table class="full fixed">
<tr><td class="helper">

<?php FileList('log',"web"); ?>
<br><p>
<?php FileList('map',"web"); ?>
<br><p>
<? FileList($tftpboot,"tftp"); ?>

</td><td class="helper">

<?php FileList('topo',"web"); ?>

</td></tr>
</table>
<?php

function FileList($dir,$opt=""){
	
	global $row,$modgroup,$self,$stco,$namlbl,$fillbl,$totlbl,$sizlbl,$updlbl,$cmdlbl;
?>
<h3>
<?= ($opt == "tftp")?"<a href=\"?tft=my.txt\"><img src=\"img/16/add.png\" title=\"$stco[10]\"></a>":''; ?>
<?= $dir ?></h3>

<table class="content">
<tr class="<?= $modgroup[$self] ?>1">
     echo FileList();
     echo '</div></form>' . br();
     break;
 case "files":
     $sysfedit = isset($_POST['sysfedit']) ? 1 : 0;
     $sysfedit = isset($_GET['sysfedit']) ? $_GET['sysfedit'] : $sysfedit;
     echo headline($lang['file_manage']);
     echo isset($msg) && $msg != "" ? $msg . '<br>' : '';
     echo $autodel;
     echo '' . br();
     echo br(3) . '<form name="fm" id="fm" method="post" action="' . $href . '">' . br();
     echo br() . '<input class="Formbutton" name="delete" type="submit" value="' . $lang['fm_delete'] . '"	onclick="if (!confirm(\'' . $lang['fm_askdelete1'] . '`\' + GetSelectedFilename() + \'`' . $lang['fm_askdelete2'] . '\')) return false;">' . br();
     echo br() . '<input class="Formbutton" name="deleteauto" type="submit" value="' . $lang['fm_deleteauto'] . '"	onclick="if (!confirm(\'' . $lang['fm_askdelete3'] . '\')) return false;">' . br();
     echo br() . '<input class="Formbutton" name="deleteall" type="submit" value="' . $lang['fm_deleteall'] . '"	onclick="if (!confirm(\'' . $lang['fm_askdelete4'] . '\')) return false;">' . br();
     echo br() . '<input class="Formbutton" name="deleteallfilter" type="submit" value="' . $lang['fm_deleteallfilter'] . $databases['db_actual'] . $lang['fm_deleteallfilter2'] . '"	onclick="if (!confirm(\'' . $lang['fm_askdelete5'] . $databases['db_actual'] . $lang['fm_askdelete5_2'] . '\')) return false;">' . br();
     echo FileList() . '</form>' . br();
     echo '<h6>' . $lang['fm_fileupload'] . '</h6>' . br();
     echo '<div align="left"><form action="' . $href . '" method="POST" enctype="multipart/form-data">' . br();
     echo '<input type="file" name="upfile" class="Formbutton" size="60">' . br();
     echo '<input type="submit" name="upload" value="' . $lang['fm_fileupload'] . '" class="Formbutton">' . br();
     echo '<br>' . $lang['max_upload_size'] . ': <strong>' . $config['upload_max_filesize'] . '</strong>';
     echo '<br>' . $lang['max_upload_size_info'];
     echo '</form></div>' . br();
     echo '<h6>Tools</h6><div align="left">';
     echo '<input type="Button" onclick="document.location=\'filemanagement.php?action=convert\'" class="Formbutton" value="' . $lang['converter'] . '">';
     echo '</div>';
     break;
 case "convert":
     // Konverter
     echo headline($lang['converter']);
     echo '<br><br><form action="filemanagement.php?action=convert" method="post">';
    public function htmlContent()
    {
        $filter = GetParm("filter", PARM_STRING);
        if (empty($filter)) {
            $filter = "none";
        }
        $FreezeCol = GetParm("freeze", PARM_INTEGER);
        // which column to freeze?  1 or 2 or null
        $ClickedCol = GetParm("col", PARM_INTEGER);
        // which column was clicked on?  1 or 2 or null
        $ItemFrozen = GetParm("itemf", PARM_INTEGER);
        // frozen item or null
        $in_uploadtree_pk1 = GetParm("item1", PARM_INTEGER);
        $in_uploadtree_pk2 = GetParm("item2", PARM_INTEGER);
        if (empty($in_uploadtree_pk1) || empty($in_uploadtree_pk2)) {
            Fatal("Bad input parameters.  Both item1 and item2 must be specified.", __FILE__, __LINE__);
        }
        /* If you click on a item in a frozen column, then you are a dope so ignore $ItemFrozen */
        if ($FreezeCol == $ClickedCol) {
            $ItemFrozen = 0;
            $FreezeCol = 0;
        }
        /* @var $uploadDao UploadDao */
        $uploadDao = $GLOBALS['container']->get('dao.upload');
        /* Check item1 upload permission */
        $Item1Row = $uploadDao->getUploadEntry($in_uploadtree_pk1);
        if (!$uploadDao->isAccessible($Item1Row['upload_fk'], Auth::getGroupId())) {
            $text = _("Permission Denied");
            return "<h2>{$text} item 1</h2>";
        }
        /* Check item2 upload permission */
        $Item2Row = $uploadDao->getUploadEntry($in_uploadtree_pk2);
        if (!$uploadDao->isAccessible($Item2Row['upload_fk'], Auth::getGroupId())) {
            $text = _("Permission Denied");
            return "<h2>{$text} item 2</h2>";
        }
        $uploadtree_pk1 = $in_uploadtree_pk1;
        $uploadtree_pk2 = $in_uploadtree_pk2;
        if ($FreezeCol == 1) {
            $uploadtree_pk1 = $ItemFrozen;
        } else {
            if ($FreezeCol == 2) {
                $uploadtree_pk2 = $ItemFrozen;
            }
        }
        $newURL = Traceback_dir() . "?mod=" . $this->Name . "&item1={$uploadtree_pk1}&item2={$uploadtree_pk2}";
        if (!empty($filter)) {
            $newURL .= "&filter={$filter}";
        }
        // rewrite page with new uploadtree_pks */
        if ($uploadtree_pk1 != $in_uploadtree_pk1 || $uploadtree_pk2 != $in_uploadtree_pk2) {
            print <<<JSOUT
<script type="text/javascript">
  window.location.assign('{$newURL}');
</script>
JSOUT;
        }
        $TreeInfo1 = $this->GetTreeInfo($uploadtree_pk1);
        $TreeInfo2 = $this->GetTreeInfo($uploadtree_pk2);
        $ErrText = _("No license data for tree %d.  Use Jobs > Agents to schedule a license scan.");
        $ErrMsg = '';
        if ($TreeInfo1['agent_pk'] == 0) {
            $ErrMsg = sprintf($ErrText, 1);
        } else {
            if ($TreeInfo2['agent_pk'] == 0) {
                $ErrMsg = sprintf($ErrText, 2);
            } else {
                $BucketDefArray1 = initBucketDefArray($TreeInfo1['bucketpool_pk']);
                $BucketDefArray2 = initBucketDefArray($TreeInfo2['bucketpool_pk']);
                $BucketDefArray = $BucketDefArray1 + $BucketDefArray2;
                /* Get list of children */
                $Children1 = GetNonArtifactChildren($uploadtree_pk1);
                $Children2 = GetNonArtifactChildren($uploadtree_pk2);
                /* Add fuzzyname to children */
                FuzzyName($Children1);
                // add fuzzyname to children
                FuzzyName($Children2);
                // add fuzzyname to children
                /* add element licstr to children */
                $this->AddBucketStr($TreeInfo1, $Children1, $BucketDefArray);
                $this->AddBucketStr($TreeInfo2, $Children2, $BucketDefArray);
                /* Master array of children, aligned.   */
                $Master = MakeMaster($Children1, $Children2);
                /* add linkurl to children */
                FileList($Master, $TreeInfo1['agent_pk'], $TreeInfo2['agent_pk'], $filter, $this, $uploadtree_pk1, $uploadtree_pk2);
                /* Apply filter */
                $this->FilterChildren($filter, $Master, $BucketDefArray);
            }
        }
        if ($this->OutputType == 'HTML') {
            if ($ErrMsg) {
                $V .= $ErrMsg;
            } else {
                $V .= $this->HTMLout($Master, $uploadtree_pk1, $uploadtree_pk2, $in_uploadtree_pk1, $in_uploadtree_pk2, $filter, $TreeInfo1, $TreeInfo2, $BucketDefArray);
            }
        }
        return $V;
    }