1
0

Implement Dashboard into the core

Update-Notifier, future Entries, new comments so far
This commit is contained in:
onli
2013-06-23 19:47:14 +02:00
parent f2e39bf9be
commit 80a34b036d
4 changed files with 131 additions and 35 deletions

View File

@ -4,41 +4,40 @@ if (IN_serendipity !== true) {
die ("Don't hack!");
}
global $serendipity;
$user = serendipity_fetchAuthor($serendipity['authorid']);
// old s9y variant
// $bookmarklet = "javascript:bm=document.selection?document.selection.createRange().text:document.getSelection();void(newwin=open('" . $serendipity['baseURL'] . "serendipity_admin.php?serendipity[adminModule]=entries&serendipity[adminAction]=new&serendipity[title]='+escape(document.title)+'&serendipity[body]='+escape(bm)+'&serendipity[url]='+escape(location.href),'new_log_entry','resizable=yes,scrollbars=yes,width=800,height=600,location=yes,status=yes'));newwin.focus();";
// non-popup variant
$bookmarklet = "javascript:if(navigator.userAgent.indexOf('Safari')%20>=%200){Q=getSelection();}else{Q=document.selection?document.selection.createRange().text:document.getSelection();}location.href='" . $serendipity['baseURL'] . "'+encodeURIComponent(document.title)+'encodeURIComponent(Q)+''+encodeURIComponent(location.href)";
// chrome-compatible, from Oliver Gassner, adapted from TextPattern. Hi guys, keep it up. :-)
$bookmarklet = "javascript:var%20d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='" . $serendipity['baseURL'] . "',l=d.location,e=encodeURIComponent,p='serendipity_admin.php?serendipity[adminModule]=entries&serendipity[adminAction]=new&serendipity[title]='+e(d.title)+'&serendipity[body]='+e(s)+'&serendipity[url]='+location.href,u=f+p;a=function(){%20%20if(!w.open(u,'t','toolbar=0,resizable=1,scrollbars=1,status=1,width=800,height=800'))%20%20%20%20l.href=u;};if(/Firefox/.test(navigator.userAgent))%20%20setTimeout(a,0);else%20%20a();void(0)";
$output = array(
'welcome' => WELCOME_BACK . ' ' . htmlspecialchars($user[0]['realname']),
'show_links' => true,
'links_title' => FURTHER_LINKS,
'bookmarklet' => $bookmarklet,
'links' => array(
'<a href="http://www.s9y.org/">' . FURTHER_LINKS_S9Y . '</a>',
'<a href="http://www.s9y.org/33.html">' . FURTHER_LINKS_S9Y_DOCS . '</a>',
'<a href="http://blog.s9y.org/">' . FURTHER_LINKS_S9Y_BLOG . '</a>',
'<a href="http://www.s9y.org/forums/">' . FURTHER_LINKS_S9Y_FORUMS . '</a>',
'<a href="http://spartacus.s9y.org/">' . FURTHER_LINKS_S9Y_SPARTACUS . '</a>',
'<a href="' . $bookmarklet . '" onclick="alert(\'' . FURTHER_LINKS_S9Y_BOOKMARKLET_DESC . '\'); return false;" title="' . FURTHER_LINKS_S9Y_BOOKMARKLET_DESC . '">' . FURTHER_LINKS_S9Y_BOOKMARKLET . '</a>'
),
'links_css' => 'further_links',
'more' => ''
);
$data = array();
$data['bookmarklet'] = $bookmarklet;
$data['username'] = $user[0]['realname'];
$output = array();
serendipity_plugin_api::hook_event('backend_frontpage_display', $output);
$data['backend_frontpage_display'] = $output['more'];
$data['output'] = $output;
$data['curVersion'] = serendipity_getCurrentVersion();
$data['usedVersion'] = $serendipity['version'];
$data['update'] = version_compare($data['usedVersion'], $data['curVersion'], '<');
if (!is_object($serendipity['smarty'])) {
serendipity_smarty_init();
}
$data['comments'] = serendipity_db_query("SELECT c.*, e.title FROM {$serendipity['dbPrefix']}comments c
LEFT JOIN {$serendipity['dbPrefix']}entries e ON (e.id = c.entry_id)
ORDER BY c.id DESC LIMIT 5");
$data['entries'] = serendipity_fetchEntries(
false,
false,
5,
true,
false,
'timestamp DESC',
'e.timestamp >= ' . serendipity_serverOffsetHour()
);
$data['token'] = serendipity_setFormToken('url');
echo serendipity_smarty_show('admin/overview.inc.tpl', $data);