changeset 13 | 421242ebbece |
parent 8 | 160f1170aa32 |
child 14 | 58840db7b472 |
12:f0ddbf48c978 | 13:421242ebbece |
---|---|
172 $rank_data = $session->get_user_rank($this->post_author); |
172 $rank_data = $session->get_user_rank($this->post_author); |
173 $strings['USER_LINK'] = '<a href="' . makeUrlNS('User', $this->post_author, false, true) . '" style="' . $rank_data['rank_style'] . '" title="' . htmlspecialchars($rank_data['rank_title']) . '">' . htmlspecialchars($this->post_author) . '</a>'; |
173 $strings['USER_LINK'] = '<a href="' . makeUrlNS('User', $this->post_author, false, true) . '" style="' . $rank_data['rank_style'] . '" title="' . htmlspecialchars($rank_data['rank_title']) . '">' . htmlspecialchars($this->post_author) . '</a>'; |
174 } |
174 } |
175 else |
175 else |
176 { |
176 { |
177 $strings['USER_LINK'] = '<a href="' . makeUrlNS('User', $this->post_author, false, true) . '" style="' . $rank_data['rank_style'] . '">' . htmlspecialchars($this->post_author) . '</a>'; |
177 $strings['USER_LINK'] = '<a href="' . makeUrlNS('User', $this->post_author, false, true) . '">' . htmlspecialchars($this->post_author) . '</a>'; |
178 } |
178 } |
179 |
179 |
180 if ( $this->num_comments == 0 ) |
180 if ( $this->num_comments == 0 ) |
181 $comment_string = 'No comments'; |
181 $comment_string = 'No comments'; |
182 else if ( $this->num_comments == 1 ) |
182 else if ( $this->num_comments == 1 ) |
345 |
345 |
346 if ( !preg_match('/^[0-9]+$/', $page->page_id) ) |
346 if ( !preg_match('/^[0-9]+$/', $page->page_id) ) |
347 { |
347 { |
348 return $page->err_page_not_existent(); |
348 return $page->err_page_not_existent(); |
349 } |
349 } |
350 |
|
351 $template->add_header('<link rel="stylesheet" type="text/css" href="' . scriptPath . '/plugins/nuggie/style.css" />'); |
|
350 |
352 |
351 // using page_id is SAFE. It's checked with a regex above. |
353 // using page_id is SAFE. It's checked with a regex above. |
352 $q = $db->sql_query("SELECT p.post_id, p.post_title, p.post_title_clean, p.post_author, p.post_timestamp, p.post_text, b.blog_name,\n" |
354 $q = $db->sql_query("SELECT p.post_id, p.post_title, p.post_title_clean, p.post_author, p.post_timestamp, p.post_text, b.blog_name,\n" |
353 . " b.blog_subtitle, b.blog_type, b.allowed_users, u.username, u.user_level, COUNT(c.comment_id) AS num_comments\n" |
355 . " b.blog_subtitle, b.blog_type, b.allowed_users, u.username, u.user_level, COUNT(c.comment_id) AS num_comments\n" |
354 . " FROM " . table_prefix . "blog_posts AS p\n" |
356 . " FROM " . table_prefix . "blog_posts AS p\n" |
500 { |
502 { |
501 // Either the user hasn't created a blog yet, or he isn't even registered |
503 // Either the user hasn't created a blog yet, or he isn't even registered |
502 return false; |
504 return false; |
503 } |
505 } |
504 |
506 |
507 // RSS check - do we have support for Feed Me and did the user request an RSS feed? |
|
508 $do_rss = defined('ENANO_FEEDBURNER_INCLUDED') && ( isset($_GET['feed']) && $_GET['feed'] === 'rss2' ); |
|
509 |
|
510 // RSS feed? |
|
511 if ( $do_rss ) |
|
512 { |
|
513 header('Content-type: text/xml; charset=utf-8'); |
|
514 global $aggressive_optimize_html; |
|
515 $aggressive_optimize_html = false; |
|
516 $rss = new RSS( |
|
517 $blog_name, |
|
518 $blog_subtitle, |
|
519 makeUrlComplete('Blog', $username) |
|
520 ); |
|
521 while ( $row = $db->fetchrow($q) ) |
|
522 { |
|
523 $permalink = makeUrlNS('Blog', sanitize_page_id($row['username']) . date('/Y/n/j/', intval($row['post_timestamp'])) . $row['post_title_clean'], false, true); |
|
524 $post = RenderMan::render($row['post_text']); |
|
525 $rss->add_item($row['post_title'], $permalink, $post, intval($row['post_timestamp'])); |
|
526 } |
|
527 echo $rss->render(); |
|
528 return; |
|
529 } |
|
530 |
|
505 $page_name = htmlspecialchars($blog_name) . ' » ' . htmlspecialchars($blog_subtitle); |
531 $page_name = htmlspecialchars($blog_name) . ' » ' . htmlspecialchars($blog_subtitle); |
506 if ( method_exists($template, 'assign_vars') ) |
532 if ( method_exists($template, 'assign_vars') ) |
507 { |
533 { |
508 $template->assign_vars(array( |
534 $template->assign_vars(array( |
509 'PAGE_NAME' => $page_name |
535 'PAGE_NAME' => $page_name |