[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/home/inc/ -> class.updates.inc.php (source)

   1  <?php
   2    /**************************************************************************\
   3    * eGroupWare                                                               *
   4    * http://www.egroupware.org                                                *
   5    * Based on the file written by Joseph Engo <jengo@phpgroupware.org>        *
   6    * Based on the file modified by Greg Haygood <shrykedude@bellsouth.net>    *
   7    * Original file: home.php by phpgroupware                                  *
   8    * The file written by Edo van Bruggen <edovanbruggen@raketnet.nl>          *
   9    * --------------------------------------------                             *
  10    *  This program is free software; you can redistribute it and/or modify it *
  11    *  under the terms of the GNU General Public License as published by the   *
  12    *  Free Software Foundation; either version 2 of the License, or (at your  *
  13    *  option) any later version.                                              *
  14    \**************************************************************************/
  15  
  16    /* $Id: class.updates.inc.php 19966 2005-11-24 11:52:14Z milosch $ */
  17  
  18      /*
  19      ** Provides the status of the eGroupware installation.
  20      */
  21      class updates
  22      {
  23          /*
  24          ** @return boolean: are there updates or not
  25          */
  26  		function hasUpdates() 
  27          {
  28              if(count($this->showUpdates()) > 0)
  29              {
  30                  return false;
  31              }
  32              else 
  33              {
  34                  return false;
  35              }
  36          }
  37  
  38          /*
  39          ** @return array with string-message about status of eGroupware and status of all application
  40          */
  41  		function showUpdates()
  42          {
  43              $updates = array();
  44  
  45              if (isset($GLOBALS['egw_info']['user']['apps']['admin']) && $GLOBALS['egw_info']['user']['apps']['admin'] &&
  46                  isset($GLOBALS['egw_info']['server']['checkfornewversion']) && $GLOBALS['egw_info']['server']['checkfornewversion'])
  47              {
  48                  $GLOBALS['egw']->network =& CreateObject('phpgwapi.network');
  49  
  50                  $GLOBALS['egw']->network->set_addcrlf(False);
  51                  $lines = $GLOBALS['egw']->network->gethttpsocketfile('http://www.egroupware.org/currentversion');
  52                  for($i=0; $i<count($lines); $i++)
  53                  {
  54                      if(strstr($lines[$i],'currentversion'))
  55                      {
  56                          $line_found = explode(':',chop($lines[$i]));
  57                      }
  58                  }
  59  
  60                  if($GLOBALS['egw']->common->cmp_version_long($GLOBALS['egw_info']['server']['versions']['phpgwapi'],$line_found[1]))
  61                  {
  62                      $updates['egroupware'] = '<p>'.lang('There is a new version of eGroupWare available').
  63                      ' <a href="http://www.egroupware.org">www.egroupware.org</a></p>';
  64                  }
  65  
  66                  $_found = False;
  67                  foreach($GLOBALS['egw_info']['apps'] as $_app_name => $data)
  68                  {
  69                      $_db_version  = $data['version'];
  70                      $_app_dir = $GLOBALS['egw']->common->get_app_dir($_app_name);
  71                      $_versionfile = $_app_dir . '/setup/setup.inc.php';
  72                      if($_app_dir && file_exists($_versionfile))
  73                      {
  74                          include($_versionfile);
  75                          $_file_version = $setup_info[$_app_name]['version'];
  76                          $_app_title    = $GLOBALS['egw_info']['apps'][$_app_name]['title'];
  77                          unset($setup_info);
  78  
  79                          if($GLOBALS['egw']->common->cmp_version_long($_db_version,$_file_version))
  80                          {
  81                              $_found = True;
  82                              $_app_string .= '<br>' . $_app_title;
  83                          }
  84                          unset($_file_version);
  85                          unset($_app_title);
  86                      }
  87                      unset($_db_version);
  88                      unset($_versionfile);
  89                  }
  90                  if($_found)
  91                  {
  92                      $updates['apps'] = lang('The following applications require upgrades') . ':' . "\n";
  93                      $updates['apps'] .= $_app_string . "\n";
  94                      $updates['apps'] .= '<br><a href="setup/" target="_blank">' . lang('Please run setup to become current') . '.' . "</a>\n";
  95                      unset($_app_string);
  96                  }
  97              }
  98              return $updates;
  99          } 
 100      }


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7