[ Index ]

PHP Cross Reference of MyBB 1.8.30

title

Body

[close]

/inc/tasks/ -> versioncheck.php (source)

   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  function task_versioncheck($task)
  12  {
  13      global $cache, $lang, $mybb;
  14  
  15      $current_version = rawurlencode($mybb->version_code);
  16  
  17      $updated_cache = array(
  18          'last_check' => TIME_NOW
  19      );
  20  
  21      // Check for the latest version
  22      $contents = fetch_remote_file("https://mybb.com/version_check.php");
  23  
  24      if(!$contents)
  25      {
  26          add_task_log($task, $lang->task_versioncheck_ran_errors);
  27          return false;
  28      }
  29  
  30      $contents = trim($contents);
  31  
  32      $parser = create_xml_parser($contents);
  33      $tree = $parser->get_tree();
  34  
  35      $latest_code = (int)$tree['mybb']['version_code']['value'];
  36      $latest_version = "<strong>".htmlspecialchars_uni($tree['mybb']['latest_version']['value'])."</strong> (".$latest_code.")";
  37      if($latest_code > $mybb->version_code)
  38      {
  39          $latest_version = "<span style=\"color: #C00;\">".$latest_version."</span>";
  40          $version_warn = 1;
  41          $updated_cache['latest_version'] = $latest_version;
  42          $updated_cache['latest_version_code'] = $latest_code;
  43      }
  44      else
  45      {
  46          $latest_version = "<span style=\"color: green;\">".$latest_version."</span>";
  47      }
  48  
  49      // Check for the latest news
  50      require_once  MYBB_ROOT."inc/class_feedparser.php";
  51  
  52      $feed_parser = new FeedParser();
  53      $feed_parser->parse_feed("http://feeds.feedburner.com/MyBBDevelopmentBlog");
  54  
  55      $updated_cache['news'] = array();
  56  
  57      require_once  MYBB_ROOT . '/inc/class_parser.php';
  58      $post_parser = new postParser();
  59  
  60      if($feed_parser->error == '')
  61      {
  62          foreach($feed_parser->items as $item)
  63          {
  64              if (isset($updated_cache['news'][2]))
  65              {
  66                  break;
  67              }
  68  
  69              $updated_cache['news'][] = array(
  70                  'title' => $item['title'],
  71                  'description' => $item['description'],
  72                  'link' => $item['link'],
  73                  'author' => $item['author'],
  74                  'dateline' => $item['date_timestamp']
  75              );
  76          }
  77      }
  78  
  79      $cache->update("update_check", $updated_cache);
  80      add_task_log($task, $lang->task_versioncheck_ran);
  81  }


2005 - 2021 © MyBB.de | Alle Rechte vorbehalten! | Sponsor: netcup Cross-referenced by PHPXref