15 define(
"TITLE_UI_DEMOMOD", _(
"Demomod View"));
51 $MenuName =
"Demomod View";
57 $text = _(
"Demomod data");
77 if ($this->
State != PLUGIN_STATE_INVALID) {
return(1);
80 return($this->
State == PLUGIN_STATE_VALID);
95 $sql =
"select ars_pk from demomod_ars where upload_fk=$upload_pk and ars_success=true";
98 $rows = pg_num_rows($result);
99 pg_free_result($result);
101 if ($rows == 0) {
return _(
"There is no demomod data for this upload. Use Jobs > Schedule Agent.");
106 $sql =
"select pfile_fk from $this->uploadtree_tablename where uploadtree_pk=$uploadtree_pk and upload_fk=$upload_pk";
109 $rows = pg_num_rows($result);
110 if ($rows == 0) {
return _(
"Internal consistency error. Failed: $sql");
112 $row = pg_fetch_assoc($result);
113 $pfile_fk = $row[
'pfile_fk'];
114 pg_free_result($result);
117 $sql =
"select firstbytes from demomod where pfile_fk=$pfile_fk";
120 $rows = pg_num_rows($result);
121 if ($rows == 0) {
return _(
"Internal consistency error. Failed: $sql");
123 $row = pg_fetch_assoc($result);
124 $firstbytes = $row[
'firstbytes'];
125 pg_free_result($result);
127 $text = _(
"The first bytes of this file are: ");
128 return ($text . $firstbytes);
137 $uTime = microtime(
true);
138 if ($this->
State != PLUGIN_STATE_READY) {
145 $uploadDao = $GLOBALS[
'container']->get(
'dao.upload');
146 if (!$uploadDao->isAccessible($Upload, Fossology\Lib\Auth\Auth::getGroupId()))
148 $text = _(
"Permission Denied");
149 return "<h2>$text</h2>";
162 $_SERVER[
'REQUEST_URI'] = preg_replace(
"/&updcache=[0-9]*/",
"",$_SERVER[
'REQUEST_URI']);
163 unset($_GET[
'updcache']);
175 switch($this->OutputType)
180 $V .=
"<font class='text'>\n";
189 $Uri = preg_replace(
"/&item=([0-9]*)/",
"",
Traceback());
191 $V .= $this->
ShowData($Upload, $Item);
207 if (!$this->OutputToStdout) {
211 $Time = microtime(
true) - $uTime;
212 $text = _(
"Elapsed time: %.2f seconds");
213 printf(
"<small>$text</small>", $Time);
218 $text1 = _(
"Update");
219 echo
" <i>$text</i> <a href=\"$_SERVER[REQUEST_URI]&updcache=1\"> $text1 </a>";
233 $NewPlugin->Initialize();
char * uploadtree_tablename
upload.uploadtree_tablename
This is the Plugin class. All plugins should:
browse an upload and display the demomod data (first bytes of the file)
$uploadtree_tablename
Upload tree table to use.
$Dependency
Dependecy for plugin.
Install()
Only used during installation.
ShowData($upload_pk, $uploadtree_pk)
Display the demomod data.
RegisterMenus()
Customize submenus.
$DBaccess
DB access required.
Output()
This function returns the scheduler status.
Initialize()
This is called before the plugin is used.
ReportCacheGet($CacheKey)
This function is used by Output() to see if the requested report is in the report cache.
ReportCachePut($CacheKey, $CacheValue)
This function is used to write a record to the report cache. If the record already exists,...
ReportCachePurgeByKey($CacheKey)
Purge from the report cache the record with $CacheKey.
DBCheckResult($result, $sql, $filenm, $lineno)
Check the postgres result for unexpected errors. If found, treat them as fatal.
Dir2Browse($Mod, $UploadtreePk, $LinkLast=NULL, $ShowBox=1, $ShowMicro=NULL, $Enumerate=-1, $PreText='', $PostText='', $uploadtree_tablename="uploadtree")
Get an html linked string of a file browse path.
Traceback()
Get the URI + query to this location.
GetParm($parameterName, $parameterType)
This function will retrieve the variables and check data types.
Traceback_parm_keep($List)
Create a new URI, keeping only these items.
FUNCTION char * GetUploadtreeTableName(PGconn *pgConn, int upload_pk)
Get the uploadtree table name for this upload_pk If upload_pk does not exist, return "uploadtree".
#define PLUGIN_DB_READ
Plugin requires read permission on DB.
foreach($Options as $Option=> $OptVal) if(0==$reference_flag &&0==$nomos_flag) $PG_CONN