Ignore:
Timestamp:
Jul 14, 2009, 2:58:36 PM (15 years ago)
Author:
flop25
Message:

first version beta of the 'version checker'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/floPure/index.tpl

    r3474 r3577  
    11{* $Id: index.tpl 2352 2008-05-20 00:27:26Z patdenice $ *}
    22{$MENUBAR}
     3{php}
     4if (is_admin())
     5{
     6        global $template, $user;
     7        include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
     8        //include_once(PHPWG_ROOT_PATH.'admin/include/plugins.class.php');
     9        include_once(PHPWG_ROOT_PATH.'template/floPure/tools/version.conf.php');
     10        include_once(PHPWG_ROOT_PATH.'template/floPure/tools/floPure.class.php');
     11        load_language('template.lang', PHPWG_ROOT_PATH.'template/floPure/tools/');
     12        $floPure = new floPure();
     13
     14    // Retrieve PEM versions
     15    $version = PHPWG_VERSION;
     16    $versions_to_check = array();
     17    $url = PEM_URL . '/api/get_version_list.php?category_id=12&format=php';
     18    if (fetchRemote($url, $result) and $pem_versions = @unserialize($result))
     19    {
     20      if (!preg_match('/^\d+\.\d+\.\d+/', $version))
     21      {
     22        $version = $pem_versions[0]['name'];
     23      }
     24      $branch = substr($version, 0, strrpos($version, '.'));
     25      foreach ($pem_versions as $pem_version)
     26      {
     27        if (strpos($pem_version['name'], $branch) === 0)
     28        {
     29          $versions_to_check[] = $pem_version['id'];
     30        }
     31      }
     32    }
     33       
     34        // Retrieve PEM template infos
     35    $url = PEM_URL . '/api/get_revision_list.php?format=php&last_revision_only=true';
     36    $url .= '&version=' . implode(',', $versions_to_check);
     37    //$url .= '&lang=' . substr($user['language'], 0, 2);
     38        $url .= '&extension_include=135';
     39    fetchRemote($url, $result);
     40      $pem_res = @unserialize($result);
     41          foreach($pem_res as $pem_floPure)
     42          {
     43      if (!is_array($pem_floPure))
     44      {
     45                $template->assign(
     46                        array(
     47                          'erreur' => 'erreur url : '.$url,
     48                        )
     49                  );
     50      }
     51
     52
     53                if (!$floPure->floPure_version_compare($floPure_conf['version'], $pem_floPure['revision_name']))
     54                {
     55                        $template->assign(
     56                                array(
     57                                  'test' => '<br />non à jour<br />',
     58                                )
     59                          );
     60                }
     61                else
     62                {
     63                                $template->assign(
     64                                array(
     65                                  'test' => '<br />à jour<br />',
     66                                )
     67                          );
     68               
     69                }
     70          }
     71       
     72}
     73
     74{/php}
     75{$erreur}
     76{$test}
    377{if !empty($PLUGIN_INDEX_CONTENT_BEFORE)}{$PLUGIN_INDEX_CONTENT_BEFORE}{/if}
    478<div id="content" class="content">
Note: See TracChangeset for help on using the changeset viewer.