[ Index ] |
PHP Cross Reference of MyBB 1.8.38 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * MyBB 1.8 4 * Copyright 2014 MyBB Group, All Rights Reserved 5 * 6 * Website: http://www.mybb.com 7 * License: http://www.mybb.com/about/license 8 * 9 */ 10 11 /** 12 * Output the archive page header. 13 * 14 * @param string $title The page title. 15 * @param string $fulltitle The full page title. 16 * @param string $fullurl The full page URL. 17 */ 18 function archive_header($title="", $fulltitle="", $fullurl="") 19 { 20 global $mybb, $lang, $db, $nav, $archiveurl, $sent_header; 21 22 // Build the archive navigation. 23 $nav = archive_navigation(); 24 25 // If there is a title, append it to the bbname. 26 if(!$title) 27 { 28 $title = $mybb->settings['bbname']; 29 } 30 else 31 { 32 $title = $mybb->settings['bbname']." - ".$title; 33 } 34 35 // If the language doesn't have a charset, make it UTF-8. 36 if($lang->settings['charset']) 37 { 38 $charset = $lang->settings['charset']; 39 } 40 else 41 { 42 $charset = "utf-8"; 43 } 44 45 $dir = ''; 46 if($lang->settings['rtl'] == 1) 47 { 48 $dir = " dir=\"rtl\""; 49 } 50 51 if($lang->settings['htmllang']) 52 { 53 $htmllang = " xml:lang=\"".$lang->settings['htmllang']."\" lang=\"".$lang->settings['htmllang']."\""; 54 } 55 else 56 { 57 $htmllang = " xml:lang=\"en\" lang=\"en\""; 58 } 59 ?> 60 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 61 <html xmlns="http://www.w3.org/1999/xhtml"<?php echo $dir; echo $htmllang; ?>> 62 <head> 63 <title><?php echo $title; ?></title> 64 <meta http-equiv="content-type" content="text/html; charset=<?php echo $charset; ?>" /> 65 <meta name="robots" content="index,follow" /> 66 <link type="text/css" rel="stylesheet" rev="stylesheet" href="<?php echo $archiveurl; ?>/screen.css" media="screen" /> 67 <link type="text/css" rel="stylesheet" rev="stylesheet" href="<?php echo $archiveurl; ?>/print.css" media="print" /> 68 </head> 69 <body> 70 <div id="container"> 71 <h1><a href="<?php echo $mybb->settings['bburl']; ?>/index.php"><?php echo $mybb->settings['bbname_orig']; ?></a></h1> 72 <div class="navigation"><?php echo $nav; ?></div> 73 <div id="fullversion"><strong><?php echo $lang->archive_fullversion; ?></strong> <a href="<?php echo $fullurl; ?>"><?php echo $fulltitle; ?></a></div> 74 <div id="infobox"><?php echo $lang->sprintf($lang->archive_note, $fullurl); ?></div> 75 <div id="content"> 76 <?php 77 $sent_header = 1; 78 } 79 80 /** 81 * Build the archive navigation. 82 * 83 * @return string The build navigation 84 */ 85 function archive_navigation() 86 { 87 global $navbits, $mybb, $lang; 88 89 $navsep = " > "; 90 $nav = $activesep = ''; 91 if(is_array($navbits)) 92 { 93 reset($navbits); 94 foreach($navbits as $key => $navbit) 95 { 96 if(!empty($navbits[$key+1])) 97 { 98 if(!empty($navbits[$key+2])) 99 { 100 $sep = $navsep; 101 } 102 else 103 { 104 $sep = ""; 105 } 106 $nav .= "<a href=\"".$navbit['url']."\">".$navbit['name']."</a>$sep"; 107 } 108 } 109 $navsize = count($navbits); 110 $navbit = $navbits[$navsize-1]; 111 } 112 if(!empty($nav)) 113 { 114 $activesep = $navsep; 115 } 116 $nav .= $activesep.$navbit['name']; 117 118 return $nav; 119 } 120 121 /** 122 * Output multipage navigation. 123 * 124 * @param int $count The total number of items. 125 * @param int $perpage The items per page. 126 * @param int $page The current page. 127 * @param string $url The URL base. 128 */ 129 function archive_multipage($count, $perpage, $page, $url) 130 { 131 global $lang; 132 if($count > $perpage) 133 { 134 $pages = $count / $perpage; 135 $pages = ceil($pages); 136 137 $mppage = null; 138 for($i = 1; $i <= $pages; ++$i) 139 { 140 if($i == $page) 141 { 142 $mppage .= "<strong>$i</strong> "; 143 } 144 else 145 { 146 $mppage .= "<a href=\"$url-$i.html\">$i</a> "; 147 } 148 } 149 $multipage = "<div class=\"multipage\"><strong>".$lang->archive_pages."</strong> $mppage</div>"; 150 echo $multipage; 151 } 152 } 153 154 /** 155 * Output the archive footer. 156 * 157 */ 158 function archive_footer() 159 { 160 global $mybb, $lang, $db, $nav, $maintimer, $fulltitle, $fullurl, $sent_header; 161 $totaltime = $maintimer->stop(); 162 if($mybb->settings['showvernum'] == 1) 163 { 164 $mybbversion = ' '.$mybb->version; 165 } 166 else 167 { 168 $mybbversion = ""; 169 } 170 ?> 171 </div> 172 <div class="navigation"><?php echo $nav; ?></div> 173 </div> 174 <div id="footer"> 175 <?php echo $lang->powered_by; ?> <a href="https://mybb.com">MyBB</a><?php echo $mybbversion; ?>, © 2002-<?php echo date("Y"); ?> <a href="https://mybb.com">MyBB Group</a> 176 </div> 177 </body> 178 </html> 179 <?php 180 } 181 182 /** 183 * Output an archive error. 184 * 185 * @param string $error The error language string identifier. 186 */ 187 function archive_error($error) 188 { 189 global $lang, $mybb, $sent_header; 190 if(!$sent_header) 191 { 192 archive_header("", $mybb->settings['bbname'], $mybb->settings['bburl']."/index.php"); 193 } 194 ?> 195 <div class="error"> 196 <div class="header"><?php echo $lang->error; ?></div> 197 <div class="message"><?php echo $error; ?></div> 198 </div> 199 <?php 200 archive_footer(); 201 exit; 202 } 203 204 /** 205 * Ouput a "no permission"page. 206 */ 207 function archive_error_no_permission() 208 { 209 global $lang, $db, $session; 210 211 $noperm_array = array ( 212 "nopermission" => '1', 213 "location1" => 0, 214 "location2" => 0 215 ); 216 217 $db->update_query("sessions", $noperm_array, "sid='{$session->sid}'"); 218 219 archive_error($lang->archive_nopermission); 220 } 221 222 /** 223 * Check the password given on a certain forum for validity 224 * 225 * @param int $fid The forum ID 226 * @param int $pid The Parent ID 227 * @return bool Returns false on failure 228 */ 229 function check_forum_password_archive($fid, $pid=0) 230 { 231 global $forum_cache, $mybb; 232 233 if(!is_array($forum_cache)) 234 { 235 $forum_cache = cache_forums(); 236 if(!$forum_cache) 237 { 238 return false; 239 } 240 } 241 242 if(!forum_password_validated($forum_cache[$fid], true, true)) 243 { 244 archive_error_no_permission(); 245 } 246 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
2005 - 2021 © MyBB.de | Alle Rechte vorbehalten! | Sponsor: netcup | Cross-referenced by PHPXref |