/**
  * \brief Display the loaded menu and plugins.
  */
 function Output()
 {
     if ($this->State != PLUGIN_STATE_READY) {
         return;
     }
     $V = "";
     global $Plugins;
     $Time = time();
     $Max = 50;
     switch ($this->OutputType) {
         case "XML":
             break;
         case "HTML":
             $UploadTreePk = GetParm("item", PARM_INTEGER);
             $Page = GetParm("page", PARM_INTEGER);
             $WantLic = GetParm("lic", PARM_RAW);
             $WantLic = str_replace("\\'", "'", $WantLic);
             if (empty($UploadTreePk) || empty($WantLic)) {
                 return;
             }
             if (empty($Page)) {
                 $Page = 0;
             }
             $Offset = $Page * $Max;
             /* Get License Name */
             $text = _("The following files contain the license");
             $V .= "{$text} '<b>";
             $V .= htmlentities($WantLic);
             $V .= "</b>'.\n";
             /* Load licenses */
             $Lics = array();
             $Offset = $Page * $Max;
             $Lics = LicenseSearch($UploadTreePk, $WantLic, $Offset, $Max);
             /* Save the license results */
             $Count = count($Lics);
             /* Get the page menu */
             if ($Count >= $Max || $Page > 0) {
                 $VM = "<P />\n" . MenuEndlessPage($Page, intval(($Count + $Offset) / $Max)) . "<P />\n";
                 $V .= $VM;
             } else {
                 $VM = "";
             }
             /* Offset is +1 to start numbering from 1 instead of zero */
             $V .= Dir2FileList($Lics, "browse", "view-license", $Offset + 1, 1);
             if (!empty($VM)) {
                 $V .= $VM . "\n";
             }
             $V .= "<hr>\n";
             $Time = time() - $Time;
             $text = _("Elaspsed time:");
             $text1 = _("seconds");
             $V .= "<small>{$text} {$Time} {$text1}</small>\n";
             break;
         case "Text":
             break;
         default:
             break;
     }
     if (!$this->OutputToStdout) {
         return $V;
     }
     print $V;
     return;
 }
Esempio n. 2
0
 /**
  * \brief Show Sightings, List the directory locations where this pfile is found
  */
 function ShowSightings($Upload, $Item)
 {
     global $PG_CONN;
     $V = "";
     if (empty($Upload) || empty($Item)) {
         return;
     }
     $Page = GetParm("page", PARM_INTEGER);
     if (empty($Page)) {
         $Page = 0;
     }
     $Max = 50;
     $Offset = $Page * $Max;
     /**********************************
        List the directory locations where this pfile is found
        **********************************/
     $text = _("Sightings");
     $V .= "<H2>{$text}</H2>\n";
     $sql = "SELECT * FROM pfile,uploadtree\n        WHERE pfile_pk=pfile_fk\n        AND pfile_pk IN\n        (SELECT pfile_fk FROM uploadtree WHERE uploadtree_pk = {$Item})\n        LIMIT {$Max} OFFSET {$Offset}";
     $result = pg_query($PG_CONN, $sql);
     DBCheckResult($result, $sql, __FILE__, __LINE__);
     $Count = pg_num_rows($result);
     if ($Page > 0 || $Count >= $Max) {
         $VM = "<P />\n" . MenuEndlessPage($Page, $Count >= $Max) . "<P />\n";
     } else {
         $VM = "";
     }
     if ($Count > 0) {
         $V .= _("This exact file appears in the following locations:\n");
         $V .= $VM;
         $Offset++;
         $V .= Dir2FileList($result, "browse", "view", $Offset);
         $V .= $VM;
     } else {
         if ($Page > 0) {
             $V .= _("End of listing.\n");
         } else {
             $V .= _("This file does not appear in any other known location.\n");
         }
     }
     pg_free_result($result);
     return $V;
 }
Esempio n. 3
0
 /**
  * \brief Show Sightings, List the directory locations where this pfile is found
  */
 function ShowSightings($Upload, $Item)
 {
     $V = "";
     if (empty($Upload) || empty($Item)) {
         return;
     }
     $Page = GetParm("page", PARM_INTEGER);
     if (empty($Page)) {
         $Page = 0;
     }
     $Max = 50;
     $Offset = $Page * $Max;
     /**********************************
        List the directory locations where this pfile is found
        **********************************/
     $text = _("Sightings");
     $V .= "<H2>{$text}</H2>\n";
     $sql = "SELECT * FROM pfile,uploadtree\n        WHERE pfile_pk=pfile_fk\n        AND pfile_pk IN\n        (SELECT pfile_fk FROM uploadtree WHERE uploadtree_pk = \$1)\n        LIMIT \$2 OFFSET \$3";
     $this->dbManager->prepare(__METHOD__ . "getListOfFiles", $sql);
     $result = $this->dbManager->execute(__METHOD__ . "getListOfFiles", array($Item, $Max, $Offset));
     $Count = pg_num_rows($result);
     if ($Page > 0 || $Count >= $Max) {
         $VM = "<P />\n" . MenuEndlessPage($Page, $Count >= $Max) . "<P />\n";
     } else {
         $VM = "";
     }
     if ($Count > 0) {
         $V .= _("This exact file appears in the following locations:\n");
         $V .= $VM;
         $Offset++;
         $V .= Dir2FileList($result, "browse", "view", $Offset);
         $V .= $VM;
     } else {
         if ($Page > 0) {
             $V .= _("End of listing.\n");
         } else {
             $V .= _("This file does not appear in any other known location.\n");
         }
     }
     pg_free_result($result);
     return $V;
 }