no links for entries in the future
This commit is contained in:
parent
dc6a58cb57
commit
19fbb1ebdf
2 changed files with 16 additions and 9 deletions
|
@ -32,7 +32,6 @@
|
||||||
|
|
||||||
function get_entries() {
|
function get_entries() {
|
||||||
global $serendipity;
|
global $serendipity;
|
||||||
$andFutureCondition = serendipity_db_bool($serendipity['showFutureEntries']) ? '' : 'AND timestamp <= ' . serendipity_db_time();
|
|
||||||
$entries = [];
|
$entries = [];
|
||||||
foreach ($this->simple_query(
|
foreach ($this->simple_query(
|
||||||
"SELECT e.id, e.title, p.permalink, e.timestamp, LENGTH(e.body) AS size, a.realname, eplat.value AS lat, eplng.value AS lng
|
"SELECT e.id, e.title, p.permalink, e.timestamp, LENGTH(e.body) AS size, a.realname, eplat.value AS lat, eplng.value AS lng
|
||||||
|
@ -41,13 +40,15 @@
|
||||||
JOIN {$serendipity['dbPrefix']}entryproperties eplng ON (eplng.entryid = e.id AND eplng.property = 'geo_long')
|
JOIN {$serendipity['dbPrefix']}entryproperties eplng ON (eplng.entryid = e.id AND eplng.property = 'geo_long')
|
||||||
JOIN {$serendipity['dbPrefix']}permalinks p ON (p.entry_id = e.id AND p.type = 'entry')
|
JOIN {$serendipity['dbPrefix']}permalinks p ON (p.entry_id = e.id AND p.type = 'entry')
|
||||||
JOIN {$serendipity['dbPrefix']}authors a ON a.authorid = e.authorid
|
JOIN {$serendipity['dbPrefix']}authors a ON a.authorid = e.authorid
|
||||||
WHERE e.isdraft = 'false' $andFutureCondition
|
WHERE e.isdraft = 'false'
|
||||||
ORDER BY e.timestamp",
|
ORDER BY e.timestamp",
|
||||||
false, 'assoc'
|
false, 'assoc'
|
||||||
) as $row) {
|
) as $row) {
|
||||||
$entries[$row['id']] = [
|
$entries[$row['id']] = [
|
||||||
'title' => $row['title'],
|
'title' => $row['title'],
|
||||||
'url' => $serendipity['serendipityHTTPPath'].$row['permalink'],
|
'url' => serendipity_db_bool($serendipity['showFutureEntries']) || $row['timestamp'] <= serendipity_db_time()
|
||||||
|
? $serendipity['serendipityHTTPPath'].$row['permalink']
|
||||||
|
: null,
|
||||||
'date' => $row['timestamp'],
|
'date' => $row['timestamp'],
|
||||||
'size' => $row['size'],
|
'size' => $row['size'],
|
||||||
'author' => $row['realname'],
|
'author' => $row['realname'],
|
||||||
|
@ -61,7 +62,7 @@
|
||||||
JOIN {$serendipity['dbPrefix']}entries e ON e.id = ec.entryid
|
JOIN {$serendipity['dbPrefix']}entries e ON e.id = ec.entryid
|
||||||
JOIN {$serendipity['dbPrefix']}entryproperties eplat ON (eplat.entryid = ec.entryid AND eplat.property = 'geo_lat')
|
JOIN {$serendipity['dbPrefix']}entryproperties eplat ON (eplat.entryid = ec.entryid AND eplat.property = 'geo_lat')
|
||||||
JOIN {$serendipity['dbPrefix']}entryproperties eplng ON (eplng.entryid = ec.entryid AND eplng.property = 'geo_long')
|
JOIN {$serendipity['dbPrefix']}entryproperties eplng ON (eplng.entryid = ec.entryid AND eplng.property = 'geo_long')
|
||||||
WHERE e.isdraft = 'false' $andFutureCondition"
|
WHERE e.isdraft = 'false'"
|
||||||
) as $row) {
|
) as $row) {
|
||||||
$entries[$row['entryid']]['categories'][] = $row['categoryid'];
|
$entries[$row['entryid']]['categories'][] = $row['categoryid'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,12 +89,18 @@ window.onload = () => {
|
||||||
|
|
||||||
map.on("singleclick", event => {
|
map.on("singleclick", event => {
|
||||||
const makeItem = object => {
|
const makeItem = object => {
|
||||||
const a = document.createElement("a");
|
const title = document.createTextNode(object.title);
|
||||||
a.appendChild(document.createTextNode(object.title));
|
|
||||||
a.setAttribute("href", object.url);
|
|
||||||
a.setAttribute("title", (object.author !== undefined ? object.author + ", " : "") + new Date(object.date * 1000).toLocaleString(undefined, {year: "numeric", month: "long", day: "2-digit", hour: "2-digit", minute: "2-digit"}));
|
|
||||||
const li = document.createElement("li");
|
const li = document.createElement("li");
|
||||||
li.appendChild(a);
|
li.appendChild(object.url !== null
|
||||||
|
? (() => {
|
||||||
|
const a = document.createElement("a");
|
||||||
|
a.appendChild(title);
|
||||||
|
a.setAttribute("href", object.url);
|
||||||
|
a.setAttribute("title", (object.author !== undefined ? object.author + ", " : "") + new Date(object.date * 1000).toLocaleString(undefined, {year: "numeric", month: "long", day: "2-digit", hour: "2-digit", minute: "2-digit"}));
|
||||||
|
return a;
|
||||||
|
})()
|
||||||
|
: title
|
||||||
|
)
|
||||||
return li;
|
return li;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue