[ Index ] |
PHP Cross Reference of MyBB |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * MyBB 1.6 4 * Copyright 2010 MyBB Group, All Rights Reserved 5 * 6 * Website: http://mybb.com 7 * License: http://mybb.com/about/license 8 * 9 * $Id$ 10 */ 11 12 // Disallow direct access to this file for security reasons 13 if(!defined("IN_MYBB")) 14 { 15 die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined."); 16 } 17 18 $page->add_breadcrumb_item($lang->version_check, "index.php?module=home-version_check"); 19 20 $plugins->run_hooks("admin_home_version_check_begin"); 21 22 if(!$mybb->input['action']) 23 { 24 $plugins->run_hooks("admin_home_version_check_start"); 25 26 $page->output_header($lang->version_check); 27 28 $sub_tabs['version_check'] = array( 29 'title' => $lang->version_check, 30 'link' => "index.php?module=home-version_check", 31 'description' => $lang->version_check_description 32 ); 33 34 $sub_tabs['download_mybb'] = array( 35 'title' => $lang->dl_the_latest_mybb, 36 'link' => "http://mybb.com/downloads", 37 'link_target' => '_blank' 38 ); 39 40 $sub_tabs['check_plugins'] = array( 41 'title' => $lang->check_plugin_versions, 42 'link' => "index.php?module=config-plugins&action=check", 43 ); 44 45 $page->output_nav_tabs($sub_tabs, 'version_check'); 46 47 $current_version = rawurlencode($mybb->version_code); 48 49 $updated_cache = array( 50 "last_check" => TIME_NOW 51 ); 52 53 require_once MYBB_ROOT."inc/class_xml.php"; 54 $contents = fetch_remote_file("http://www.mybb.com/version_check.php"); 55 if(!$contents) 56 { 57 $page->output_inline_error($lang->error_communication); 58 $page->output_footer(); 59 exit; 60 } 61 62 // We do this because there is some weird symbols that show up in the xml file for unknown reasons 63 $pos = strpos($contents, "<"); 64 if($pos > 1) 65 { 66 $contents = substr($contents, $pos); 67 } 68 69 $pos = strpos(strrev($contents), ">"); 70 if($pos > 1) 71 { 72 $contents = substr($contents, 0, (-1) * ($pos-1)); 73 } 74 75 $parser = new XMLParser($contents); 76 $tree = $parser->get_tree(); 77 78 if(!is_array($tree) || !isset($tree['mybb'])) 79 { 80 $page->output_inline_error($lang->error_communication); 81 $page->output_footer(); 82 exit; 83 } 84 85 $latest_code = $tree['mybb']['version_code']['value']; 86 $latest_version = "<strong>".$tree['mybb']['latest_version']['value']."</strong> (".$latest_code.")"; 87 if($latest_code > $mybb->version_code) 88 { 89 $latest_version = "<span style=\"color: #C00;\">".$latest_version."</span>"; 90 $version_warn = 1; 91 $updated_cache['latest_version'] = $latest_version; 92 $updated_cache['latest_version_code'] = $latest_code; 93 } 94 else 95 { 96 $version_warn = 0; 97 $latest_version = "<span style=\"color: green;\">".$latest_version."</span>"; 98 } 99 100 $cache->update("update_check", $updated_cache); 101 102 require_once MYBB_ROOT."inc/class_feedparser.php"; 103 $feed_parser = new FeedParser(); 104 $feed_parser->parse_feed("http://feeds.feedburner.com/MyBBDevelopmentBlog"); 105 106 $table = new Table; 107 $table->construct_header($lang->your_version); 108 $table->construct_header($lang->latest_version); 109 110 $table->construct_cell("<strong>".$mybb->version."</strong> (".$mybb->version_code.")"); 111 $table->construct_cell($latest_version); 112 $table->construct_row(); 113 114 $table->output($lang->version_check); 115 116 if($version_warn) 117 { 118 $page->output_error("<p><em>{$lang->error_out_of_date}</em> {$lang->update_forum}</p>"); 119 } 120 else 121 { 122 $page->output_success("<p><em>{$lang->success_up_to_date}</em></p>"); 123 } 124 125 if($feed_parser->error == '') 126 { 127 foreach($feed_parser->items as $item) 128 { 129 if($item['date_timestamp']) 130 { 131 $stamp = my_date($mybb->settings['dateformat'], $item['date_timestamp']).", ".my_date($mybb->settings['timeformat'], $item['date_timestamp']); 132 } 133 else 134 { 135 $stamp = ''; 136 } 137 if($item['content']) 138 { 139 $content = $item['content']; 140 } 141 else 142 { 143 $content = $item['description']; 144 } 145 $table->construct_cell("<span style=\"font-size: 16px;\"><strong>".$item['title']."</strong></span><br /><br />{$content}<strong><span style=\"float: right;\">{$stamp}</span><br /><br /><a href=\"{$item['link']}\" target=\"_blank\">» {$lang->read_more}</a></strong>"); 146 $table->construct_row(); 147 } 148 } 149 else 150 { 151 $table->construct_cell("{$lang->error_fetch_news} <!-- error code: {$feed_parser->error} -->"); 152 $table->construct_row(); 153 } 154 155 $table->output($lang->latest_mybb_announcements); 156 157 $page->output_footer(); 158 } 159 160 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Oct 8 19:19:50 2013 | Cross-referenced by PHPXref 0.7.1 |