* @access public
* @param int The ID of the entry
* @param string How many trackbacks to show
- * @param boolean If true, also non-approved trackbacks will be shown
+ * @param boolean If true, also non-approved trackbacks will be shown
* @return
*/
function serendipity_fetchTrackbacks($id, $limit = null, $showAll = false) {
* page: (int) The number of the page for paginating entries
* id: (int) The ID of an entry. If given, only a single entry will be fetched. If left empty, multiple entries are fetched.
* range: (mixed) Restricts fetching entries to a specific timespan. Behaves differently depending on the type:
- * Numeric:
- * YYYYMMDD - Shows all entries from YYYY-MM-DD.
- * If DD is "00", it will show all entries from that month.
+ * Numeric:
+ * YYYYMMDD - Shows all entries from YYYY-MM-DD.
+ * If DD is "00", it will show all entries from that month.
* If DD is any other number, it will show entries of that specific day.
* 2-Dimensional Array:
* Key #0 - Specifies the start timestamp (unix seconds)
* Key #1 - Specifies the end timestamp (unix seconds)
* Other (null, 3-dimensional Array, ...):
- * Entries newer than $modified_since will be fetched
+ * Entries newer than $modified_since will be fetched
* full (boolean) Indicates if the full entry will be fetched (body+extended: TRUE), or only the body (FALSE).
* limit (string) Holds a "Y" or "X, Y" string that tells which entries to fetch. X is the first entry offset, Y is number of entries. If not set, the global fetchLimit will be applied (15 entries by default)
* fetchDrafts (boolean) Indicates whether drafts should be fetched (TRUE) or not
* filter_sql (string) Can contain any SQL code to inject into the central SQL statement for fetching the entry
* noCache (boolean) If set to TRUE, all entries will be fetched from scratch and any caching is ignored
* noSticky (boolean) If set to TRUE, all sticky entries will NOT be fetched.
- *
+ *
* [PRINTING]
* template: (string) Name of the template file to print entries with
* preview: (boolean) Indicates if this is a preview
if (empty($params['template'])) {
$params['template'] = 'entries.tpl';
}
-
+
if (empty($params['range'])) {
$params['range'] = null;
}
if (empty($params['full'])) {
$params['full'] = true;
}
-
+
if (empty($params['fetchDrafts'])) {
$params['fetchDrafts'] = false;
}
if (empty($params['preview'])) {
$params['preview'] = false;
}
-
+
if (empty($params['block'])) {
$params['block'] = 'smarty_entries_' . $entrycount;
}
if (empty($params['use_footer'])) {
$params['use_footer'] = false;
}
-
+
if (empty($params['groupmode'])) {
$params['groupmode'] = 'date';
}
-
+
if (empty($params['skip_smarty_hooks'])) {
$params['skip_smarty_hooks'] = true;
}
$old_var['short_archives'] = $serendipity['short_archives'];
$serendipity['short_archives'] = $params['short_archives'];
}
-
+
$old_var['skip_smarty_hooks'] = $serendipity['skip_smarty_hooks'];
$serendipity['skip_smarty_hooks'] = $params['skip_smarty_hooks'];
if (!empty($params['id'])) {
$entry = serendipity_fetchEntry(
- 'id',
- (int)$params['id'],
- $params['full'],
+ 'id',
+ (int)$params['id'],
+ $params['full'],
$params['fetchDrafts']);
} else {
$entry = serendipity_fetchEntries(
- $params['range'],
- $params['full'],
- $params['limit'],
- $params['fetchDrafts'],
- $params['modified_since'],
- $params['orderby'],
- $params['filter_sql'],
- $params['noCache'],
+ $params['range'],
+ $params['full'],
+ $params['limit'],
+ $params['fetchDrafts'],
+ $params['modified_since'],
+ $params['orderby'],
+ $params['filter_sql'],
+ $params['noCache'],
$params['noSticky']
);
-
+
// Check whether the returned entries shall be grouped specifically
switch ($params['groupmode']) {
case 'date':
// No regrouping required, printEntries() does it for us.
break;
-
+
case 'category':
// Regroup by primary category
$params['use_footer'],
($params['groupmode'] == 'date' ? true : false) // Grouping of $entry
);
-
+
// Restore the $serendipity array after our modifications.
if (isset($old_var['short_archives'])) {
$serendipity['short_archives'] = $old_var['short_archives'];
}
-
+
if (is_array($old_var['GET'])) {
foreach($old_var['GET'] AS $key => $val) {
$serendipity['GET'][$key] = $val;
}
$out = serendipity_smarty_fetch($params['block'], $params['template']);
-
+
$serendipity['skip_smarty_hook'] = $old_var['skip_smarty_hook'];
$serendipity['skip_smarty_hooks'] = $old_var['skip_smarty_hooks'];
$smarty->trigger_error(__FUNCTION__ .": illegal hook '". $params['hook'] ."'");
return;
}
-
+
// Smarty hooks can be bypassed via an internal variable (temporarily)
if (isset($serendipity['skip_smarty_hooks']) && $serendipity['skip_smarty_hooks']) {
return;
}
-
+
// A specific hook can also be bypassed by creating an associative array like this:
// $serendipity['skip_smarty_hook'] = array('entries_header');
// That would only skip the entries_header event hook, but allow all others.
}
/**
- * Smarty Function: Show Trackbacks
+ * Smarty Function: Show Trackbacks
*
* @access public
* @param array Smarty parameter input array:
$serendipity['serendipityPath'] . $serendipity['templatePath'] . 'default'
);
$serendipity['smarty']->compile_dir = $serendipity['serendipityPath'] . PATH_SMARTY_COMPILE;
+
+ if (!is_dir($serendipity['smarty']->compile_dir) || !is_writable($serendipity['smarty']->compile_dir)) {
+ serendipity_die(sprintf(DIRECTORY_WRITE_ERROR, $serendipity['smarty']->compile_dir));
+ }
+
$serendipity['smarty']->config_dir = &$serendipity['smarty']->template_dir[0];
$serendipity['smarty']->secure_dir = array($serendipity['serendipityPath'] . $serendipity['templatePath']);
$serendipity['smarty']->security_settings['MODIFIER_FUNCS'] = array('sprintf', 'sizeof', 'count', 'rand');
$category_info = serendipity_fetchCategoryInfo($category);
}
}
-
+
if (!isset($serendipity['smarty_vars']['head_link_stylesheet'])) {
$serendipity['smarty_vars']['head_link_stylesheet'] = serendipity_rewriteURL('serendipity.css');
}