} } else { OCP\Util::addStyle('files_sharing', 'public'); OCP\Util::addScript('files_sharing', 'public'); OCP\Util::addScript('files', 'fileactions'); $tmpl = new OCP\Template('files_sharing', 'public', 'base'); $tmpl->assign('owner', $uidOwner); // Show file list if (OC_Filesystem::is_dir($path)) { OCP\Util::addStyle('files', 'files'); OCP\Util::addScript('files', 'files'); OCP\Util::addScript('files', 'filelist'); $files = array(); $rootLength = strlen($baseDir) + 1; foreach (OC_Files::getDirectoryContent($path) as $i) { $i['date'] = OCP\Util::formatDate($i['mtime']); if ($i['type'] == 'file') { $fileinfo = pathinfo($i['name']); $i['basename'] = $fileinfo['filename']; $i['extension'] = isset($fileinfo['extension']) ? '.' . $fileinfo['extension'] : ''; } $i['directory'] = '/' . substr('/' . $uidOwner . '/files' . $i['directory'], $rootLength); if ($i['directory'] == '/') { $i['directory'] = ''; } $i['permissions'] = OCP\Share::PERMISSION_READ; $files[] = $i; } // Make breadcrumb $breadcrumb = array(); $pathtohere = '';
$RUNTIME_APPTYPES = array('filesystem'); // Init owncloud OCP\JSON::checkLoggedIn(); // Load the files $dir = isset($_GET['dir']) ? $_GET['dir'] : ''; $doBreadcrumb = isset($_GET['breadcrumb']) ? true : false; $data = array(); // Make breadcrumb if ($doBreadcrumb) { $breadcrumb = array(); $pathtohere = "/"; foreach (explode("/", $dir) as $i) { if ($i != "") { $pathtohere .= "{$i}/"; $breadcrumb[] = array("dir" => $pathtohere, "name" => $i); } } $breadcrumbNav = new OCP\Template("files", "part.breadcrumb", ""); $breadcrumbNav->assign("breadcrumb", $breadcrumb); $data['breadcrumb'] = $breadcrumbNav->fetchPage(); } // make filelist $files = array(); foreach (OC_Files::getdirectorycontent($dir) as $i) { $i["date"] = OCP\Util::formatDate($i["mtime"]); $files[] = $i; } $list = new OCP\Template("files", "part.list", ""); $list->assign("files", $files, false); $data = array('files' => $list->fetchPage()); OCP\JSON::success(array('data' => $data));
<div id="history"> <?php if (isset($_['message'])) { if (isset($_['path'])) { print_unescaped('<strong>File: ' . OC_Util::sanitizeHTML($_['path']) . '</strong><br>'); } print_unescaped('<strong>' . OC_Util::sanitizeHTML($_['message']) . '</strong><br>'); } else { if (isset($_['outcome_stat'])) { print_unescaped('<div id="feedback-messages" class="' . OC_Util::sanitizeHTML($_['outcome_stat']) . '"><h3>' . OC_Util::sanitizeHTML($_['outcome_msg']) . '</h3></div><br>'); } print_unescaped('<strong>Versions of ' . OC_Util::sanitizeHTML($_['path']) . '</strong><br>'); print_unescaped('<p><em>' . OC_Util::sanitizeHTML($l->t('Revert a file to a previous version by clicking on its revert button')) . '</em></p><br />'); foreach ($_['versions'] as $v) { p(' '); p(OCP\Util::formatDate(doubleval($v['version']))); print_unescaped(' <a href="' . OCP\Util::linkTo('files_versions', 'history.php', array('path' => $_['path'], 'revert' => $v['version'])) . '" class="button">Revert</a><br /><br />'); if ($v['cur']) { print_unescaped(' (<b>Current</b>)'); } print_unescaped('<br /><br />'); } } ?> </div>
<?php OCP\JSON::checkAppEnabled('files_versions'); $source = $_GET['source']; list($uid, $filename) = OCA\Files_Versions\Storage::getUidAndFilename($source); $count = 5; //show the newest revisions if ($versions = OCA\Files_Versions\Storage::getVersions($uid, $filename, $count)) { $versionsFormatted = array(); foreach ($versions as $version) { $versionsFormatted[] = OCP\Util::formatDate($version['version']); } $versionsSorted = array_reverse($versions); if (!empty($versionsSorted)) { OCP\JSON::encodedPrint($versionsSorted); } } else { return; }
$pos = strrpos($tmp, '.d'); $timestamp = substr($tmp, $pos + 2); $result[] = array('id' => $entryName, 'timestamp' => $timestamp, 'mime' => $view->getMimeType($dir . '/' . $entryName), 'type' => $view->is_dir($dir . '/' . $entryName) ? 'dir' : 'file', 'location' => $dir); } } closedir($dirContent); } else { $dirlisting = false; $query = \OC_DB::prepare('SELECT `id`,`location`,`timestamp`,`type`,`mime` FROM `*PREFIX*files_trash` WHERE `user` = ?'); $result = $query->execute(array($user))->fetchAll(); } $files = array(); foreach ($result as $r) { $i = array(); $i['name'] = $r['id']; $i['date'] = OCP\Util::formatDate($r['timestamp']); $i['timestamp'] = $r['timestamp']; $i['mimetype'] = $r['mime']; $i['type'] = $r['type']; if ($i['type'] == 'file') { $fileinfo = pathinfo($r['id']); $i['basename'] = $fileinfo['filename']; $i['extension'] = isset($fileinfo['extension']) ? '.' . $fileinfo['extension'] : ''; } $i['directory'] = $r['location']; if ($i['directory'] == '/') { $i['directory'] = ''; } $i['permissions'] = OCP\PERMISSION_READ; $files[] = $i; }
p($a['filename'] . " (" . OCP\Util::humanFileSize($a['size']) . ")"); } ?> </td> <td> <img src="<?php echo OCP\Util::imagePath('mail', 'reply.png'); ?> " /> <img src="<?php echo OCP\Util::imagePath('mail', 'reply-all.png'); ?> " /> <img src="<?php echo OCP\Util::imagePath('mail', 'forward.png'); ?> " /> <br/> <?php p(OCP\Util::formatDate($_['message']['date'])); ?> </td> </tr> <tr id="mail_message"> <td colspan="3" class="mail_message_body"> <?php echo $_['message']['body']; ?> </td> </tr>
OCP\User::checkLoggedIn(); OCP\Util::addStyle('files_versions', 'versions'); $tmpl = new OCP\Template('files_versions', 'history', 'user'); if (isset($_GET['path'])) { $path = $_GET['path']; $path = $path; $tmpl->assign('path', $path); $versions = new OCA_Versions\Storage(); // roll back to old version if button clicked if (isset($_GET['revert'])) { if ($versions->rollback($path, $_GET['revert'])) { $tmpl->assign('outcome_stat', 'success'); $tmpl->assign('outcome_msg', "File {$_GET['path']} was reverted to version " . OCP\Util::formatDate(doubleval($_GET['revert']))); } else { $tmpl->assign('outcome_stat', 'failure'); $tmpl->assign('outcome_msg', "File {$_GET['path']} could not be reverted to version " . OCP\Util::formatDate(doubleval($_GET['revert']))); } } // show the history only if there is something to show if (OCA_Versions\Storage::isversioned($path)) { $count = 999; //show the newest revisions $versions = OCA_Versions\Storage::getVersions($path, $count); $tmpl->assign('versions', array_reverse($versions)); } else { $tmpl->assign('message', 'No old versions available'); } } else { $tmpl->assign('message', 'No path specified'); } $tmpl->printPage();
// create file $_file = $result->fileData; // discard versions if (strpos($_file['path'], '_versions') === 0) { continue; } // get basename and extension $fileinfo = pathinfo($_file['name']); $_file['basename'] = $fileinfo['filename']; if (!empty($fileinfo['extension'])) { $_file['extension'] = '.' . $fileinfo['extension']; } else { $_file['extension'] = ''; } // get date $_file['date'] = OCP\Util::formatDate($_file['mtime']); // get directory $_file['directory'] = str_replace('/' . $_file['name'], '', $_file['path']); // get permissions $_file['type'] = $_file['mimetype'] == 'httpd/unix-directory' ? 'dir' : 'file'; $permissions = OCP\PERMISSION_READ; if (!$_file['encrypted']) { $permissions |= OCP\PERMISSION_SHARE; } if ($_file['type'] == 'dir' && $_file['writable']) { $permissions |= OCP\PERMISSION_CREATE; } if ($_file['writable']) { $permissions |= OCP\PERMISSION_UPDATE | OCP\PERMISSION_DELETE; } $_file['permissions'] = $permissions;
<?php foreach ($_['messages'] as $message) { ?> <tr class="mail_message_summary" data-message_id="<?php echo $message['id']; ?> "> <td class="mail_message_summary_from"><?php echo $message['from']; ?> </td> <td class="mail_message_summary_subject"><?php echo $message['subject']; ?> </td> <td class="mail_message_summary_date"><?php echo OCP\Util::formatDate($message['date']); ?> </td> </tr> <?php }
OCP\Util::addStyle('files_versions', 'versions'); $tmpl = new OCP\Template('files_versions', 'history', 'user'); $l = OC_L10N::get('files_versions'); if (isset($_GET['path'])) { $path = $_GET['path']; $tmpl->assign('path', $path); $versions = new OCA\Files_Versions\Storage(); // roll back to old version if button clicked if (isset($_GET['revert'])) { if ($versions->rollback($path, $_GET['revert'])) { $tmpl->assign('outcome_stat', $l->t('success')); $message = $l->t('File %s was reverted to version %s', array($_GET['path'], OCP\Util::formatDate(doubleval($_GET['revert'])))); $tmpl->assign('outcome_msg', $message); } else { $tmpl->assign('outcome_stat', $l->t('failure')); $message = $l->t('File %s could not be reverted to version %s', array($_GET['path'], OCP\Util::formatDate(doubleval($_GET['revert'])))); $tmpl->assign('outcome_msg', $message); } } // show the history only if there is something to show $count = 999; //show the newest revisions list($uid, $filename) = OCA\Files_Versions\Storage::getUidAndFilename($path); if ($versions = OCA\Files_Versions\Storage::getVersions($uid, $filename, $count)) { $tmpl->assign('versions', array_reverse($versions)); } else { $tmpl->assign('message', $l->t('No old versions available')); } } else { $tmpl->assign('message', $l->t('No path specified')); }
<div id="history"> <?php if (isset($_['message'])) { if (isset($_['path'])) { echo '<strong>File: ' . $_['path'] . '</strong><br>'; } echo '<strong>' . $_['message'] . '</strong><br>'; } else { if (isset($_['outcome_stat'])) { echo '<div id="feedback-messages" class="' . $_['outcome_stat'] . '"><h3>' . $_['outcome_msg'] . '</h3></div><br>'; } echo '<strong>Versions of ' . $_['path'] . '</strong><br>'; echo '<p><em>Revert a file to a previous version by clicking on its revert button</em></p><br />'; foreach ($_['versions'] as $v) { echo ' '; echo OCP\Util::formatDate($v); echo ' <a href="' . OCP\Util::linkTo('files_versions', 'history.php') . '?path=' . urlencode($_['path']) . '&revert=' . $v . '" class="button">Revert</a><br /><br />'; } } ?> </div>