FOSSology  4.4.0
Open Source License Compliance by Open Source Software
library.php File Reference

This file contains common functions for the copyright ui plugin. More...

Go to the source code of this file.

Functions

 hist_rowcmp_count_asc ($a, $b)
 Sort query histogram results (by content), ascend. More...
 
 hist_rowcmp_count_desc ($a, $b)
 Sort query histogram results (by content), descend. More...
 
 hist_rowcmp ($rowa, $rowb)
 Sort query histogram results (by content), ascend. More...
 
 hist_rowcmp_desc ($rowa, $rowb)
 Sort query histogram results (by content), descend. More...
 
 copyright_namecmp ($rowa, $rowb)
 Sort rows by filename. More...
 
 GetFilesWithCopyright ($agent_pk, $hash, $type, $uploadtree_pk, $PkgsOnly=false, $offset=0, $limit="ALL", $order="")
 get files with a given copyright. More...
 
 CountFilesWithCopyright ($agent_pk, $hash, $type, $uploadtree_pk, $PkgsOnly=false, $CheckOnly=false)
 
 StmtReorder ($content)
 rearrange copyright statment to try and put the holder first, followed by the rest of the statement. More...
 
 MassageContent (&$row, $hash)
 Input row array contains: pfile, content and type. More...
 

Detailed Description

This file contains common functions for the copyright ui plugin.

Definition in file library.php.

Function Documentation

◆ copyright_namecmp()

copyright_namecmp (   $rowa,
  $rowb 
)

Sort rows by filename.

Parameters
array[][]$rowa
array[][]$rowb
Returns
int

Definition at line 66 of file library.php.

◆ CountFilesWithCopyright()

CountFilesWithCopyright (   $agent_pk,
  $hash,
  $type,
  $uploadtree_pk,
  $PkgsOnly = false,
  $CheckOnly = false 
)

\biref Count files (pfiles) with a given copyright string.

Parameters
int$agent_pk- agentpk
string$hash- content hash
string$type- content type (statement, url, email)
int$uploadtree_pk- sets scope of request
boolean$PkgsOnly- if true, only list packages, default is false (all files are listed)
boolean$CheckOnly- if true, sets LIMIT 1 to check if uploadtree_pk has any of the given copyrights. Default is false.
Returns
int Number of unique pfiles with $hash
Todo:
$PkgsOnly is not yet implemented. Default is false.

Definition at line 133 of file library.php.

◆ GetFilesWithCopyright()

GetFilesWithCopyright (   $agent_pk,
  $hash,
  $type,
  $uploadtree_pk,
  $PkgsOnly = false,
  $offset = 0,
  $limit = "ALL",
  $order = "" 
)

get files with a given copyright.

Parameters
int$agent_pk- agentpk
string$hash- content hash
string$type- content type (statement, url, email)
int$uploadtree_pk- sets scope of request
boolean$PkgsOnly- if true, only list packages, default is false (all files are listed)
int$offset- select offset, default is 0
string$limit- select limit (num rows returned), default is no limit
string$order- sql order by clause, default is blank e.g. "order by ufile_name asc"
Returns
array pg_query result. See $sql for fields returned.
Note
Caller should use pg_free_result to free.
Todo:
$PkgsOnly is not yet implemented.

Definition at line 87 of file library.php.

◆ hist_rowcmp()

hist_rowcmp (   $rowa,
  $rowb 
)

Sort query histogram results (by content), ascend.

Parameters
array[][]$rowa
array[][]$rowb
Returns
int

Definition at line 44 of file library.php.

◆ hist_rowcmp_count_asc()

hist_rowcmp_count_asc (   $a,
  $b 
)

Sort query histogram results (by content), ascend.

Parameters
array[][]$a
array[][]$b
Returns
int

Definition at line 21 of file library.php.

◆ hist_rowcmp_count_desc()

hist_rowcmp_count_desc (   $a,
  $b 
)

Sort query histogram results (by content), descend.

Parameters
array[][]$a
array[][]$b
Returns
int

Definition at line 32 of file library.php.

◆ hist_rowcmp_desc()

hist_rowcmp_desc (   $rowa,
  $rowb 
)

Sort query histogram results (by content), descend.

Parameters
array[][]$rowa
array[][]$rowb
Returns
int

Definition at line 55 of file library.php.

◆ MassageContent()

MassageContent ( $row,
  $hash 
)

Input row array contains: pfile, content and type.

Output records: massaged content, type, hash
where content has been simplified from the raw records and hash is the md5 of this new content.
If $hash non zero, only rows with that hash will be returned.

Parameters
array$row
string$hash
Returns
boolean On empty row, return true, else false

Definition at line 198 of file library.php.

◆ StmtReorder()

StmtReorder (   $content)

rearrange copyright statment to try and put the holder first, followed by the rest of the statement.

Exaple
copyright (c) aaron seigo <aseigo kde.org> \n
would reorder to \n
aaron seigo <aseigo kde.org> | copyright (c) \n
this way the output will be better grouped by author. \n
Todo:
NOT YET IMPLEMENTED

Definition at line 179 of file library.php.