first commit
This commit is contained in:
27
admin/preview.php
Executable file
27
admin/preview.php
Executable file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
include 'common.php';
|
||||
|
||||
/** 获取内容 Widget */
|
||||
\Widget\Archive::alloc('type=single&checkPermalink=0&preview=1')->to($content);
|
||||
|
||||
/** 检测是否存在 */
|
||||
if (!$content->have()) {
|
||||
$response->redirect($options->adminUrl);
|
||||
}
|
||||
|
||||
/** 检测权限 */
|
||||
if (!$user->pass('editor', true) && $content->authorId != $user->uid) {
|
||||
$response->redirect($options->adminUrl);
|
||||
}
|
||||
|
||||
/** 输出内容 */
|
||||
$content->render();
|
||||
?>
|
||||
<script>
|
||||
window.onbeforeunload = function () {
|
||||
if (!!window.parent) {
|
||||
window.parent.postMessage('cancelPreview', '<?php $options->rootUrl(); ?>');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user