[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/action/admin/ -> adminversioncheckaction.class.php (source)

   1  <?php
   2  
   3      lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
   4      lt_include( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
   5      lt_include( PLOG_CLASS_PATH."class/misc/integritychecker.class.php" );
   6      lt_include( PLOG_CLASS_PATH."class/xml/rssparser/rssparser.class.php" );    
   7      
   8      /**
   9       * \ingroup Action
  10       * @private
  11       *
  12       * Checks that all files have got the right version
  13       */
  14      class AdminVersionCheckAction extends AdminAction
  15      {
  16  		function AdminVersionCheckAction( $actionInfo, $request )
  17          {
  18              $this->AdminAction( $actionInfo, $request );
  19  
  20              $this->requireAdminPermission( "view_global_settings" );
  21          }
  22  
  23  		function perform()
  24          {
  25              $result = false;
  26              
  27              $this->_view = new AdminTemplatedView( $this->_blogInfo, "versions" );
  28              
  29              // decide what we're going to do...
  30              if( $this->_request->getValue( "doFileVersionCheck" ) != "" ) {
  31                  // here we have to check the files and display the result
  32                  
  33                  // load the file with the reference checksums, as generated by the development
  34                  // team prior to the release
  35                  include ( PLOG_CLASS_PATH."install/files.properties.php");
  36                  
  37                  // now check the reference data agains the current data. The default folders are
  38                  // "class", "templates/admin", "templates/wizard", "templates/rss", "templates/summary", "templates/default"
  39                  $result = IntegrityChecker::checkIntegrity( 
  40                      $data
  41                  );
  42                  
  43                  if( empty( $result )) 
  44                      $this->_view->setSuccessMessage( $this->_locale->tr( "all_files_ok" ));
  45                  else {
  46                      $fileList = implode( "<br/>", array_keys( $result ));
  47                      $message = $this->_locale->tr( "incorrect_file_version_error" )."<br/>".$fileList;
  48                      $this->_view->setErrorMessage( $message );
  49                  }
  50              }
  51              elseif( $this->_request->getValue( "doLTVersionCheck" ) != "" ) {
  52                  $rss = new RssParser();
  53                  if( $rss->parse( Version::getLifetypeVersionFeed() )) {                    
  54                      $items = $rss->getItems();
  55                      
  56                      // there is only one item tag in the feed, the one containing the latest stable
  57                      // version only
  58                      if( isset( $items[0] )) {
  59                          $version = $items[0]->getTitle();
  60                          if( Version::isNewer( $version )) {
  61                              $message = $this->_locale->tr( "lt_version_error" )."<b>$version</b>";
  62                              $message .= "<br/><a href=\"".$items[0]->getLink()."\">".$this->_locale->tr("download")."</a>";
  63                              $message .= "<br/><a href=\"".$items[0]->_item["lt"]["relnotes"]."\">".$this->_locale->tr("release_notes")."</a>";                            
  64                              $this->_view->setErrorMessage( $message );
  65                          }
  66                          else  {
  67                              $this->_view->setSuccessMessage( $this->_locale->tr( "lt_version_ok" ));
  68                          }
  69                      }
  70                  }
  71              }
  72  
  73              lt_include( PLOG_CLASS_PATH."class/misc/version.class.php" );
  74              $this->_view->setValue( "version", Version::getVersion());
  75  
  76              $this->setCommonData();
  77  
  78              return true;
  79          }
  80      }
  81  ?>


Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics