[ Index ] |
|
Code source de Serendipity 1.2 |
1 <?php # $Id: genpage.inc.php 1520 2006-11-30 21:34:29Z garvinhicking $ 2 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) 3 # All rights reserved. See LICENSE file for licensing details 4 5 if (IN_serendipity !== true) { 6 die ("Don't hack!"); 7 } 8 9 if (!defined('S9Y_FRAMEWORK')) { 10 include ('serendipity_config.inc.php'); 11 } 12 13 if (!defined('S9Y_FRAMEWORK_PLUGIN_API')) { 14 include (S9Y_INCLUDE_PATH . 'include/plugin_api.inc.php'); 15 } 16 17 if (!defined('S9Y_FRAMEWORK_PLUGIN_INTERNAL')) { 18 include (S9Y_INCLUDE_PATH . 'include/plugin_internal.inc.php'); 19 } 20 21 $uri_addData = array( 22 'startpage' => false, 23 'uriargs' => implode('/', serendipity_getUriArguments($uri, true)), 24 'view' => $serendipity['view'] 25 ); 26 if ((empty($uri_addData['uriargs']) || trim($uri_addData['uriargs']) == $serendipity['indexFile']) && empty($serendipity['GET']['subpage'])) { 27 $uri_addData['startpage'] = true; 28 } 29 30 $serendipity['plugindata']['smartyvars'] = $uri_addData; // Plugins can change this global variable 31 serendipity_plugin_api::hook_event('genpage', $uri, $uri_addData); 32 serendipity_smarty_init($serendipity['plugindata']['smartyvars']); 33 34 $leftSidebarElements = serendipity_plugin_api::count_plugins('left'); 35 $rightSidebarElements = serendipity_plugin_api::count_plugins('right'); 36 $serendipity['smarty']->assign_by_ref('leftSidebarElements', $leftSidebarElements); 37 $serendipity['smarty']->assign_by_ref('rightSidebarElements', $rightSidebarElements); 38 39 if ($serendipity['smarty_raw_mode']) { 40 /* For BC reasons, we have to ask for layout.php */ 41 @include(serendipity_getTemplateFile('layout.php', 'serendipityPath')); 42 } else { 43 switch ($serendipity['GET']['action']) { 44 // User wants to read the diary 45 case 'read': 46 if (isset($serendipity['GET']['id'])) { 47 $entry = array(serendipity_fetchEntry('id', $serendipity['GET']['id'])); 48 if (!is_array($entry) || count($entry) < 1) { 49 unset($serendipity['GET']['id']); 50 $entry = array(array()); 51 } 52 53 serendipity_printEntries($entry, 1); 54 } else { 55 serendipity_printEntries(serendipity_fetchEntries($serendipity['range'], true, $serendipity['fetchLimit'])); 56 } 57 break; 58 59 // User searches 60 case 'search': 61 $r = serendipity_searchEntries($serendipity['GET']['searchTerm']); 62 if (strlen($serendipity['GET']['searchTerm']) <= 3) { 63 $serendipity['smarty']->assign( 64 array( 65 'content_message' => SEARCH_TOO_SHORT, 66 'searchresult_tooShort' => true 67 ) 68 ); 69 break; 70 } 71 72 if (is_string($r) && $r !== true) { 73 $serendipity['smarty']->assign( 74 array( 75 'content_message' => sprintf(SEARCH_ERROR, $serendipity['dbPrefix'], $r), 76 'searchresult_error' => true 77 ) 78 ); 79 break; 80 } elseif ($r === true) { 81 $serendipity['smarty']->assign( 82 array( 83 'content_message' => sprintf(NO_ENTRIES_BLAHBLAH, '<span class="searchterm">' . $serendipity['GET']['searchTerm'] . '</span>'), 84 'searchresult_noEntries' => true 85 ) 86 ); 87 break; 88 } 89 90 $serendipity['smarty']->assign( 91 array( 92 'content_message' => sprintf(YOUR_SEARCH_RETURNED_BLAHBLAH, '<span class="searchterm">' . $serendipity['GET']['searchTerm'] . '</span>', '<span class="searchresults">' . serendipity_getTotalEntries() . '</span>'), 93 'searchresult_results' => true 94 ) 95 ); 96 97 serendipity_printEntries($r); 98 break; 99 100 // Show the comments 101 case 'comments': 102 serendipity_printCommentsByAuthor(); 103 // use 'content_message' for pagination? 104 105 break; 106 107 // Show the archive 108 case 'archives': 109 serendipity_printArchives(); 110 break; 111 112 // Welcome screen or whatever 113 default: 114 serendipity_printEntries(serendipity_fetchEntries(null, true, $serendipity['fetchLimit'])); 115 break; 116 } 117 118 serendipity_smarty_fetch('CONTENT', 'content.tpl'); 119 $serendipity['smarty']->assign('ENTRIES', ''); 120 } 121 122 /* vim: set sts=4 ts=4 expandtab : */
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Nov 24 09:00:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |