login/pass: error messages below page title
[minimedit.git] / edit / head.inc.php
1 <?php
2 if (file_exists($Page->file) and !is_writable($Page->file)) {
3         return;
4 }
5
6 if (!isset($Page->raw)) {
7         # open bottom template as initial contents
8         $template = 'template.inc.html';
9         if ($Page->handler and file_exists("{$Page->handler}/$template")) {
10                 $template = "{$Page->handler}/$template";
11         }
12         $Page->raw($template);
13         $Page->meta['article:published_time'] = date('Y-m-d h:i:s O');
14         $Page->meta['article:author'] = '/' . $User->dir;
15         $Page->body = NULL;
16 }
17
18 if (isset($Page->raw)) {
19         # restore meta tags in static contents for editing
20         foreach (array_reverse($Page->meta) as $metaprop => $val) {
21                 $Page->raw = sprintf(
22                         '<meta property="%s" content="%s">'."\n",
23                         $metaprop, $val
24                 ) . $Page->raw;
25         }
26 }
27
28 ob_start();
29 if ($csssrc = '/admin.css' and file_exists(DOCROOT . $csssrc)) {
30         printf('<link rel="stylesheet" type="text/css" href="%s" />'."\n", $csssrc);
31 }
32 $ckesrc = '/lib/ckeditor'; # local install
33 if (!file_exists(DOCROOT . $ckesrc)) {
34         $ckesrc = '//cdn.ckeditor.com/4.15.1/full-all'; # remote fallback
35 }
36 printf('<script src="/edit/page.js" data-ckesrc="%s"></script>'."\n", "$ckesrc/ckeditor.js");
37 $Page->head = ob_get_clean();
38