Dotclear

Changeset 3390:8cc44296f7b0


Ignore:
Timestamp:
11/04/16 11:47:26 (9 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Check minimum version of PHP required before giving access to auto-update

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • admin/index.php

    r3260 r3390  
    214214 
    215215     if ($updater->getNotify() && $new_v) { 
    216           echo 
    217           '<div class="dc-update"><h3>'.sprintf(__('Dotclear %s is available!'),$new_v).'</h3> '. 
    218           '<p><a class="button submit" href="'.$core->adminurl->get("admin.update").'">'.sprintf(__('Upgrade now'),$new_v).'</a> '. 
    219           '<a class="button" href="'.$core->adminurl->get("admin.update", array('hide_msg' => 1)).'">'.__('Remind me later').'</a>'. 
    220           ($version_info ? ' </p>'. 
    221           '<p class="updt-info"><a href="'.$version_info.'">'.__('Information about this version').'</a>' : '').'</p>'. 
    222           '</div>'; 
     216          // Check PHP version required 
     217          if (version_compare(phpversion(),$updater->getPHPVersion()) >= 0) { 
     218               echo 
     219               '<div class="dc-update"><h3>'.sprintf(__('Dotclear %s is available!'),$new_v).'</h3> '. 
     220               '<p><a class="button submit" href="'.$core->adminurl->get("admin.update").'">'.sprintf(__('Upgrade now'),$new_v).'</a> '. 
     221               '<a class="button" href="'.$core->adminurl->get("admin.update", array('hide_msg' => 1)).'">'.__('Remind me later').'</a>'. 
     222               ($version_info ? ' </p>'. 
     223               '<p class="updt-info"><a href="'.$version_info.'">'.__('Information about this version').'</a>' : '').'</p>'. 
     224               '</div>'; 
     225          } 
    223226     } 
    224227} 
  • admin/update.php

    r2818 r3390  
    203203          echo 
    204204               '<p class="static-msg">'.sprintf(__('Dotclear %s is available.'),$new_v). 
    205                     ($version_info ? ' <a href="'.$version_info.'" class="outgoing" title="'.__('Information about this version').'">('. 
    206                          __('Information about this version').')&nbsp;<img src="images/outgoing.png" alt=""/></a>' : ''). 
    207                     '</p>'. 
    208  
    209           '<p>'.__('To upgrade your Dotclear installation simply click on the following button. '. 
    210                'A backup file of your current installation will be created in your root directory.').'</p>'. 
    211           '<form action="'.$p_url.'" method="get">'. 
    212           '<p><input type="hidden" name="step" value="check" />'. 
    213           '<input type="submit" value="'.__('Update Dotclear').'" /></p>'. 
    214           '</form>'; 
     205               ($version_info ? ' <a href="'.$version_info.'" class="outgoing" title="'.__('Information about this version').'">('. 
     206               __('Information about this version').')&nbsp;<img src="images/outgoing.png" alt=""/></a>' : ''). 
     207               '</p>'; 
     208          if (version_compare(phpversion(),$updater->getPHPVersion()) < 0) { 
     209               echo 
     210               '<p class="warning-msg">'.sprintf(__('PHP version is %s (%s or earlier needed).'),phpversion(),$updater->getPHPVersion()).'</p>'; 
     211          } else { 
     212               echo 
     213               '<p>'.__('To upgrade your Dotclear installation simply click on the following button. '. 
     214                    'A backup file of your current installation will be created in your root directory.').'</p>'. 
     215               '<form action="'.$p_url.'" method="get">'. 
     216               '<p><input type="hidden" name="step" value="check" />'. 
     217               '<input type="submit" value="'.__('Update Dotclear').'" /></p>'. 
     218               '</form>'; 
     219          } 
    215220     } 
    216221     echo '</div>'; 
  • inc/core/class.dc.update.php

    r3350 r3390  
    2828          'checksum' => null, 
    2929          'info' => null, 
     30          'php' => '5.3', 
    3031          'notify' => true 
    3132     ); 
     
    5859      * @return string                  Latest version if available 
    5960      */ 
    60      public function check($version, $nocache=false) 
     61     public function check($version,$nocache=false) 
    6162     { 
    6263          $this->getVersionInfo($nocache); 
     
    158159     { 
    159160          return $this->version_info['checksum']; 
     161     } 
     162 
     163     public function getPHPVersion() 
     164     { 
     165          return $this->version_info['php']; 
    160166     } 
    161167 
     
    453459                    $this->version_info['checksum'] = isset($r['checksum']) ? (string) $r['checksum'] : null; 
    454460                    $this->version_info['info'] = isset($r['info']) ? (string) $r['info'] : null; 
     461                    $this->version_info['php'] = isset($r['php']) ? (string) $r['php'] : null; 
    455462               } 
    456463          } 
  • locales/fr/main.po

    r3342 r3390  
    10651065msgstr "La version de PHP est %s (5.3 ou plus récente nécessaire)." 
    10661066 
     1067#, php-format 
     1068msgid "PHP version is %s (%s or earlier needed)." 
     1069msgstr "La version de PHP est %s (%s ou plus récente nécessaire)." 
     1070 
    10671071msgid "Multibyte string module (mbstring) is not available." 
    10681072msgstr "Le support des chaînes multi-octets (mbstring) n'est pas disponible." 
Note: See TracChangeset for help on using the changeset viewer.

Sites map