本文整理汇总了PHP中DBCheckResult函数的典型用法代码示例。如果您正苦于以下问题:PHP DBCheckResult函数的具体用法?PHP DBCheckResult怎么用?PHP DBCheckResult使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DBCheckResult函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_GetPkgMimetypes
/**
* \brief test for GetPkgMimetypes()
*/
function test_GetPkgMimetypes()
{
print "test function GetPkgMimetypes()\n";
global $PG_CONN;
#prepare database testdata
$mimeType = "application/x-rpm";
/** delete test data pre testing */
$sql = "DELETE FROM mimetype where mimetype_name in ('{$mimeType}');";
$result = pg_query($PG_CONN, $sql);
pg_free_result($result);
/** insert on record */
$sql = "INSERT INTO mimetype(mimetype_pk, mimetype_name) VALUES(10000, '{$mimeType}');";
$result = pg_query($PG_CONN, $sql);
pg_free_result($result);
#begin test GetPkgMimetypes()
$sql = "select * from mimetype where\n mimetype_name='application/x-rpm'";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
$row = pg_fetch_assoc($result);
$expected = $row['mimetype_pk'];
pg_free_result($result);
$result = GetPkgMimetypes();
$this->assertContains($expected, $result);
/** delete test data post testing */
$sql = "DELETE FROM mimetype where mimetype_name in ('{$mimeType}');";
$result = pg_query($PG_CONN, $sql);
pg_free_result($result);
}
示例2: Migrate_20_25
/**
* \brief
* delete from copyright where pfile_fk not in (select pfile_pk from pfile)
* add foreign constraint on copyright pfile_fk if not exist
*
* \return 0 on success, 1 on failure
**/
function Migrate_20_25($Verbose)
{
global $PG_CONN;
$sql = "select count(*) from pg_class where relname='copyright';";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
$row = pg_fetch_assoc($result);
pg_free_result($result);
if (1 > $row['count']) {
return 0;
// fresh install, even no copyright table
}
$sql = "delete from copyright where pfile_fk not in (select pfile_pk from pfile);";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
pg_free_result($result);
/** add foreign key CONSTRAINT on pfile_fk of copyrigyt table when not exist */
$sql = "SELECT conname from pg_constraint where conname= 'copyright_pfile_fk_fkey';";
$conresult = pg_query($PG_CONN, $sql);
DBCheckResult($conresult, $sql, __FILE__, __LINE__);
if (pg_num_rows($conresult) == 0) {
$sql = "ALTER TABLE copyright ADD CONSTRAINT copyright_pfile_fk_fkey FOREIGN KEY (pfile_fk) REFERENCES pfile (pfile_pk) ON DELETE CASCADE; ";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
pg_free_result($result);
print "add contr\n";
}
pg_free_result($conresult);
return 0;
}
示例3: 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;
}
示例4: Output
/**
* \brief Generate the text for this plugin.
*/
public function Output()
{
global $PG_CONN;
$V = "";
/* If this is a POST, then process the request. */
$folder = GetParm('folder', PARM_INTEGER);
if (!empty($folder)) {
$rc = $this->Delete($folder);
$sql = "SELECT * FROM folder where folder_pk = '{$folder}';";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
$Folder = pg_fetch_assoc($result);
pg_free_result($result);
if (empty($rc)) {
/* Need to refresh the screen */
$text = _("Deletion of folder ");
$text1 = _(" added to job queue");
$this->vars['message'] = $text . $Folder['folder_name'] . $text1;
} else {
$text = _("Deletion of ");
$text1 = _(" failed: ");
$this->vars['message'] = $text . $Folder['folder_name'] . $text1 . $rc;
}
}
$V .= "<form method='post'>\n";
// no url = this url
$text = _("Select the folder to");
$text1 = _("delete");
$V .= "{$text} <em>{$text1}</em>.\n";
$V .= "<ul>\n";
$text = _("This will");
$text1 = _("delete");
$text2 = _("the folder, all subfolders, and all uploaded files stored within the folder!");
$V .= "<li>{$text} <em>{$text1}</em> {$text2}\n";
$text = _("Be very careful with your selection since you can delete a lot of work!");
$V .= "<li>{$text}\n";
$text = _("All analysis only associated with the deleted uploads will also be deleted.");
$V .= "<li>{$text}\n";
$text = _("THERE IS NO UNDELETE. When you select something to delete, it will be removed from the database and file repository.");
$V .= "<li>{$text}\n";
$V .= "</ul>\n";
$text = _("Select the folder to delete: ");
$V .= "<P>{$text}\n";
$V .= "<select name='folder'>\n";
$text = _("select folder");
$V .= "<option value=''>[{$text}]</option>\n";
$V .= FolderListOption(-1, 0);
$V .= "</select><P />\n";
$text = _("Delete");
$V .= "<input type='submit' value='{$text}!'>\n";
$V .= "</form>\n";
return $V;
}
示例5: 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;
}
示例6: RunSQL
function RunSQL($sql, $DryRun)
{
global $PG_CONN;
$row = '';
if ($DryRun) {
echo "DryRun: {$sql}\n";
} else {
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
$row = pg_fetch_assoc($result);
pg_free_result($result);
}
return $row;
}
示例7: ManageTag
/**
* \brief Enable/Disable Tag on one folder(all uploads under this folder) or one upload
*
* \param $folder_id - folder id
* \param $upload_id - upload id
* \param $manage - enable or disable
*
* \return return null when no uploads to manage, return 1 after setting
*/
function ManageTag($folder_id, $upload_id, $manage)
{
global $PG_CONN;
/** no operation */
if (empty($manage)) {
return;
}
if (empty($folder_id) && empty($upload_id)) {
return;
}
/** get upload list */
$upload_list = array();
if (!empty($upload_id)) {
$upload_list[0] = array('upload_pk' => $upload_id);
} else {
$upload_list = FolderListUploadsRecurse($folder_id, NULL, Auth::PERM_WRITE);
}
// want to manage all uploads under a folder
foreach ($upload_list as $upload) {
$upload_id = $upload['upload_pk'];
if ("Enable" === $manage) {
$manage_value = false;
} else {
$manage_value = true;
}
/** check if this upload has been disabled */
$sql = "select * from tag_manage where upload_fk = {$upload_id} and is_disabled = true;";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
$count = pg_num_rows($result);
pg_free_result($result);
if (empty($count) && $manage_value == true) {
$sql = "INSERT INTO tag_manage(upload_fk, is_disabled) VALUES({$upload_id}, true);";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
pg_free_result($result);
} else {
if ($count == 1 && $manage_value == false) {
$sql = "delete from tag_manage where upload_fk = {$upload_id};";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
pg_free_result($result);
}
}
}
return 1;
}
示例8: Add
/**
* \brief Add a group.
* \param $GroupName raw group name as entered by the user
* Returns NULL on success, string on failure.
*/
function Add($GroupName)
{
global $PG_CONN;
global $SysConf;
$user_pk = $SysConf['auth']['UserId'];
/* Get the parameters */
$Group = str_replace("'", "''", $GroupName);
/* Make sure groupname looks valid */
if (empty($Group)) {
$text = _("Error: Group name must be specified.");
return $text;
}
/* See if the group already exists */
$sql = "SELECT * FROM groups WHERE group_name = '{$Group}'";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
if (pg_num_rows($result) < 1) {
pg_free_result($result);
$sql = "INSERT INTO groups (group_name) VALUES ('{$Group}')";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
pg_free_result($result);
} else {
pg_free_result($result);
$text = _("Group already exists. Not added.");
return $text;
}
/* Make sure it was added and get the group_pk */
$sql = "SELECT group_pk FROM groups WHERE group_name = '{$Group}'";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
if (pg_num_rows($result) < 1) {
pg_free_result($result);
$text = _("Failed to create group");
return $text . " {$Group}";
}
$row = pg_fetch_assoc($result);
$Group_pk = $row['group_pk'];
pg_free_result($result);
/* Add group admin to table group_user_member */
$sql = "INSERT INTO group_user_member (group_fk,user_fk,group_perm) VALUES ({$Group_pk}, {$user_pk}, 1)";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
pg_free_result($result);
return NULL;
}
示例9: HTMLout
/**
* \brief Generate HTML output.
*/
function HTMLout()
{
global $PG_CONN;
$OutBuf = "";
/* get config rows from sysconfig table */
$sql = "select * from sysconfig order by group_name, group_order";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
$Group = "";
$InputStyle = "style='background-color:#dbf0f7'";
$OutBuf .= "<form method='POST'>";
while ($row = pg_fetch_assoc($result)) {
if ($Group != $row['group_name']) {
if ($Group) {
$OutBuf .= "</table><br>";
}
$Group = $row['group_name'];
$OutBuf .= "<table border=1>";
}
$OutBuf .= "<tr><td>{$row['ui_label']}</td><td>";
switch ($row['vartype']) {
case CONFIG_TYPE_INT:
case CONFIG_TYPE_TEXT:
$ConfVal = htmlentities($row['conf_value']);
$OutBuf .= "<INPUT type='text' name='new[{$row['variablename']}]' size='70' value='{$ConfVal}' title='{$row['description']}' {$InputStyle}>";
$OutBuf .= "<br>{$row['description']}";
break;
case CONFIG_TYPE_TEXTAREA:
$ConfVal = htmlentities($row['conf_value']);
$OutBuf .= "<br><textarea name='new[{$row['variablename']}]' rows=3 cols=80 title='{$row['description']}' {$InputStyle}>{$ConfVal}</textarea>";
$OutBuf .= "<br>{$row['description']}";
break;
default:
$OutBuf .= "Invalid configuration variable. Unknown type.";
}
$OutBuf .= "</td></tr>";
$OutBuf .= "<INPUT type='hidden' name='old[{$row['variablename']}]' value='{$ConfVal}'>";
}
$OutBuf .= "</table>";
pg_free_result($result);
$btnlabel = _("Update");
$OutBuf .= "<p><input type='submit' value='{$btnlabel}'>";
$OutBuf .= "</form>";
return $OutBuf;
}
示例10: ChangeBuckets
function ChangeBuckets()
{
global $SysConf;
global $PG_CONN;
$uploadId = GetParm("upload", PARM_STRING);
$uploadTreeId = GetParm("item", PARM_STRING);
$sql = "SELECT bucketpool_fk from bucket_ars where upload_fk = {$uploadId};";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
$bucketpool_array = pg_fetch_all_columns($result, 0);
pg_free_result($result);
$buckets_dir = $SysConf['DIRECTORIES']['MODDIR'];
/** rerun bucket on the file */
foreach ($bucketpool_array as $bucketpool) {
$command = "{$buckets_dir}/buckets/agent/buckets -r -t {$uploadTreeId} -p {$bucketpool}";
exec($command);
}
}
示例11: add_user
/**
* \brief Add a user
* This also creates a group for the user and makes the user
* the group admin.
*
* Parameters are the user table fields:
* \param $User user_name
* \param $Desc user_desc
* \param $Seed user_seed
* \param $Hash user_pass
* \param $Perm user_perm
* \param $Email user_email
* \param $Email_notify email_notify
* \param $agentList user_agent_list
* \param $Folder root_folder_fk
* \param $default_bucketpool_fk, default is empty
*
* \return error: exit (1)
*/
function add_user($User, $Desc, $Seed, $Hash, $Perm, $Email, $Email_notify, $agentList, $Folder, $default_bucketpool_fk = '')
{
global $PG_CONN;
if (empty($default_bucketpool_fk)) {
$VALUES = " VALUES ('{$User}','{$Desc}','{$Seed}','{$Hash}',{$Perm},'{$Email}',\n '{$Email_notify}','{$agentList}',{$Folder}, NULL)";
} else {
$VALUES = " VALUES ('{$User}','{$Desc}','{$Seed}','{$Hash}',{$Perm},'{$Email}',\n '{$Email_notify}','{$agentList}',{$Folder}, {$default_bucketpool_fk})";
}
$SQL = "INSERT INTO users\n (user_name,user_desc,user_seed,user_pass,user_perm,user_email,\n email_notify,user_agent_list,root_folder_fk, default_bucketpool_fk)\n {$VALUES}";
$result = pg_query($PG_CONN, $SQL);
DBCheckResult($result, $SQL, __FILE__, __LINE__);
pg_free_result($result);
/* Make sure it was added */
$SQL = "SELECT * FROM users WHERE user_name = '{$User}' LIMIT 1;";
$result = pg_query($PG_CONN, $SQL);
DBCheckResult($result, $SQL, __FILE__, __LINE__);
$row = pg_fetch_assoc($result);
pg_free_result($result);
if (empty($row['user_name'])) {
$text = _("Failed to insert user.");
return $text;
}
/* The user was added, so create their group and make them the admin */
$user_name = $row['user_name'];
$user_pk = $row['user_pk'];
// Add user group
$sql = "insert into groups(group_name) values ('{$user_name}')";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
/* Get new group_pk */
$sql = "select group_pk from groups where group_name='{$user_name}'";
$GroupResult = pg_query($PG_CONN, $sql);
DBCheckResult($GroupResult, $sql, __FILE__, __LINE__);
$GroupRow = pg_fetch_assoc($GroupResult);
$group_pk = $GroupRow['group_pk'];
pg_free_result($GroupResult);
// make user a member of their own group
$sql = "insert into group_user_member(group_fk, user_fk, group_perm) values({$group_pk}, {$user_pk}, 1)";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
pg_free_result($result);
return '';
}
示例12: list_license
function list_license($reference_flag, $nomos_flag)
{
global $PG_CONN;
$sql_statment = "SELECT rf_shortname from license_ref ";
if ($reference_flag) {
$sql_statment .= " where rf_detector_type = 1";
} else {
if ($nomos_flag) {
$sql_statment .= " where rf_detector_type = 2";
}
}
$sql_statment .= " order by rf_shortname";
$result = pg_query($PG_CONN, $sql_statment);
DBCheckResult($result, $sql_statment, __FILE__, __LINE__);
while ($row = pg_fetch_assoc($result)) {
print $row['rf_shortname'] . "\n";
}
pg_free_result($result);
}
示例13: 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'));
}
示例14: GetFileCopyrights
/**
* \brief get all the copyright for a single file or uploadtree
*
* \param $agent_pk - agent id
* \param $pfile_pk - pfile id, (if empty, $uploadtree_pk must be given)
* \param $uploadtree_pk - (used only if $pfile_pk is empty)
* \param $type - copyright statement/url/email
*
* \return Array of file copyright CopyrightArray[ct_pk] = copyright.content
* FATAL if neither pfile_pk or uploadtree_pk were passed in
*/
function GetFileCopyrights($agent_pk, $pfile_pk, $uploadtree_pk, $type)
{
global $PG_CONN;
if (empty($agent_pk)) {
Fatal("Missing parameter: agent_pk", __FILE__, __LINE__);
}
// if $pfile_pk, then return the copyright for that one file
if ($pfile_pk) {
$sql = "SELECT ct_pk, content \n from copyright\n where pfile_fk='{$pfile_pk}' and agent_fk={$agent_pk};";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
} else {
if ($uploadtree_pk) {
// Find lft and rgt bounds for this $uploadtree_pk
$sql = "SELECT lft, rgt, upload_fk FROM uploadtree\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);
$typesql = '';
if ($type && "all" != $type) {
$typesql = "and type = '{$type}'";
}
// Get the copyright under this $uploadtree_pk
$sql = "SELECT ct_pk, content from copyright ,\n (SELECT distinct(pfile_fk) as PF from uploadtree\n where upload_fk={$upload_pk}\n and uploadtree.lft BETWEEN {$lft} and {$rgt}) as SS\n where PF=pfile_fk and agent_fk={$agent_pk} {$typesql};";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
} else {
Fatal("Missing function inputs", __FILE__, __LINE__);
}
}
$CopyrightArray = array();
while ($row = pg_fetch_assoc($result)) {
$CopyrightArray[$row['ct_pk']] = $row["content"];
}
pg_free_result($result);
return $CopyrightArray;
}
示例15: 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":
$upload_id = GetParm("upload", PARM_INTEGER);
if (empty($upload_id)) {
break;
}
global $PG_CONN;
/** check if this upload has been disabled */
$sql = "select * from tag_manage where upload_fk = {$upload_id} and is_disabled = true;";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
$count = pg_num_rows($result);
pg_free_result($result);
if (empty($count)) {
$text = _("Disable");
$V = "<input type='submit' name='manage' value='{$text}'>\n";
} else {
$text = _("Enable");
$V = "<input type='submit' name='manage' value='{$text}'>\n";
}
break;
case "Text":
break;
default:
break;
}
if (!$this->OutputToStdout) {
return $V;
}
print "{$V}";
return;
}