26 function GetAllTags($Item, $Recurse=
true, $uploadtree_tablename=
"uploadtree")
34 $dbManager = $container->get(
'db.manager');
36 $stmt = __METHOD__.
".$uploadtree_tablename";
37 $sql =
"select true from tag_manage, $uploadtree_tablename u where is_disabled = true and tag_manage.upload_fk = u.upload_fk and u.uploadtree_pk = $1";
38 $tagDisabled = $dbManager->getSingleRow($sql, array($Item), $stmt);
39 if ($tagDisabled !==
false) {
43 $stmt2 = $stmt.
'.lftRgt';
44 $sql =
"select lft,rgt, upload_fk from $uploadtree_tablename where uploadtree_pk=$1";
45 $uploadtree_row = $dbManager->getSingleRow($sql,array($Item), $stmt2);
47 $params = array($Item, $uploadtree_row[
'upload_fk']);
49 $Condition =
" lft between $3 and $4 ";
51 $params[] = $uploadtree_row[
'lft'];
52 $params[] = $uploadtree_row[
'rgt'];
54 $Condition =
" uploadtree.uploadtree_pk=$1 ";
58 $sql =
"SELECT distinct(tag_fk) as tag_pk FROM tag_file, $uploadtree_tablename WHERE tag_file.pfile_fk = {$uploadtree_tablename}.pfile_fk and upload_fk=$2 AND $Condition UNION SELECT tag_fk as tag_pk FROM tag_uploadtree WHERE tag_uploadtree.uploadtree_fk = $1";
60 $stmt1 = $stmt.
'.theTags';
61 $dbManager->prepare($stmt1,
"select tag.tag AS tag_name, tag.tag_pk from tag,($sql) subquery where tag.tag_pk=subquery.tag_pk group by tag.tag_pk, tag.tag");
62 $res = $dbManager->execute($stmt1,$params);
63 $List = $dbManager->fetchAll($res);
64 $dbManager->freeResult($res);
86 $FirstEmpty=
false, $SelElt=
true, $Options=
"")
88 $str =
"\n<select name='$SLName' $Options>\n";
90 $str .=
"<option value='' > \n";
92 foreach ($KeyValArray as $key => $val) {
93 if ($SelElt ==
true) {
94 $SELECTED = ($val == $SelectedVal) ?
"SELECTED" :
"";
96 $SELECTED = ($key == $SelectedVal) ?
"SELECTED" :
"";
101 $str .=
"<option value='$key' $SELECTED>$val\n";
120 $FirstEmpty=
false, $SelElt=
true)
132 $str =
"\n<select name='$SLName'>\n";
134 $str .=
"<option value='' > \n";
136 foreach ($KeyValArray as $key => $val) {
137 if ($SelElt ==
true) {
138 $SELECTED = ($val == $SelectedVal) ?
"SELECTED" :
"";
140 $SELECTED = ($key == $SelectedVal) ?
"SELECTED" :
"";
142 $perm = GetTaggingPerms($_SESSION[
'UserId'],$key);
144 $str .=
"<option value='$key' $SELECTED>$val\n";
158 function TagFilter(&$UploadtreeRows, $tag_pk, $uploadtree_tablename)
160 foreach ($UploadtreeRows as $key=>$UploadtreeRow) {
162 $tags =
GetAllTags($UploadtreeRow[
"uploadtree_pk"],
true, $uploadtree_tablename);
163 foreach ($tags as $tagArray) {
164 if ($tagArray[
'tag_pk'] == $tag_pk) {
172 if ($found ==
false) {
173 unset($UploadtreeRows[$key]);
185 function TagStatus($upload_id)
189 $uploadDao = $container->get(
'dao.upload');
190 if (!$uploadDao->isEditable($upload_id, Auth::getGroupId())) {
195 $sql =
"select tag_manage_pk from tag_manage where upload_fk = $upload_id and is_disabled = true;";
198 $count = pg_num_rows($result);
199 pg_free_result($result);
200 return ($count > 0) ? 0 : 1;
Contains the constants and helpers for authentication of user.
DBCheckResult($result, $sql, $filenm, $lineno)
Check the postgres result for unexpected errors. If found, treat them as fatal.
foreach($Options as $Option=> $OptVal) if(0==$reference_flag &&0==$nomos_flag) $PG_CONN