mirror of
https://github.com/gtbu/Typesetter-5.3-p8.git
synced 2025-07-02 12:53:14 +02:00
minor corrections
This commit is contained in:
parent
877dfd67e3
commit
9cf811c8f2
2 changed files with 17 additions and 33 deletions
|
@ -1,11 +1,10 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace gp{
|
||||
|
||||
|
||||
use intltime;
|
||||
use function \intltime\strftime;
|
||||
|
||||
|
||||
defined('is_running') or die('Not an entry point...');
|
||||
|
||||
class tool{
|
||||
|
@ -1116,7 +1115,7 @@ use function \intltime\strftime;
|
|||
self::GetLangFile();
|
||||
self::GetPagesPHP();
|
||||
|
||||
//upgrade?
|
||||
//upgrade? - now superflous 5.x!
|
||||
if( version_compare($config['gpversion'], '2.3.4', '<') ){
|
||||
new \gp\tool\Upgrade();
|
||||
}
|
||||
|
@ -1350,22 +1349,22 @@ use function \intltime\strftime;
|
|||
* @param int $len length of string to return
|
||||
* @param bool $cases Whether or not to use upper and lowercase characters
|
||||
*/
|
||||
public static function RandomString($len = 40, $cases = true)
|
||||
public static function RandomString(int $len = 40, bool $cases = true): string
|
||||
{
|
||||
$string = 'abcdefghijklmnopqrstuvwxyz1234567890';
|
||||
if ($cases) {
|
||||
$string .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
}
|
||||
$alphabet = 'abcdefghijklmnopqrstuvwxyz1234567890';
|
||||
if ($cases) {
|
||||
$alphabet .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
}
|
||||
|
||||
$result = '';
|
||||
$max = strlen($string) - 1;
|
||||
$alphabetLength = strlen($alphabet);
|
||||
$result = '';
|
||||
|
||||
for ($i = 0; $i < $len; $i++) {
|
||||
// random_int is cryptographically secure
|
||||
$result .= $string[random_int(0, $max)];
|
||||
}
|
||||
for ($i = 0; $i < $len; $i++) {
|
||||
$index = random_int(0, $alphabetLength - 1);
|
||||
$result .= $alphabet[$index];
|
||||
}
|
||||
|
||||
return $result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -10,29 +10,14 @@ class Upgrade{
|
|||
function __construct(){
|
||||
global $config;
|
||||
|
||||
|
||||
if( version_compare($config['gpversion'],'1.6','<') ){
|
||||
die('Please upgrade to version 1.6, then 1.7 before upgrading to this version. You current version is '.$config['gpversion']);
|
||||
}
|
||||
|
||||
if( version_compare($config['gpversion'],'1.7a2','<') ){
|
||||
die('Please upgrade to version 1.7 before upgrading to this version. You current version is '.$config['gpversion']);
|
||||
}
|
||||
|
||||
if( version_compare($config['gpversion'],'1.8a1','<') ){
|
||||
die('Please upgrade to version 2.0 before upgrading to this version. You current version is '.$config['gpversion']);
|
||||
}
|
||||
|
||||
if( version_compare($config['gpversion'],'2.3.4','<') ){
|
||||
$this->Upgrade_234();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the gp_index, gp_titles and menus so that special pages can be renamed
|
||||
*
|
||||
* not for gpeasy 2.3.4 - superflous
|
||||
*/
|
||||
function Upgrade_234(){
|
||||
global $gp_index, $gp_titles, $gp_menu, $config, $dataDir;
|
||||
|
@ -63,7 +48,7 @@ class Upgrade{
|
|||
return;
|
||||
}
|
||||
|
||||
$config['gpversion'] = '2.3.4';
|
||||
$config['gpversion'] = '5.2.1';
|
||||
\gp\admin\Tools::SaveConfig();
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue