private function listContent() { $listSubFolder = $this->listSubFolder; $listFiles = $this->listFiles; $folderId = $this->request->arg[1]; $page = empty($this->request->arg[2]) ? 1 : $this->request->arg[2]; $limitNum = Config::get('default_file_pager'); $startId = ($page - 1) * $limitNum; $this->data['limitNum'] = $limitNum; $this->data['page'] = $page; import('dao.Folder'); $folder = new Folder(); $myFolder = $folder->getFolder($folderId); if (empty($myFolder)) { goToUrl('/pageNotFound'); } $this->data['currentFolderId'] = $myFolder['fd_id']; if ($listSubFolder) { $options = array('limit' => $limitNum, 'start' => $startId); $subFolders = $folder->getSubFolder($myFolder['fd_id'], $options); foreach ($subFolders as $key => $subFolder) { $defaultCoverThumb = Config::get('default_cover_thumbnail'); $defaultCoverThumb = empty($defaultCoverThumb) ? '/images/default_cover_thumbnail.jpg' : $defaultCoverThumb; $folderCover = $folder->getFolderCover($subFolder['fd_id']); $coverThumb = imageCache::cacheImage($folderCover, 160, 120); $subFolder['thumbnail'] = $coverThumb ? $coverThumb : $defaultCoverThumb; $subFolder['filesNum'] = count($folder->getFilesInFolder($subFolder['fd_id'], array("where" => "and image_type>0"))); $subFolder['subFoldersNum'] = count($folder->getSubFolder($subFolder['fd_id'])); $subFolders[$key] = $subFolder; } $this->data['folders'] = $subFolders; $this->data['subFolderTotal'] = $folder->getSubFolderTotal($folderId); if ($listFiles && count($this->data['subFolderTotal']) > $limitNum) { $this->data['subFolderPager'] = 'more'; } else { $this->data['subFolderPager'] = 'full'; } } if ($listFiles) { $options = array("where" => "and image_type>0", "limit" => $limitNum, 'start' => $startId); $myFiles = $folder->getFilesInFolder($folderId, $options); foreach ($myFiles as $key => $myFile) { $defaultThumb = Config::get('default_thumbnail'); $defaultThumb = empty($defaultThumb) ? '/images/default_thumbnail.jpg' : $defaultThumb; $myThumb = imageCache::cacheImage($myFile['path'], 160, 120); $myFile['thumbnail'] = $myThumb ? $myThumb : $defaultThumb; $myFiles[$key] = $myFile; } //ZDebug::my_print($myFiles, 'files'); $this->data['files'] = $myFiles; $this->data['filesTotal'] = $folder->getFilesInFolderTotal($folderId); if ($listSubFolder && count($this->data['filesTotal']) > $limitNum) { $this->data['filesPager'] = 'more'; } else { $this->data['filesPager'] = 'full'; } } $this->data['currentFolderName'] = $myFolder['name']; $this->data['nav'] = $this->genNav($myFolder, $folder); }
function access($appname, $me) { $me = json_decode($me); $users = $this->em->getRepository('user')->findBy(array('name' => $me->name)); $user = $users[0]; if ($user->verify($me->token)) { goToUrl("/bo"); } }
public function getFileAjax() { $fid = $this->request->arg[2]; $myFile = $this->file->getFile($fid); if (empty($myFile)) { goToUrl('/pageNotFound'); } // Get picture thumbnail $myFile['thumbnail'] = $this->getFileThumbnail($myFile); // Get file connections $fileConnections = $this->getFileConnections($myFile); $myFile['nextFolder'] = $fileConnections['nextFolder']; $myFile['previousFolder'] = $fileConnections['previousFolder']; $myFile['nextFile'] = $fileConnections['nextFile']; $myFile['previousFile'] = $fileConnections['previousFile']; veetreeJson($myFile); }