• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP plugin_find_id函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中plugin_find_id函数的典型用法代码示例。如果您正苦于以下问题:PHP plugin_find_id函数的具体用法?PHP plugin_find_id怎么用?PHP plugin_find_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了plugin_find_id函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: PostInitialize

 /**
  * \brief This is where we check for
  * changes to the full-debug setting.
  */
 function PostInitialize()
 {
     if ($this->State != PLUGIN_STATE_VALID) {
         return 0;
     }
     // don't re-run
     // Make sure dependencies are met
     foreach ($this->Dependency as $key => $val) {
         $id = plugin_find_id($val);
         if ($id < 0) {
             $this->Destroy();
             return 0;
         }
     }
     $FullMenuDebug = GetParm("fullmenu", PARM_INTEGER);
     if ($FullMenuDebug == 2) {
         $_SESSION['fullmenudebug'] = 1;
     }
     if ($FullMenuDebug == 1) {
         $_SESSION['fullmenudebug'] = 0;
     }
     // It worked, so mark this plugin as ready.
     $this->State = PLUGIN_STATE_READY;
     // Add this plugin to the menu
     if ($this->MenuList !== "") {
         menu_insert("Main::" . $this->MenuList, $this->MenuOrder, $this->Name, $this->MenuTarget);
     }
     return 1;
 }
开发者ID:pombredanne,项目名称:fossology-test,代码行数:33,代码来源:core-debug-menus.php


示例2: Output

 /**
  * \brief Generate output for this plug-in.
  */
 function Output()
 {
     if ($this->State != PLUGIN_STATE_READY) {
         return;
     }
     global $SysConf;
     global $Plugins;
     $html = "<table width='100%' border=0 cellpadding=0>\n  <tr>\n";
     $Uri = Traceback_dir();
     if (@$SysConf['SYSCONFIG']['LogoImage'] and @$SysConf['SYSCONFIG']['LogoLink']) {
         $LogoLink = $SysConf['SYSCONFIG']['LogoLink'];
         $LogoImg = $SysConf['SYSCONFIG']['LogoImage'];
     } else {
         $LogoLink = 'http://fossology.org';
         $LogoImg = Traceback_uri . 'images/fossology-logo.gif';
     }
     $html .= "    <td width='15%'>";
     $html .= "<a href='{$LogoLink}' target='_top'><img src='{$LogoImg}' align=absmiddle border=0></a>";
     $html .= "</td>\n";
     $html .= "    <td valign='top'>";
     $Menu =& $Plugins[plugin_find_id("menus")];
     $Menu->OutputSet($this->OutputType, 0);
     $html .= $Menu->Output();
     $html .= "    </td>\n";
     $html .= "  </tr>\n";
     $html .= "</table>\n";
     return $html;
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:31,代码来源:ui-topnav.php


示例3: menuToActiveSelect

 /**
  * @param $menu     menu list need to show as list
  * @param $parm     a list of parameters to add to the URL.
  * @param $uploadId upload id
  */
 public static function menuToActiveSelect($menu, &$parm, $uploadId = "")
 {
     if (empty($menu)) {
         return '';
     }
     $showFullName = isset($_SESSION) && array_key_exists('fullmenudebug', $_SESSION) && $_SESSION['fullmenudebug'] == 1;
     $optionsOut = "";
     foreach ($menu as $Val) {
         if (!empty($Val->HTML)) {
             $entry = $Val->HTML;
         } else {
             if (!empty($Val->URI)) {
                 if (!empty($uploadId) && "tag" == $Val->URI) {
                     $tagstatus = TagStatus($uploadId);
                     if (0 == $tagstatus) {
                         // tagging on this upload is disabled
                         break;
                     }
                 }
                 $entry = '<option value="' . Traceback_uri() . '?mod=' . $Val->URI . '&' . $parm . '"';
                 if (!empty($Val->Title)) {
                     $entry .= ' title="' . htmlentities($Val->Title, ENT_QUOTES) . '"';
                 }
                 $entry .= '>' . $Val->getName($showFullName) . '</option>';
             } else {
                 $entry = "<option>" . $Val->getName($showFullName) . "</option>";
             }
         }
         $optionsOut .= $entry;
     }
     if (plugin_find_id('showjobs') >= 0) {
         $optionsOut .= '<option value="' . Traceback_uri() . '?mod=showjobs&upload=' . $uploadId . '" title="' . _("Scan History") . '" >' . _("History") . '</option>';
     }
     return '<select class="goto-active-option"><option>-- select action --</option>' . $optionsOut . '</select>';
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:40,代码来源:MenuRenderer.php


示例4: PostInitialize

 /**
  * \brief This function is called before the plugin
  * is used and after all plugins have been initialized.
  * 
  * \return on success, false on failure.
  * \note Do not assume that the plugin exists!  Actually check it!
  * Purpose: Only allow people who are logged in to edit their own properties.
  */
 function PostInitialize()
 {
     global $Plugins;
     if ($this->State != PLUGIN_STATE_VALID) {
         return 0;
     }
     // don't run
     if ($_SESSION['User'] == "Default User") {
         /* Only valid if the user is logged in. */
         $this->State = PLUGIN_STATE_INVALID;
         return 0;
     }
     // Make sure dependencies are met
     foreach ($this->Dependency as $key => $val) {
         $id = plugin_find_id($val);
         if ($id < 0) {
             $this->Destroy();
             return 0;
         }
     }
     // It worked, so mark this plugin as ready.
     $this->State = PLUGIN_STATE_READY;
     // Add this plugin to the menu
     if ($this->MenuList !== "") {
         menu_insert("Main::" . $this->MenuList, $this->MenuOrder, $this->Name, $this->MenuTarget);
     }
     return $this->State == PLUGIN_STATE_READY;
 }
开发者ID:pombredanne,项目名称:fossology-test,代码行数:36,代码来源:user-edit-self.php


示例5: Output

 /**
  * \brief Generate the text for this plugin.
  */
 function Output()
 {
     if ($this->State != PLUGIN_STATE_READY) {
         return;
     }
     global $PG_CONN;
     $V = "";
     switch ($this->OutputType) {
         case "XML":
             break;
         case "HTML":
             /* Get uploadtree_pk's for all debian uploads */
             $sql = "SELECT uploadtree_pk, upload_pk, upload_filename FROM upload INNER JOIN uploadtree ON upload_fk=upload_pk AND parent IS NULL WHERE upload_filename LIKE '%debian%';";
             $result = pg_query($PG_CONN, $sql);
             DBCheckResult($result, $sql, __FILE__, __LINE__);
             $row = pg_fetch_assoc($result);
             if (empty($row['upload_pk'])) {
                 $V .= "There are no uploads with 'debian' in the description.";
             } else {
                 /* Loop thru results to obtain all licenses in their uploadtree recs*/
                 $Lics = array();
                 while ($Row = pg_fetch_array($result)) {
                     if (empty($Row['upload_pk'])) {
                         continue;
                     } else {
                         LicenseGetAll($Row[uploadtree_pk], $Lics);
                     }
                     $V .= "<option value='" . $Row['upload_pk'] . "'>{$Name}</option>\n";
                 }
                 $V .= "</select><P />\n";
                 arsort($Lics);
                 $V .= "<table border=1>\n";
                 foreach ($Lics as $key => $value) {
                     if ($key == " Total ") {
                         $V .= "<tr><th>{$key}<th>{$value}\n";
                     } else {
                         if (plugin_find_id('search_file_by_license') >= 0) {
                             $V .= "<tr><td><a href='/repo/?mod=search_file_by_license&item={$Row['uploadtree_pk']}&lic=" . urlencode($key) . "'>{$key}</a><td align='right'>{$value}\n";
                         } else {
                             $V .= "<tr><td>{$key}<td align='right'>{$value}\n";
                         }
                     }
                 }
                 $V .= "</table>\n";
                 //	  print "<pre>"; print_r($Lics); print "</pre>";
             }
             pg_free_result($result);
             break;
         case "Text":
             break;
         default:
             break;
     }
     if (!$this->OutputToStdout) {
         return $V;
     }
     print $V;
     return;
 }
开发者ID:pombredanne,项目名称:fossology-test,代码行数:62,代码来源:ui-debian-lics_v2.php


示例6: OutputClose

 /**
  * \brief This function is called when user output is
  * finished.
  */
 function OutputClose()
 {
     if ($this->State != PLUGIN_STATE_READY) {
         return 0;
     }
     global $Plugins;
     $P =& $Plugins[plugin_find_id("Default")];
     return $P->OutputClose();
 }
开发者ID:pombredanne,项目名称:fossology-test,代码行数:13,代码来源:ui-refresh.php


示例7: Output

 /**
  * \brief This function is called when user output is
  * requested.  This function is responsible for content.
  */
 function Output()
 {
     if ($this->State != PLUGIN_STATE_READY) {
         return;
     }
     global $Plugins;
     $P =& $Plugins[plugin_find_id("Default")];
     $GoMod = GetParm("remod", PARM_STRING);
     $GoOpt = GetParm("reopt", PARM_STRING);
     $GoOpt = preg_replace("/--/", "&", $GoOpt);
     return $P->Output($GoMod, $GoOpt);
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:16,代码来源:ui-refresh.php


示例8: handle

 /**
  * @param Request $request
  * @return Response
  */
 protected function handle(Request $request)
 {
     $show = $request->get('show');
     if ($show == 'licensebrowser') {
         return $this->render("getting_started_licensebrowser.html.twig");
     }
     $login = _("Login");
     if (empty($_SESSION['User']) && plugin_find_id("auth") >= 0) {
         $login = "<a href='" . Traceback_uri() . "?mod=auth'>{$login}</a>";
     }
     $vars = array('login' => $login, 'SiteURI' => Traceback_uri());
     return $this->render('getting_started.html.twig', $this->mergeWithDefault($vars));
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:17,代码来源:GettingStartedPage.php


示例9: AgentsAdd

 /**
  * \brief Add an upload to multiple agents.
  *
  * \param $uploadpk 
  * \param $agentlist - list of agents
  * \return NULL on success, error message string on failure
  */
 function AgentsAdd($uploadpk, $agentlist)
 {
     global $Plugins;
     global $PG_CONN;
     global $SysConf;
     $rc = "";
     $Alist = array();
     /* Make sure the uploadpk is valid */
     if (!$uploadpk) {
         return "agent-add.php AgentsAdd(): No upload_pk specified";
     }
     $sql = "SELECT upload_pk, upload_filename FROM upload WHERE upload_pk = '{$uploadpk}';";
     $result = pg_query($PG_CONN, $sql);
     DBCheckResult($result, $sql, __FILE__, __LINE__);
     if (pg_num_rows($result) < 1) {
         $ErrMsg = __FILE__ . ":" . __LINE__ . " " . _("Upload") . " " . $uploadpk . " " . _("not found");
         return $ErrMsg;
     }
     $UploadRow = pg_fetch_assoc($result);
     $ShortName = $UploadRow['upload_filename'];
     pg_free_result($result);
     /* Create Job */
     $user_pk = $SysConf['auth']['UserId'];
     $job_pk = JobAddJob($user_pk, $ShortName, $uploadpk);
     /* Validate the agent list and add agents as needed. */
     /** Don't worry about order or duplicates -- it will do the right thing. **/
     $Depth = 0;
     $agent_list = menu_find("Agents", $depth);
     for ($al = 0; !empty($agentlist[$al]); $al++) {
         /* check if the agent exists in the list of viable agents */
         $Found = -1;
         for ($ac = 0; $Found < 0 && !empty($agent_list[$ac]->URI); $ac++) {
             if (!strcmp($agent_list[$ac]->URI, $agentlist[$al])) {
                 $Found = $al;
                 break;
             }
         }
         if ($Found >= 0) {
             //print "Adding to " . $agentlist[$Found] . "<br>\n";
             $Dependencies = array();
             $P =& $Plugins[plugin_find_id($agentlist[$Found])];
             $rv = $P->AgentAdd($job_pk, $uploadpk, $ErrorMsg, $Dependencies);
             if ($rv == -1) {
                 $rc .= $ErrorMsg;
             }
         } else {
             $rc .= "Agent '" . htmlentities($agentlist[$al]) . "' not found.\n";
         }
     }
     return $rc;
 }
开发者ID:pombredanne,项目名称:fossology-test,代码行数:58,代码来源:agent-add.php


示例10: Output

 /**
  * \brief This function is called when user output is
  * requested.  This function is responsible for content. \n
  * The $ToStdout flag is "1" if output should go to stdout, and
  * 0 if it should be returned as a string.  (Strings may be parsed
  * and used by other plugins.)
  */
 function Output()
 {
     global $PG_CONN;
     if ($this->State != PLUGIN_STATE_READY) {
         return;
     }
     $V = "";
     global $Plugins;
     $View =& $Plugins[plugin_find_id("view")];
     $Item = GetParm("item", PARM_INTEGER);
     $Upload = GetParm("upload", PARM_INTEGER);
     $ModBack = GetParm("modback", PARM_STRING);
     if (empty($ModBack)) {
         $ModBack = 'copyrighthist';
     }
     $pfile = 0;
     $sql = "SELECT * FROM uploadtree WHERE uploadtree_pk = " . $Item . ";";
     $result = pg_query($PG_CONN, $sql);
     DBCheckResult($result, $sql, __FILE__, __LINE__);
     $row = pg_fetch_assoc($result);
     pg_free_result($result);
     if (!empty($row['pfile_fk'])) {
         $pfile = $row['pfile_fk'];
     } else {
         $text = _("Could not locate the corresponding pfile.");
         print $text;
     }
     $sql = "SELECT * FROM copyright WHERE copy_startbyte IS NOT NULL\n            and pfile_fk=" . $pfile . ";";
     $result = pg_query($PG_CONN, $sql);
     DBCheckResult($result, $sql, __FILE__, __LINE__);
     if (pg_num_rows($result) < 1) {
         $text = _("No copyright data is available for this file.");
         print $text;
         return;
     }
     $row = pg_fetch_assoc($result, 0);
     $colors = array();
     $colors['statement'] = 0;
     $colors['email'] = 1;
     $colors['url'] = 2;
     if (!empty($row['copy_startbyte'])) {
         while ($row = pg_fetch_assoc($result)) {
             $View->AddHighlight($row['copy_startbyte'], $row['copy_endbyte'], $colors[$row['type']], '', $row['content'], -1, Traceback_uri() . "?mod=copyrightlist&agent=" . $row['agent_fk'] . "&item={$Item}&hash=" . $row['hash'] . "&type=" . $row['type']);
         }
         $View->SortHighlightMenu();
     }
     pg_free_result($result);
     $View->ShowView(NULL, $ModBack, 1, 1, NULL, True);
     return;
 }
开发者ID:pombredanne,项目名称:fossology-test,代码行数:57,代码来源:view.php


示例11: handle

 /**
  * @param Request $request
  * @return Response
  */
 protected function handle(Request $request)
 {
     $vars = array('isSecure' => $request->isSecure());
     if (array_key_exists('User', $_SESSION) && $_SESSION['User'] == "Default User" && plugin_find_id("auth") >= 0) {
         if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "off") {
             $vars['protocol'] = "HTTPS";
         } else {
             $vars['protocol'] = preg_replace("@/.*@", "", @$_SERVER['SERVER_PROTOCOL']);
         }
         $vars['referrer'] = "?mod=browse";
         $vars['authUrl'] = "?mod=auth";
     }
     return $this->render("home.html.twig", $this->mergeWithDefault($vars));
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:18,代码来源:HomePage.php


示例12: getAgentPluginNames

 /**
  * @param string $hook 'ParmAgents'|'Agents'|'UploadMulti'
  * @return array
  */
 public static function getAgentPluginNames($hook = 'Agents')
 {
     $maxDepth = 0;
     $agentList = menu_find($hook, $maxDepth) ?: array();
     $agentPluginNames = array();
     if (is_array($agentList)) {
         foreach ($agentList as $parmAgent) {
             $agent = plugin_find_id($parmAgent->URI);
             if (!empty($agent)) {
                 $agentPluginNames[] = $agent;
             }
         }
     }
     return $agentPluginNames;
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:19,代码来源:MenuHook.php


示例13: Output

 /**
  * \brief Generate output for this plug-in.
  */
 function Output()
 {
     global $Plugins;
     global $SysConf;
     if ($this->State != PLUGIN_STATE_READY) {
         return;
     }
     $V = "";
     switch ($this->OutputType) {
         case "XML":
             break;
         case "HTML":
             $Uri = Traceback_dir();
             $V .= "<table width='100%' border=0 cellpadding=0>\n";
             $V .= "  <tr>\n";
             /* custom or default logo? */
             if (@$SysConf['SYSCONFIG']['LogoImage'] and @$SysConf['SYSCONFIG']['LogoLink']) {
                 $LogoLink = $SysConf['SYSCONFIG']['LogoLink'];
                 $LogoImg = $SysConf['SYSCONFIG']['LogoImage'];
             } else {
                 $LogoLink = 'http://fossology.org';
                 $LogoImg = Traceback_uri . 'images/fossology-logo.gif';
             }
             $V .= "    <td width='15%'>";
             $V .= "<a href='{$LogoLink}' target='_top'><img src='{$LogoImg}' align=absmiddle border=0></a>";
             $V .= "</td>\n";
             $V .= "    <td valign='top'>";
             $Menu =& $Plugins[plugin_find_id("menus")];
             $Menu->OutputSet($this->OutputType, 0);
             $V .= $Menu->Output();
             $Menu->OutputUnSet();
             $V .= "    </td>\n";
             $V .= "  </tr>\n";
             $V .= "</table>\n";
             break;
         case "Text":
             break;
         default:
             break;
     }
     if (!$this->OutputToStdout) {
         return $V;
     }
     print "{$V}";
     return;
 }
开发者ID:pombredanne,项目名称:fossology-test,代码行数:49,代码来源:ui-topnav.php


示例14: Output

 /**
  * \brief Display the loaded menu and plugins.
  */
 public function Output()
 {
     global $Plugins;
     global $PG_CONN;
     $UploadPk = GetParm("upload", PARM_INTEGER);
     $Agent = GetParm("agent", PARM_STRING);
     if (empty($UploadPk) || empty($Agent)) {
         return new Response('missing parameter', Response::HTTP_BAD_REQUEST, array('Content-type' => 'text/plain'));
     }
     $sql = "SELECT upload_pk, upload_filename FROM upload WHERE upload_pk = '{$UploadPk}'";
     $result = pg_query($PG_CONN, $sql);
     DBCheckResult($result, $sql, __FILE__, __LINE__);
     if (pg_num_rows($result) < 1) {
         $errMsg = __FILE__ . ":" . __LINE__ . " " . _("Upload") . " " . $UploadPk . " " . _("not found");
         return new Response($errMsg, Response::HTTP_BAD_REQUEST, array('Content-type' => 'text/plain'));
     }
     $UploadRow = pg_fetch_assoc($result);
     $ShortName = $UploadRow['upload_filename'];
     pg_free_result($result);
     $user_pk = Auth::getUserId();
     $group_pk = Auth::getGroupId();
     $job_pk = JobAddJob($user_pk, $group_pk, $ShortName, $UploadPk);
     $Dependencies = array();
     $P =& $Plugins[plugin_find_id($Agent)];
     $rv = $P->AgentAdd($job_pk, $UploadPk, $ErrorMsg, $Dependencies);
     if ($rv <= 0) {
         $text = _("Scheduling of Agent(s) failed: ");
         return new Response($text . $rv . $ErrorMsg, Response::HTTP_BAD_REQUEST, array('Content-type' => 'text/plain'));
     }
     /** check if the scheudler is running */
     $status = GetRunnableJobList();
     $scheduler_msg = "";
     if (empty($status)) {
         $scheduler_msg .= _("Is the scheduler running? ");
     }
     $URL = Traceback_uri() . "?mod=showjobs&upload={$UploadPk}";
     /* Need to refresh the screen */
     $text = _("Your jobs have been added to job queue.");
     $LinkText = _("View Jobs");
     $msg = "{$scheduler_msg}" . "{$text} <a href={$URL}>{$LinkText}</a>";
     $this->vars['message'] = $msg;
     return new Response($msg, Response::HTTP_OK, array('Content-type' => 'text/plain'));
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:46,代码来源:ajax-schedule-agent.php


示例15: Output

 /**
  * \brief Generate the text for this plugin.
  */
 function Output()
 {
     if ($this->State != PLUGIN_STATE_READY) {
         return;
     }
     global $Plugins;
     $V = "";
     switch ($this->OutputType) {
         case "XML":
             break;
         case "HTML":
             /* If this is a POST, then process the request. */
             $uploadpk = GetParm('uploadunpack', PARM_INTEGER);
             if (!empty($uploadpk)) {
                 $P =& $Plugins[plugin_find_id("agent_unpack")];
                 $rc = $P->AgentAdd($uploadpk);
                 if (empty($rc)) {
                     /* Need to refresh the screen */
                     $text = _("Unpack added to job queue");
                     $V .= displayMessage($text);
                 } else {
                     $text = _("Unpack of Upload failed");
                     $V .= displayMessage("{$text}: {$rc}");
                 }
             }
             /* Set default values */
             if (empty($GetURL)) {
                 $GetURL = 'http://';
             }
             //$V .= $this->ShowReunpackView($uploadtree_pk);
             break;
         case "Text":
             break;
         default:
             break;
     }
     if (!$this->OutputToStdout) {
         return $V;
     }
     print "{$V}";
     return;
 }
开发者ID:pombredanne,项目名称:fossology-test,代码行数:45,代码来源:ui-reunpack.php


示例16: Output

 /**
  * \brief Display the loaded menu and plugins.
  */
 function Output()
 {
     if ($this->State != PLUGIN_STATE_READY) {
         return;
     }
     $V = "";
     global $Plugins;
     switch ($this->OutputType) {
         case "XML":
             break;
         case "HTML":
             $UploadPk = GetParm("upload", PARM_INTEGER);
             if (empty($UploadPk)) {
                 return;
             }
             $Depth = 0;
             $agent_list = menu_find("Agents", $depth);
             $Skip = array("agent_unpack", "agent_adj2nest", "wget_agent");
             for ($ac = 0; !empty($agent_list[$ac]->URI); $ac++) {
                 if (array_search($agent_list[$ac]->URI, $Skip) !== false) {
                     continue;
                 }
                 $P =& $Plugins[plugin_find_id($agent_list[$ac]->URI)];
                 if ($P->AgentHasResults($UploadPk) != 1) {
                     $V .= "<option value='" . $agent_list[$ac]->URI . "'>";
                     $V .= htmlentities($agent_list[$ac]->Name);
                     $V .= "</option>\n";
                 }
             }
             break;
         case "Text":
             break;
         default:
             break;
     }
     if (!$this->OutputToStdout) {
         return $V;
     }
     print $V;
     return;
 }
开发者ID:pombredanne,项目名称:fossology-test,代码行数:44,代码来源:ajax-upload-agents.php


示例17: checkPrerequisites

 private function checkPrerequisites()
 {
     if ($this->requiresLogin && !$this->isLoggedIn()) {
         throw new \Exception("not allowed without login");
     }
     foreach ($this->dependencies as $dependency) {
         $id = plugin_find_id($dependency);
         if ($id < 0) {
             $this->unInstall();
             throw new \Exception("unsatisfied dependency '{$dependency}' in module '" . $this->getName() . "'");
         }
     }
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:13,代码来源:DefaultPlugin.php


示例18: getFileListing

 /**
  * @param $Uploadtree_pk
  * @param $Uri
  * @param $uploadtree_tablename
  * @param $Agent_pk
  * @param $upload_pk
  * @return array
  */
 protected function getFileListing($Uploadtree_pk, $Uri, $uploadtree_tablename, $Agent_pk, $upload_pk)
 {
     $VF = "";
     // return values for file listing
     /*******    File Listing     ************/
     /* Get ALL the items under this Uploadtree_pk */
     $Children = GetNonArtifactChildren($Uploadtree_pk, $uploadtree_tablename);
     $ChildCount = 0;
     $ChildLicCount = 0;
     $ChildDirCount = 0;
     /* total number of directory or containers */
     foreach ($Children as $c) {
         if (Iscontainer($c['ufile_mode'])) {
             $ChildDirCount++;
         }
     }
     $VF .= "<table border=0>";
     foreach ($Children as $child) {
         if (empty($child)) {
             continue;
         }
         $ChildCount++;
         global $Plugins;
         $ModLicView =& $Plugins[plugin_find_id($this->viewName)];
         /* Determine the hyperlink for non-containers to view-license  */
         if (!empty($child['pfile_fk']) && !empty($ModLicView)) {
             $LinkUri = Traceback_uri();
             $LinkUri .= "?mod=" . $this->viewName . "&agent={$Agent_pk}&upload={$upload_pk}&item={$child['uploadtree_pk']}";
         } else {
             $LinkUri = NULL;
         }
         /* Determine link for containers */
         if (Iscontainer($child['ufile_mode'])) {
             $uploadtree_pk = DirGetNonArtifact($child['uploadtree_pk'], $uploadtree_tablename);
             $LicUri = "{$Uri}&item=" . $uploadtree_pk;
         } else {
             $LicUri = NULL;
         }
         /* Populate the output ($VF) - file list */
         /* id of each element is its uploadtree_pk */
         $LicCount = 0;
         $cellContent = Isdir($child['ufile_mode']) ? $child['ufile_name'] . '/' : $child['ufile_name'];
         if (Iscontainer($child['ufile_mode'])) {
             $cellContent = "<a href='{$LicUri}'><b>{$cellContent}</b></a>";
         } else {
             if (!empty($LinkUri)) {
                 $cellContent = "<a href='{$LinkUri}'>{$cellContent}</a>";
             }
         }
         $VF .= "<tr><td id='{$child['uploadtree_pk']}' align='left'>{$cellContent}</td><td>";
         if ($LicCount) {
             $VF .= "[" . number_format($LicCount, 0, "", ",") . "&nbsp;";
             $VF .= "license" . ($LicCount == 1 ? "" : "s");
             $VF .= "</a>";
             $VF .= "]";
             $ChildLicCount += $LicCount;
         }
         $VF .= "</td></tr>\n";
     }
     $VF .= "</table>\n";
     return array($ChildCount, $VF);
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:70,代码来源:HistogramBase.php


示例19: ShowUploadHist

 /**
  * \brief Given an Upload and UploadtreePk item, display:
  * - The histogram for the directory BY LICENSE.
  * - The file listing for the directory, with license navigation.
  */
 function ShowUploadHist($Upload, $Item, $Uri)
 {
     /*****
         Get all the licenses PER item (file or directory) under this
         UploadtreePk.
         Save the data 3 ways:
         - Number of licenses PER item.
         - Number of items PER license.
         - Number of items PER license family.
        *****/
     $VF = "";
     // return values for file listing
     $VH = "";
     // return values for license histogram
     $V = "";
     // total return value
     global $Plugins;
     global $PG_CONN;
     $Lics = array();
     // license summary for an item in the directory
     $ModLicView =& $Plugins[plugin_find_id("view-license")];
     /* Arrays for storying item->license and license->item mappings */
     $LicGID2Item = array();
     $LicItem2GID = array();
     $MapLic2GID = array();
     /* every license should have an ID number */
     /*  Get the counts for each license under this UploadtreePk*/
     LicenseGetAll($Item, $Lics);
     // key is license name, value is count
     $LicTotal = $Lics[' Total '];
     /* Ensure that every license is associated with an ID */
     /* MapLic2Gid key is license name, value is a sequence number (GID) */
     $MapNext = 0;
     foreach ($Lics as $Key => $Val) {
         $MapLic2GID[$Key] = $MapNext++;
     }
     /****************************************/
     /* Get ALL the items under this UploadtreePk */
     $Children = DirGetList($Upload, $Item);
     $ChildCount = 0;
     $ChildLicCount = 0;
     $ChildDirCount = 0;
     /* total number of directory or containers */
     foreach ($Children as $C) {
         if (Iscontainer($C['ufile_mode'])) {
             $ChildDirCount++;
         }
     }
     $VF .= "<table border=0>";
     foreach ($Children as $C) {
         if (empty($C)) {
             continue;
         }
         /* Store the item information */
         $IsDir = Isdir($C['ufile_mode']);
         $IsContainer = Iscontainer($C['ufile_mode']);
         /* Determine the hyperlinks */
         if (!empty($C['pfile_fk']) && !empty($ModLicView)) {
             $LinkUri = "{$Uri}&item=" . $C['uploadtree_pk'];
             $LinkUri = preg_replace("/mod=license/", "mod=view-license", $LinkUri);
         } else {
             $LinkUri = NULL;
         }
         if (Iscontainer($C['ufile_mode'])) {
             $uploadtree_pk = DirGetNonArtifact($C['uploadtree_pk']);
             $LicUri = "{$Uri}&item=" . $uploadtree_pk;
         } else {
             $LicUri = NULL;
         }
         /* Populate the output ($VF) - file list */
         /* Find number of licenses in child */
         //      if (($ChildDirCount < 20) || (!$IsContainer))
         //        { $LicCount = LicenseCount($C['uploadtree_pk']); }
         //      else { $LicCount=0; }
         $LicCount = 0;
         $VF .= '<tr><td id="Lic-' . $LicCount . '" align="left">';
         $HasHref = 0;
         $HasBold = 0;
         if ($IsContainer) {
             $VF .= "<a href='{$LicUri}'>";
             $HasHref = 1;
             $VF .= "<b>";
             $HasBold = 1;
         } else {
             if (!empty($LinkUri)) {
                 $VF .= "<a href='{$LinkUri}'>";
                 $HasHref = 1;
             }
         }
         $VF .= $C['ufile_name'];
         if ($IsDir) {
             $VF .= "/";
         }
         if ($HasBold) {
             $VF .= "</b>";
//.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:fossology-test,代码行数:101,代码来源:ui-license.php


示例20: ShowUploadHist

 /**
  * \brief Given an $Uploadtree_pk, display: 
  *   - The histogram for the directory BY LICENSE.
  *   - The file listing for the directory.
  */
 function ShowUploadHist($Uploadtree_pk, $Uri, $tag_pk)
 {
     global $PG_CONN;
     $VF = "";
     // return values for file listing
     $VLic = "";
     // return values for license histogram
     $V = "";
     // total return value
     $UniqueTagArray = array();
     global $Plugins;
     $ModLicView =& $Plugins[plugin_find_id("view-license")];
     /*******  Get license names and counts  ******/
     /* Find lft and rgt bounds for this $Uploadtree_pk  */
     $sql = "SELECT lft,rgt,upload_fk FROM {$this->uploadtree_tablename}\n              WHERE uploadtree_pk = {$Uploadtree_pk}";
     $result = pg_query($PG_CONN, $sql);
     DBCheckResult($result, $sql, __FILE__, __LINE__);
     $row = pg_fetch_assoc($result);
     $lft = $row["lft"];
     $rgt = $row["rgt"];
     $upload_pk = $row["upload_fk"];
     pg_free_result($result);
     if (empty($lft)) {
         $text = _("Job unpack/adj2nest hasn't completed.");
         $VLic = "<b>{$text}</b><p>";
         return $VLic;
     }
     /* Find total number of files for this $Uploadtree_pk
      * Exclude artifacts and directories.
      */
     $sql = "SELECT count(*) as count FROM {$this->uploadtree_tablename}\n              WHERE upload_fk = {$upload_pk} \n                    and {$this->uploadtree_tablename}.lft BETWEEN {$lft} and {$rgt}\n                    and ((ufile_mode & (1<<28))=0) \n                    and ((ufile_mode & (1<<29))=0) and pfile_fk!=0";
     //$uTime = microtime(true);
     $result = pg_query($PG_CONN, $sql);
     //printf( "<small>count files Elapsed time: %.2f seconds</small>", microtime(true) - $uTime);  // convert usecs to secs
     DBCheckResult($result, $sql, __FILE__, __LINE__);
     $row = pg_fetch_assoc($result);
     $FileCount = $row["count"];
     pg_free_result($result);
     /*  Get the counts for each license under this UploadtreePk*/
     if (empty($tag_pk)) {
         $TagTable = "";
         $TagClause = "";
     } else {
         $TagTable = " right join tag_file on tag_file.pfile_fk=license_file_ref.pfile_fk ";
         $TagClause = " and tag_fk={$tag_pk}";
     }
     /** advanced interface allowing user to select dataset (agent version) */
     $Agent_name = 'nomos';
     $dataset = "nomos_dataset";
     $Agent_pk = GetParm("agent", PARM_STRING);
     /** if do not specify agent, get the latest agent result for this upload */
     if (empty($Agent_pk)) {
         $Agent_pk = LatestAgentpk($upload_pk, "nomos_ars");
     }
     if ($Agent_pk == 0) {
         $text = _("No data available.  Use Jobs > Agents to schedule a license scan.");
         $VLic = "<b>{$text}</b><p>";
         return $VLic;
     }
     /** get nomos select dataset */
     $AgentSelect = AgentSelect($Agent_name, $upload_pk, true, $dataset, $dataset, $Agent_pk, "onchange=\"addArsGo('newds', 'nomos_dataset');\"");
     /** change the nomos license result when selecting one version of nomos */
     if (!empty($AgentSelect)) {
         $action = Traceback_uri() . "?mod=nomoslicense&upload={$upload_pk}&item={$Uploadtree_pk}";
         $VLic .= "<script type='text/javascript'>\n        function addArsGo(formid, selectid)\n        {\n          var selectobj = document.getElementById(selectid);\n          var Agent_pk = selectobj.options[selectobj.selectedIndex].value;\n          document.getElementById(formid).action='{$action}'+'&agent='+Agent_pk;\n          document.getElementById(formid).submit();\n          return;\n        }\n      </script>";
         /* form to select new dataset, show dataset */
         $VLic .= "<form action='{$action}' id='newds' method='POST'>\n";
         $VLic .= $AgentSelect;
         $VLic .= "</form>";
     }
     $orderBy = array('count', 'license_name');
     $ordersql = "liccount desc";
     static $ordercount = 1;
     static $orderlic = 1;
     /** sorting by count/licnese name */
     if (isset($_GET['orderBy']) && in_array($_GET['orderBy'], $orderBy)) {
         $order = $_GET['orderBy'];
         if (isset($_GET['orderc'])) {
             $ordercount = $_GET['orderc'];
         }
         if (isset($_GET['orderl'])) {
             $orderlic = $_GET['orderl'];
         }
         if ('count' == $order && 1 == $ordercount) {
             $ordersql = "liccount desc";
             $ordercount = 0;
         } else {
             if ('count' == $order && 0 == $ordercount) {
                 $ordersql = "liccount ";
                 $ordercount = 1;
             } else {
                 if ('license_name' == $order && 1 == $orderlic) {
                     $ordersql = "rf_shortname ";
                     $orderlic = 0;
                 } else {
//.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:fossology-test,代码行数:101,代码来源:ui-nomos-license.php



注:本文中的plugin_find_id函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP plugin_get_current函数代码示例发布时间:2022-05-15
下一篇:
PHP plugin_directory函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap