<button id="btnCollapseAll"><?php p($l->t('Collapse all')); ?> </button> <?php p($l->t('Owner:')); ?> <select name="menuOwnName" id="menuOwnName" disabled="true"> <option value='' disabled='disabled' selected='selected'><?php p($l->t('Not set')); ?> </option> <?php $usersList = \OCA\OCLife\utilities::getUsers(NULL, TRUE); foreach ($usersList as $uid => $userName) { printf("<option value='%s'>%s</option>'", $uid, is_null($userName) ? $uid : $userName); } ?> </select> <select name="menuOwnPriv" id="menuOwnPriv" disabled="true"> <option value="OwnRO"><?php p($l->t('Read only')); ?> </option> <option value="OwnRW"><?php p($l->t('Can modify')); ?>
* [encrypted] => 1 * [unencrypted_size] => 3981786 * [etag] => 52c326b169ba4 * [permissions] => 27 ) */ $fileInfos = \OC\Files\Filesystem::getFileInfo($filePath); $thumbPath = OCP\Util::linkToAbsolute('oclife', 'getThumbnail.php', array('filePath' => $filePath)); $preview = '<img style="border: 1px solid black; display: block;" src="' . $thumbPath . '" />'; $infos = array(); $infos[] = '<strong>' . $l->t('File name') . ': </strong>' . $fileInfos['name']; $infos[] = '<strong>MIME: </strong>' . $fileInfos['mimetype']; $infos[] = '<strong>' . $l->t('Size') . ': </strong>' . \OCA\OCLife\utilities::formatBytes($fileInfos['size'], 2, TRUE); $infos[] = '<strong>' . $l->t('When added') . ': </strong>' . \OCP\Util::formatDate($fileInfos['storage_mtime']); $infos[] = '<strong>' . $l->t('Encrypted? ') . '</strong>' . ($fileInfos['encrypted'] === TRUE ? $l->t('Yes') : $l->t('No')); if ($fileInfos['encrypted']) { $infos[] = '<strong>' . $l->t('Unencrypted size') . ': </strong>' . \OCA\OCLife\utilities::formatBytes($fileInfos['unencrypted_size'], 2, TRUE); } // Output basic infos $htmlInfos = implode('<br />', $infos); // Check for EXIF data // Get current user $user = \OCP\User::getUser(); $viewPath = '/' . $user . '/files'; $view = new \OC\Files\View($viewPath); $imageLocalPath = $view->getLocalFile($filePath); $exifHandler = new OCA\OCLife\exifHandler($imageLocalPath); $allInfos = $exifHandler->getExifData(); $ifd0Infos = isset($allInfos['IFD0']) ? $allInfos['IFD0'] : array(); $exifInfos = isset($allInfos['EXIF']) ? $allInfos['EXIF'] : array(); $fullInfoArray = array_merge($ifd0Infos, $exifInfos); if (is_array($fullInfoArray)) {
/** * Check if provided tag id can be read by the provided user * @param $tagid integer Tag id * @param $user string Actual user; NULL pickup actual logged in user * @return boolean TRUE if permission is valid, false otherwise */ public static function readAllowed($tagid, $user = NULL) { // If owner is not set, assign the actual username if ($user === NULL) { $user = \OCP\User::getUser(); } // If user is an administrator, read is allowed if (\OC_User::isAdminUser(\OCP\User::getUser())) { return TRUE; } // Query for actual tag's owner and permission $sql = "SELECT `owner`, `permission` FROM `*PREFIX*oclife_tags` WHERE `id`=?"; $args = array($tagid); $query = \OCP\DB::prepare($sql); $resRsrc = $query->execute($args); $owner = NULL; $permission = NULL; while ($row = $resRsrc->fetchRow()) { // Legacy check on user and permission $permission = \OCA\OCLife\hTags::getPermission($row['permission']); $owner = isset($row['owner']) ? $row['owner'] : $user; } // Check if worldwide readable if (substr($permission, 4, 1) === 'r') { return TRUE; } // Check for operating on owner's tag if ($user === $owner) { return substr($permission, 0, 1) === 'r' ? TRUE : FALSE; } // Check for tags owned by group's companion where $user belongs to if (substr($permission, 2, 1) === 'r') { $userCompanion = \OCA\OCLife\utilities::getUsers($user); $groupPos = in_array($owner, $userCompanion); return $groupPos === FALSE ? FALSE : TRUE; } else { return FALSE; } }
* oclife is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with oclife. If not, see <http://www.gnu.org/licenses/>. */ \OCP\JSON::callCheck(); \OCP\JSON::checkLoggedIn(); \OCP\JSON::checkAppEnabled('oclife'); $ctags = new \OCA\OCLife\hTags(); $JSONtags = filter_input(INPUT_POST, 'tags', FILTER_SANITIZE_URL); // Look for selected tag and child $tags = json_decode($JSONtags); $tagsToSearch = array(); foreach ($tags as $tag) { $tagID = intval($tag->key); $partTags = $ctags->getAllChildID($tagID); foreach ($partTags as $tag) { $tagsToSearch[] = intval($tag); } } // Look for files with that tag $filesIDs = \OCA\OCLife\hTags::getFileWithTagArray($tagsToSearch); $fileData = \OCA\OCLife\utilities::getFileInfoFromID(OCP\User::getUser(), $filesIDs); $result = ''; foreach ($fileData as $file) { $result .= \OCA\OCLife\utilities::prepareTile($file); } echo $result;
private static function getOC7FileList($user, $path, $onlyID, $indexed) { $result = array(); $dirView = new \OC\Files\View('/' . $user); $dirContent = $dirView->getDirectoryContent($path); foreach ($dirContent as $item) { $fileID = $item->getId(); $fileMime = $item->getMimetype(); $fileName = $item->getName(); $filePath = substr($item->getPath(), strlen($user) + 2); $itemRes = array(); if (strpos($fileMime, 'directory') === FALSE) { $fileData = array('fileid' => $fileID, 'name' => $fileName, 'mimetype' => $fileMime, 'path' => $filePath); $itemRes[] = $onlyID ? $fileID : $fileData; } else { $itemRes = \OCA\OCLife\utilities::getOC7FileList($user, $filePath, $onlyID, $indexed); } foreach ($itemRes as $item) { if ($onlyID) { $result[] = intval($item); } else { if ($indexed) { $result[intval($item['fileid'])] = $item; } else { $result[] = $item; } } } } return $result; }