blog.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. <?php //$Id: announcements.php 16702 2008-11-10 13:02:30Z elixir_inter $
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004-2008 Dokeos SPRL
  6. Copyright (c) 2003 Ghent University (UGent)
  7. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  8. Copyright (c) various contributors
  9. For a full list of contributors, see "credits.txt".
  10. The full license can be read in "license.txt".
  11. This program is free software; you can redistribute it and/or
  12. modify it under the terms of the GNU General Public License
  13. as published by the Free Software Foundation; either version 2
  14. of the License, or (at your option) any later version.
  15. See the GNU General Public License for more details.
  16. Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
  17. info@dokeos.com
  18. ==============================================================================
  19. BLOG HOMEPAGE
  20. This file takes care of all blog navigation and displaying.
  21. @package dokeos.blogs
  22. ==============================================================================
  23. */
  24. /*
  25. ==============================================================================
  26. INIT
  27. ==============================================================================
  28. */
  29. // name of the language file that needs to be included
  30. $language_file = "blog";
  31. $blog_id = intval($_GET['blog_id']);
  32. include ('../inc/global.inc.php');
  33. $this_section=SECTION_COURSES;
  34. /* ------------ ACCESS RIGHTS ------------ */
  35. // notice for unauthorized people.
  36. api_protect_course_script(true);
  37. //session
  38. if(isset($_GET['id_session']))
  39. {
  40. $_SESSION['id_session'] = $_GET['id_session'];
  41. }
  42. $lib_path = api_get_path(LIBRARY_PATH);
  43. require_once ($lib_path.'/display.lib.php');
  44. require_once ($lib_path.'/text.lib.php');
  45. require_once ($lib_path.'/blog.lib.php');
  46. require_once ($lib_path.'/fckeditor/fckeditor.php');
  47. $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
  48. $nameTools = get_lang('Blogs');
  49. $DaysShort = array (get_lang('SundayShort'), get_lang('MondayShort'), get_lang('TuesdayShort'), get_lang('WednesdayShort'), get_lang('ThursdayShort'), get_lang('FridayShort'), get_lang('SaturdayShort'));
  50. $DaysLong = array (get_lang('SundayLong'), get_lang('MondayLong'), get_lang('TuesdayLong'), get_lang('WednesdayLong'), get_lang('ThursdayLong'), get_lang('FridayLong'), get_lang('SaturdayLong'));
  51. $MonthsLong = array (get_lang('JanuaryLong'), get_lang('FebruaryLong'), get_lang('MarchLong'), get_lang('AprilLong'), get_lang('MayLong'), get_lang('JuneLong'), get_lang('JulyLong'), get_lang('AugustLong'), get_lang('SeptemberLong'), get_lang('OctoberLong'), get_lang('NovemberLong'), get_lang('DecemberLong'));
  52. $current_page = $_GET['action'];
  53. /*
  54. ==============================================================================
  55. PROCESSING
  56. ==============================================================================
  57. */
  58. $safe_post_title = Security::remove_XSS($_POST['post_title']);
  59. $safe_post_file_comment = Security::remove_XSS($_POST['post_file_comment']);
  60. $safe_post_full_text = Security::remove_XSS(stripslashes(api_html_entity_decode($_POST['post_full_text'])), COURSEMANAGERLOWSECURITY);
  61. $safe_comment_text = Security::remove_XSS(stripslashes(api_html_entity_decode($_POST['comment_text'])), COURSEMANAGERLOWSECURITY);
  62. $safe_comment_title = Security::remove_XSS($_POST['comment_title']);
  63. $safe_task_name = Security::remove_XSS($_POST['task_name']);
  64. $safe_task_description = Security::remove_XSS($_POST['task_description']);
  65. if (!empty($_POST['new_post_submit']) AND !empty($_POST['post_title']))
  66. {
  67. Blog :: create_post($safe_post_title, $safe_post_full_text, $safe_post_file_comment,$blog_id);
  68. $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogAdded'));
  69. }
  70. if (!empty($_POST['edit_post_submit']))
  71. {
  72. $safe_post_title = Security::remove_XSS($_POST['post_title']);
  73. Blog :: edit_post($_POST['post_id'], $safe_post_title, $safe_post_full_text, $blog_id);
  74. $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogEdited'));
  75. }
  76. if (!empty($_POST['new_comment_submit']))
  77. {
  78. Blog :: create_comment($safe_comment_title, $safe_comment_text, $safe_post_file_comment,$blog_id, (int)$_GET['post_id'], $_POST['comment_parent_id']);
  79. $return_message = array('type' => 'confirmation', 'message' => get_lang('CommentAdded'));
  80. }
  81. if (!empty($_POST['new_task_submit']))
  82. {
  83. Blog :: create_task($blog_id, $safe_task_name, $safe_task_description, $_POST['chkArticleDelete'], $_POST['chkArticleEdit'], $_POST['chkCommentsDelete'], $_POST['task_color']);
  84. $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskCreated'));
  85. }
  86. if (isset($_POST['edit_task_submit']))
  87. {
  88. Blog :: edit_task($_POST['blog_id'], $_POST['task_id'], $safe_task_name, $safe_task_description, $_POST['chkArticleDelete'], $_POST['chkArticleEdit'],$_POST['chkCommentsDelete'], $_POST['task_color']);
  89. $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskEdited'));
  90. }
  91. if (!empty($_POST['assign_task_submit']))
  92. {
  93. Blog :: assign_task($blog_id, $_POST['task_user_id'], $_POST['task_task_id'], $_POST['task_year']."-".$_POST['task_month']."-".$_POST['task_day']);
  94. $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskAssigned'));
  95. }
  96. if (isset($_POST['assign_task_edit_submit']))
  97. {
  98. Blog :: edit_assigned_task($blog_id, $_POST['task_user_id'], $_POST['task_task_id'], $_POST['task_year']."-".$_POST['task_month']."-".$_POST['task_day'], $_POST['old_user_id'], $_POST['old_task_id'], $_POST['old_target_date']);
  99. $return_message = array('type' => 'confirmation', 'message' => get_lang('AssignedTaskEdited'));
  100. }
  101. if (!empty($_POST['new_task_execution_submit']))
  102. {
  103. Blog :: create_comment($safe_comment_title, $safe_comment_text, $blog_id, (int)$_GET['post_id'], $_POST['comment_parent_id'], $_POST['task_id']);
  104. $return_message = array('type' => 'confirmation', 'message' => get_lang('CommentCreated'));
  105. }
  106. if (!empty($_POST['register']))
  107. {
  108. if (is_array($_POST['user'])) {
  109. foreach ($_POST['user'] as $index => $user_id)
  110. {
  111. Blog :: set_user_subscribed((int)$_GET['blog_id'], $user_id);
  112. }
  113. }
  114. }
  115. if (!empty($_POST['unregister']))
  116. {
  117. if (is_array($_POST['user'])) {
  118. foreach ($_POST['user'] as $index => $user_id)
  119. {
  120. Blog :: set_user_unsubscribed((int)$_GET['blog_id'], $user_id);
  121. }
  122. }
  123. }
  124. if (!empty($_GET['register']))
  125. {
  126. Blog :: set_user_subscribed((int)$_GET['blog_id'], (int)$_GET['user_id']);
  127. $return_message = array('type' => 'confirmation', 'message' => get_lang('UserRegistered'));
  128. $flag = 1;
  129. }
  130. if (!empty($_GET['unregister']))
  131. {
  132. Blog :: set_user_unsubscribed((int)$_GET['blog_id'], (int)$_GET['user_id']);
  133. }
  134. if (isset($_GET['action']) && $_GET['action'] == 'manage_tasks')
  135. {
  136. if (isset($_GET['do']) && $_GET['do'] == 'delete')
  137. {
  138. Blog :: delete_task($blog_id, (int)$_GET['task_id']);
  139. $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskDeleted'));
  140. }
  141. if (isset($_GET['do']) && $_GET['do'] == 'delete_assignment')
  142. {
  143. Blog :: delete_assigned_task($blog_id, Database::escape_string((int)$_GET['task_id']), Database::escape_string((int)$_GET['user_id']));
  144. $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskAssignmentDeleted'));
  145. }
  146. }
  147. if (isset($_GET['action']) && $_GET['action'] == 'view_post')
  148. {
  149. $task_id = (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) ? $_GET['task_id'] : 0;
  150. if (isset($_GET['do']) && $_GET['do'] == 'delete_comment')
  151. {
  152. if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_delete', $task_id))
  153. {
  154. Blog :: delete_comment($blog_id, (int)$_GET['post_id'],(int)$_GET['comment_id']);
  155. $return_message = array('type' => 'confirmation', 'message' => get_lang('CommentDeleted'));
  156. }
  157. else
  158. {
  159. $error = true;
  160. $message = get_lang('ActionNotAllowed');
  161. }
  162. }
  163. if (isset($_GET['do']) && $_GET['do'] == 'delete_article')
  164. {
  165. if (api_is_allowed('BLOG_'.$blog_id, 'article_delete', $task_id))
  166. {
  167. Blog :: delete_post($blog_id, (int)$_GET['article_id']);
  168. $current_page = ''; // Article is gone, go to blog home
  169. $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogDeleted'));
  170. }
  171. else
  172. {
  173. $error = true;
  174. $message = get_lang('ActionNotAllowed');
  175. }
  176. }
  177. if (isset($_GET['do']) && $_GET['do'] == 'rate')
  178. {
  179. if (isset($_GET['type']) && $_GET['type'] == 'post')
  180. {
  181. if (api_is_allowed('BLOG_'.$blog_id, 'article_rate'))
  182. {
  183. Blog :: add_rating('post', $blog_id, (int)$_GET['post_id'], (int)$_GET['rating']);
  184. $return_message = array('type' => 'confirmation', 'message' => get_lang('RatingAdded'));
  185. }
  186. }
  187. if (isset($_GET['type']) && $_GET['type'] == 'comment')
  188. {
  189. if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_add'))
  190. {
  191. Blog :: add_rating('comment', $blog_id, (int)$_GET['comment_id'], (int)$_GET['rating']);
  192. $return_message = array('type' => 'confirmation', 'message' => get_lang('RatingAdded'));
  193. }
  194. }
  195. }
  196. }
  197. /*
  198. ==============================================================================
  199. DISPLAY
  200. ==============================================================================
  201. */
  202. $htmlHeadXtra[] = '<script src="tbl_change.js" type="text/javascript" language="javascript"></script>';
  203. // Set bredcrumb
  204. switch ($current_page)
  205. {
  206. case 'new_post' :
  207. $nameTools = get_lang('NewPost');
  208. $interbreadcrumb[] = array ('url' => "blog.php?blog_id=$blog_id", "name" => Blog :: get_blog_title($blog_id));
  209. Display :: display_header($nameTools, 'Blogs');
  210. break;
  211. case 'manage_tasks' :
  212. $nameTools = get_lang('TaskManager');
  213. $interbreadcrumb[] = array ('url' => "blog.php?blog_id=$blog_id", "name" => Blog :: get_blog_title($blog_id));
  214. Display :: display_header($nameTools, 'Blogs');
  215. break;
  216. case 'manage_members' :
  217. $nameTools = get_lang('MemberManager');
  218. $interbreadcrumb[] = array ('url' => "blog.php?blog_id=$blog_id", "name" => Blog :: get_blog_title($blog_id));
  219. Display :: display_header($nameTools, 'Blogs');
  220. break;
  221. case 'manage_rights' :
  222. $nameTools = get_lang('RightsManager');
  223. $interbreadcrumb[] = array ('url' => "blog.php?blog_id=$blog_id", 'name' => Blog :: get_blog_title($blog_id));
  224. Display :: display_header($nameTools, 'Blogs');
  225. break;
  226. case 'view_search_result' :
  227. $nameTools = get_lang('SearchResults');
  228. $interbreadcrumb[] = array ('url' => "blog.php?blog_id=$blog_id", 'name' => Blog :: get_blog_title($blog_id));
  229. Display :: display_header($nameTools, 'Blogs');
  230. break;
  231. case 'execute_task' :
  232. $nameTools = get_lang('ExecuteThisTask');
  233. $interbreadcrumb[] = array ('url' => "blog.php?blog_id=$blog_id", 'name' => Blog :: get_blog_title($blog_id));
  234. Display :: display_header($nameTools, 'Blogs');
  235. break;
  236. default :
  237. $nameTools = Blog :: get_blog_title($blog_id);
  238. Display :: display_header($nameTools, 'Blogs');
  239. }
  240. // feedback messages
  241. if (!empty($return_message))
  242. {
  243. if ($return_message['type'] == 'confirmation')
  244. {
  245. Display::display_confirmation_message($return_message['message']);
  246. }
  247. if ($return_message['type'] == 'error')
  248. {
  249. Display::display_error_message($return_message['message']);
  250. }
  251. }
  252. // actions
  253. echo '<div class=actions>';
  254. ?>
  255. <a href="<?php echo api_get_self(); ?>?blog_id=<?php echo $blog_id ?>" title="<?php echo get_lang('Home') ?>"><?php echo Display::return_icon('blog.gif', get_lang('Home')).get_lang('Home') ?></a>
  256. <?php if(api_is_allowed('BLOG_'.$blog_id, 'article_add')) { ?><a href="<?php echo api_get_self(); ?>?action=new_post&amp;blog_id=<?php echo $blog_id ?>" title="<?php echo get_lang('NewPost') ?>"><?php echo Display::return_icon('blog_article.gif', get_lang('NewPost')).get_lang('NewPost') ?></a><?php } ?>
  257. <?php if(api_is_allowed('BLOG_'.$blog_id, 'task_management')) { ?><a href="<?php echo api_get_self(); ?>?action=manage_tasks&amp;blog_id=<?php echo $blog_id ?>" title="<?php echo get_lang('ManageTasks') ?>"><?php echo Display::return_icon('blog_tasks.gif', get_lang('TaskManager')).get_lang('TaskManager') ?></a><?php } ?>
  258. <?php if(api_is_allowed('BLOG_'.$blog_id, 'member_management')) { ?><a href="<?php echo api_get_self(); ?>?action=manage_members&amp;blog_id=<?php echo $blog_id ?>" title="<?php echo get_lang('ManageMembers') ?>"><?php echo Display::return_icon('blog_user.gif', get_lang('MemberManager')).get_lang('MemberManager') ?></a><?php } ?>
  259. <?php
  260. echo '</div>';
  261. // Tool introduction
  262. $fck_attribute['Width'] = '100%';
  263. $fck_attribute['Height'] = '300';
  264. $fck_attribute['ToolbarSet'] = 'Introduction';
  265. Display::display_introduction_section(TOOL_BLOG);
  266. $fck_attribute = null; // Clearing this global variable immediatelly after it has been used.
  267. //Display::display_header($nameTools,'Blogs');
  268. ?>
  269. <div class="sectiontitle"><?php echo Blog::get_blog_title($blog_id); ?></div>
  270. <div class="sectioncomment"><?php echo Blog::get_blog_subtitle($blog_id); ?></div>
  271. <table width="100%">
  272. <tr>
  273. <td width="10%" style="float;left;" class="blog_left" valign="top">
  274. <?php
  275. $month = (int)$_GET['month'] ? (int)$_GET['month'] : (int) date('m');
  276. $year = (int)$_GET['year'] ? (int)$_GET['year'] : date('Y');
  277. Blog :: display_minimonthcalendar($month, $year, $blog_id);
  278. ?>
  279. <br />
  280. <br />
  281. <table width="100%">
  282. <tr>
  283. <td class="sectiontitle"><?php echo get_lang('Search') ?></td>
  284. </tr>
  285. <tr>
  286. <td class="blog_menu">
  287. <form action="blog.php" method="get" enctype="multipart/form-data">
  288. <input type="hidden" name="blog_id" value="<?php echo $blog_id ?>" />
  289. <input type="hidden" name="action" value="view_search_result" />
  290. <input type="text" size="20" name="q" value="<?php echo (isset($_GET['q']) ? $_GET['q'] : ''); ?>" /><button class="search" type="submit"><?php echo get_lang('Search'); ?></button>
  291. </form>
  292. </td>
  293. </tr>
  294. </table>
  295. <br />
  296. <table width="100%">
  297. <tr>
  298. <td class="sectiontitle"><?php echo get_lang('MyTasks') ?></td>
  299. </tr>
  300. <tr>
  301. <td class="blog_menu">
  302. <?php Blog::get_personal_task_list(); ?>
  303. </td>
  304. </tr>
  305. </table>
  306. <!--
  307. <br />
  308. <table width="100%">
  309. <tr>
  310. <td class="blog_menu_title"><?php echo get_lang('FavoriteBlogs') ?></td>
  311. </tr>
  312. <tr>
  313. <td class="blog_menu">
  314. <ul>
  315. <li>Favorite 1</li>
  316. <li>Favorite 2</li>
  317. <li>Favorite 3</li>
  318. </ul>
  319. </td>
  320. </tr>
  321. </table>
  322. <br />
  323. <table width="100%">
  324. <tr>
  325. <td class="blog_menu_title"><?php echo get_lang('TopTen') ?></td>
  326. </tr>
  327. <tr>
  328. <td class="blog_menu">
  329. <ul>
  330. <li>Blog 1</li>
  331. <li>Blog 2</li>
  332. <li>Blog 3</li>
  333. </ul>
  334. </td>
  335. </tr>
  336. </table>
  337. -->
  338. </td>
  339. <td valign="top" class="blog_right">
  340. <?php
  341. if ($error)
  342. Display :: display_error_message($message);
  343. if ($flag == '1')
  344. {
  345. $current_page = "manage_tasks";
  346. Blog :: display_assign_task_form($blog_id);
  347. }
  348. $user_task = false;
  349. if (isset ($_GET['task_id']) && is_numeric($_GET['task_id']))
  350. $task_id = (int)$_GET['task_id'];
  351. else
  352. {
  353. $task_id = 0;
  354. $tbl_blogs_tasks_rel_user = Database :: get_course_table(TABLE_BLOGS_TASKS_REL_USER);
  355. $sql = "
  356. SELECT COUNT(*) as number
  357. FROM ".$tbl_blogs_tasks_rel_user."
  358. WHERE
  359. blog_id = ".$blog_id." AND
  360. user_id = ".api_get_user_id()." AND
  361. task_id = ".$task_id;
  362. $result = api_sql_query($sql, __LINE__, __FILE__);
  363. $row = Database::fetch_array($result);
  364. if ($row['number'] == 1)
  365. $user_task = true;
  366. }
  367. switch ($current_page)
  368. {
  369. case 'new_post' :
  370. if (api_is_allowed('BLOG_'.$blog_id, 'article_add', $user_task ? $task_id : 0))
  371. {
  372. // we show the form if
  373. // 1. no post data
  374. // 2. there is post data and the required field is empty
  375. if (!$_POST OR (!empty($_POST) AND empty($_POST['post_title'])))
  376. {
  377. // if there is post data there is certainly an error in the form
  378. if ($_POST)
  379. {
  380. Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'));
  381. }
  382. Blog :: display_form_new_post($blog_id);
  383. }
  384. else
  385. {
  386. if (isset ($_GET['filter']) && !empty ($_GET['filter']))
  387. {
  388. Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter']));
  389. }
  390. else
  391. {
  392. Blog :: display_blog_posts($blog_id);
  393. }
  394. }
  395. }
  396. else
  397. {
  398. api_not_allowed();
  399. }
  400. break;
  401. case 'view_post' :
  402. Blog :: display_post($blog_id, Database::escape_string((int)$_GET['post_id']));
  403. break;
  404. case 'edit_post' :
  405. $task_id = (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) ? $_GET['task_id'] : 0;
  406. if (api_is_allowed('BLOG_'.$blog_id, 'article_edit', $task_id))
  407. {
  408. // we show the form if
  409. // 1. no post data
  410. // 2. there is post data and the required field is empty
  411. if (!$_POST OR (!empty($_POST) AND empty($_POST['post_title'])))
  412. {
  413. // if there is post data there is certainly an error in the form
  414. if ($_POST)
  415. {
  416. Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'));
  417. }
  418. Blog :: display_form_edit_post($blog_id, Database::escape_string((int)$_GET['post_id']));
  419. }
  420. else
  421. {
  422. if (isset ($_GET['filter']) && !empty ($_GET['filter']))
  423. {
  424. Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter']));
  425. }
  426. else
  427. {
  428. Blog :: display_blog_posts($blog_id);
  429. }
  430. }
  431. }
  432. else
  433. {
  434. api_not_allowed();
  435. }
  436. break;
  437. case 'manage_members' :
  438. if (api_is_allowed('BLOG_'.$blog_id, 'member_management'))
  439. {
  440. Blog :: display_form_user_subscribe($blog_id);
  441. echo '<br /><br />';
  442. Blog :: display_form_user_unsubscribe($blog_id);
  443. }
  444. else
  445. api_not_allowed();
  446. break;
  447. case 'manage_rights' :
  448. Blog :: display_form_user_rights($blog_id);
  449. break;
  450. case 'manage_tasks' :
  451. if (api_is_allowed('BLOG_'.$blog_id, 'task_management'))
  452. {
  453. if (isset($_GET['do']) && $_GET['do'] == 'add')
  454. {
  455. Blog :: display_new_task_form($blog_id);
  456. }
  457. if (isset($_GET['do']) && $_GET['do'] == 'assign')
  458. {
  459. Blog :: display_assign_task_form($blog_id);
  460. }
  461. if (isset($_GET['do']) && $_GET['do'] == 'edit')
  462. {
  463. Blog :: display_edit_task_form($blog_id, Database::escape_string($_GET['task_id']));
  464. }
  465. if (isset($_GET['do']) && $_GET['do'] == 'edit_assignment')
  466. {
  467. Blog :: display_edit_assigned_task_form($blog_id, Database::escape_string((int)$_GET['task_id']), Database::escape_string((int)$_GET['user_id']));
  468. }
  469. Blog :: display_task_list($blog_id);
  470. echo '<br /><br />';
  471. Blog :: display_assigned_task_list($blog_id);
  472. echo '<br /><br />';
  473. }
  474. else
  475. api_not_allowed();
  476. break;
  477. case 'execute_task' :
  478. if (isset ($_GET['post_id']))
  479. Blog :: display_post($blog_id, Database::escape_string((int)$_GET['post_id']));
  480. else
  481. Blog :: display_select_task_post($blog_id, Database::escape_string((int)$_GET['task_id']));
  482. break;
  483. case 'view_search_result' :
  484. Blog :: display_search_results($blog_id, Database::escape_string($_GET['q']));
  485. break;
  486. case '' :
  487. default :
  488. if (isset ($_GET['filter']) && !empty ($_GET['filter']))
  489. {
  490. Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter']));
  491. }
  492. else
  493. {
  494. Blog :: display_blog_posts($blog_id);
  495. }
  496. }
  497. ?>
  498. </td>
  499. </tr>
  500. </table>
  501. <?php
  502. // Display the footer
  503. Display::display_footer();
  504. ?>