Commit 0ead800082febeb7b773bf6ba8f97c929de48098
1 parent
06b6d973
Merged in from DEV trunk...
KTS-3154 "new Tags with spaces are created without spaces" Fixed. The spaces were being removed using a str_replace. Committed by: Megan Watson Reviewed by: Jonathan Byrne KTS-3155 "Error when renaming folders that contain special characters" Fixed. Mysql is case insensitive, added a check in the php before returning true. Committed by: Megan Watson Reviewed by: Conrad Vermeulen KTS-3167 "Issue with viewing resolved permissions for all users" Fixed. Added a check for users in subgroups on the resolved permissions per user page. Committed By: Jonathan Byrne Reviewed By: Megan Watson git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@8272 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
3 changed files
with
54 additions
and
7 deletions
lib/foldermanagement/Folder.inc
| ... | ... | @@ -448,12 +448,20 @@ class Folder extends KTEntity { |
| 448 | 448 | * @return true if the folder exists, false otherwise and set $_SESSION["errorMessage"] |
| 449 | 449 | */ |
| 450 | 450 | function folderExistsName($sName, $iParentID) { |
| 451 | - $sQuery = "SELECT id FROM " . KTUtil::getTableName('folders') . " WHERE name = ? AND parent_id = ?";/*ok*/ | |
| 451 | + $sQuery = "SELECT id, name FROM " . KTUtil::getTableName('folders') . " WHERE name = ? AND parent_id = ?";/*ok*/ | |
| 452 | 452 | $aParams = array($sName, $iParentID); |
| 453 | 453 | $res = DBUtil::getResultArray(array($sQuery, $aParams)); |
| 454 | 454 | //var_dump($res); |
| 455 | 455 | if (count($res) != 0) { |
| 456 | - return true; | |
| 456 | + | |
| 457 | + // mysql is case-insensitive - check using php | |
| 458 | + foreach ($res as $folder){ | |
| 459 | + $name = isset($folder['name']) ? $folder['name'] : ''; | |
| 460 | + if($name == $sName){ | |
| 461 | + return true; | |
| 462 | + } | |
| 463 | + } | |
| 464 | + return false; | |
| 457 | 465 | } |
| 458 | 466 | return false; |
| 459 | 467 | } | ... | ... |
lib/users/User.inc
| ... | ... | @@ -504,20 +504,59 @@ class User extends KTEntity { |
| 504 | 504 | $iUserId = $_SESSION['iUserId']; |
| 505 | 505 | } |
| 506 | 506 | |
| 507 | - $pdgTable = KTUtil::getTableName('permission_descriptor_groups'); | |
| 507 | + $pdgTable = KTUtil::getTableName('permission_descriptor_groups'); | |
| 508 | 508 | global $default; |
| 509 | 509 | $uglTable = $default->users_groups_table; |
| 510 | - | |
| 511 | 510 | $sQuery = "SELECT COUNT(*) AS num FROM $pdgTable pd |
| 512 | 511 | INNER JOIN $uglTable ug ON ug.group_id = pd.group_id |
| 513 | 512 | WHERE pd.descriptor_id = ? AND ug.user_id = ?"; |
| 514 | 513 | |
| 515 | 514 | $aParams = array($oPermissionDescriptor->getID(), $iUserId); |
| 516 | 515 | $res = DBUtil::getOneResultKey(array($sQuery, $aParams), 'num'); |
| 516 | + | |
| 517 | 517 | if (PEAR::isError($res) || empty($res)) { |
| 518 | - return false; | |
| 518 | + | |
| 519 | + $aSubGrpOneParams = array($oPermissionDescriptor->getID()); | |
| 520 | + | |
| 521 | + //Checking if user is in a subgroup | |
| 522 | + //Query One is the get any groups with permissions | |
| 523 | + $sSubGrpQueryOne = "SELECT group_id FROM $pdgTable pd | |
| 524 | + WHERE pd.descriptor_id = ?"; | |
| 525 | + $aSubRes = DBUtil::getResultArrayKey(array($sSubGrpQueryOne, $aSubGrpOneParams), 'group_id'); | |
| 526 | + | |
| 527 | + if(!(PEAR::isError($aSubRes) || empty($aSubRes))) | |
| 528 | + { | |
| 529 | + $list = implode(',', $aSubRes); | |
| 530 | + | |
| 531 | + $sSubGroupTable = KTUtil::getTableName('groups_groups_link'); | |
| 532 | + $aParams = array($iUserId); | |
| 533 | + | |
| 534 | + //Query two is to check if the current user's group is a sub group of the | |
| 535 | + //group with permissions | |
| 536 | + $sSubGrpQueryTwo = "SELECT COUNT(member_group_id) count FROM $sSubGroupTable ggl | |
| 537 | + INNER JOIN users_groups_link ugl ON (ugl.group_id = ggl.member_group_id) | |
| 538 | + WHERE ugl.user_id = ? AND parent_group_id IN ($list)"; | |
| 539 | + $aSubResTwo = DBUtil::getOneResultKey(array($sSubGrpQueryTwo, $aParams), 'count'); | |
| 540 | + | |
| 541 | + if(PEAR::isError($aSubResTwo) || empty($aSubResTwo)) | |
| 542 | + { | |
| 543 | + return false; | |
| 544 | + } | |
| 545 | + else | |
| 546 | + { | |
| 547 | + return true; | |
| 548 | + } | |
| 549 | + } | |
| 550 | + else | |
| 551 | + { | |
| 552 | + return false; | |
| 553 | + } | |
| 554 | + | |
| 555 | + } | |
| 556 | + else | |
| 557 | + { | |
| 558 | + return true; | |
| 519 | 559 | } |
| 520 | - return true; | |
| 521 | 560 | } |
| 522 | 561 | } |
| 523 | 562 | ?> |
| 524 | 563 | \ No newline at end of file | ... | ... |
plugins/tagcloud/TagCloudTriggers.php
| ... | ... | @@ -87,7 +87,7 @@ class KTAddDocumentTrigger { |
| 87 | 87 | } |
| 88 | 88 | if($tagString != ''){ |
| 89 | 89 | $words_table = KTUtil::getTableName('tag_words'); |
| 90 | - $tagString = str_replace(' ', '', $tagString); | |
| 90 | + $tagString = str_replace(' ', ' ', $tagString); | |
| 91 | 91 | $tags = explode(',',$tagString); |
| 92 | 92 | |
| 93 | 93 | $aTagIds = array(); | ... | ... |