fully upgrade phpcake

This commit is contained in:
Niko Storni 2018-12-03 18:09:10 -05:00
parent ed508182b5
commit 70c04cca47
19 changed files with 85 additions and 54 deletions

View file

@ -1,4 +1,6 @@
<?php
namespace App\config;
return [
/**
* Debug Level:

View file

@ -15,22 +15,19 @@
// You can remove this if you are confident that your PHP version is sufficient.
if (version_compare(PHP_VERSION, '5.6.0') < 0) {
trigger_error('Your PHP version must be equal or higher than 5.6.0 to use CakePHP.', E_USER_ERROR);
}
trigger_error('Your PHP version must be equal or higher than 5.6.0 to}
/*
* You can remove this if you are confident you have intl installed.
*/
if (!extension_loaded('intl')) {
trigger_error('You must enable the intl extension to use CakePHP.', E_USER_ERROR);
}
trigger_error('You must enable the intl extension to}
/*
* You can remove this if you are confident you have mbstring installed.
*/
if (!extension_loaded('mbstring')) {
trigger_error('You must enable the mbstring extension to use CakePHP.', E_USER_ERROR);
}
trigger_error('You must enable the mbstring extension to}
/*
* Configure paths required to find CakePHP + general filepath
@ -49,20 +46,6 @@ require __DIR__ . '/paths.php';
*/
require CORE_PATH . 'config' . DS . 'bootstrap.php';
use Cake\Cache\Cache;
use Cake\Console\ConsoleErrorHandler;
use Cake\Core\App;
use Cake\Core\Configure;
use Cake\Core\Configure\Engine\PhpConfig;
use Cake\Core\Plugin;
use Cake\Database\Type;
use Cake\Datasource\ConnectionManager;
use Cake\Error\ErrorHandler;
use Cake\Log\Log;
use Cake\Mailer\Email;
use Cake\Network\Request;
use Cake\Utility\Inflector;
use Cake\Utility\Security;
/*
* Read configuration file and inject configuration into various

View file

@ -12,6 +12,8 @@
* @since 3.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace App\config;
use Cake\Core\Configure;
use Cake\Core\Exception\MissingPluginException;
use Cake\Core\Plugin;

View file

@ -1,5 +1,7 @@
<?php
namespace App\config;
return [
'Lbry' => [
'RpcUrl' => 'http://user:password@127.0.0.1:9245',

View file

@ -11,6 +11,8 @@
* @since 3.0.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
namespace App\config;
/**
* Use the DS to separate the directories in other defines

39
config/requirements.php Normal file
View file

@ -0,0 +1,39 @@
<?php
/**
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link https://cakephp.org CakePHP(tm) Project
* @since 3.5.0
* @license https://opensource.org/licenses/mit-license.php MIT License
*/
/*
* You can empty out this file, if you are certain that you match all requirements.
*/
/*
* You can remove this if you are confident that your PHP version is sufficient.
*/
if (version_compare(PHP_VERSION, '5.6.0') < 0) {
trigger_error('Your PHP version must be equal or higher than 5.6.0 to use CakePHP.' . PHP_EOL, E_USER_ERROR);
}
/*
* You can remove this if you are confident you have intl installed.
*/
if (!extension_loaded('intl')) {
trigger_error('You must enable the intl extension to use CakePHP.' . PHP_EOL, E_USER_ERROR);
}
/*
* You can remove this if you are confident you have mbstring installed.
*/
if (!extension_loaded('mbstring')) {
trigger_error('You must enable the mbstring extension to use CakePHP.' . PHP_EOL, E_USER_ERROR);
}

View file

@ -18,10 +18,6 @@
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Cake\Core\Plugin;
use Cake\Routing\RouteBuilder;
use Cake\Routing\Router;
use Cake\Routing\Route\DashedRoute;
/**
* The default class to use for all routes

View file

@ -16,6 +16,7 @@
namespace App;
use Cake\Core\Configure;
use Cake\Core\Plugin;
use Cake\Error\Middleware\ErrorHandlerMiddleware;
use Cake\Http\BaseApplication;
use Cake\Routing\Middleware\AssetMiddleware;

View file

@ -47,7 +47,7 @@ class Installer
if (in_array($arg, ['Y', 'y', 'N', 'n'])) {
return $arg;
}
throw new Exception('This is not a valid answer. Please choose Y or n.');
throw new \Exception('This is not a valid answer. Please choose Y or n.');
};
$setFolderPermissions = $io->askAndValidate(
'<info>Set Folder Permissions ? (Default to Y)</info> [<comment>Y,n</comment>]? ',

View file

@ -2,6 +2,7 @@
namespace App\Controller;
use App\Controller\AppController;
use Cake\Datasource\ConnectionManager;
use Cake\Log\Log;

View file

@ -14,6 +14,7 @@
*/
namespace App\Controller;
use App\Controller\AppController;
use Cake\Event\Event;
/**

View file

@ -2,17 +2,18 @@
namespace App\Controller;
use Mdanter\Ecc\EccFactory;
use Mdanter\Ecc\Crypto\Signature\Signer;
use Mdanter\Ecc\Serializer\PublicKey\PemPublicKeySerializer;
use Mdanter\Ecc\Serializer\PublicKey\DerPublicKeySerializer;
use Mdanter\Ecc\Serializer\Signature\DerSignatureSerializer;
use App\Controller\AppController;
use Cake\Core\Configure;
use Cake\Datasource\ConnectionManager;
use Cake\Log\Log;
use Endroid\QrCode\ErrorCorrectionLevel;
use Endroid\QrCode\LabelAlignment;
use Endroid\QrCode\QrCode;
use Mdanter\Ecc\Crypto\Signature\Signer;
use Mdanter\Ecc\EccFactory;
use Mdanter\Ecc\Serializer\PublicKey\DerPublicKeySerializer;
use Mdanter\Ecc\Serializer\PublicKey\PemPublicKeySerializer;
use Mdanter\Ecc\Serializer\Signature\DerSignatureSerializer;
class MainController extends AppController {

View file

@ -14,6 +14,7 @@
*/
namespace App\Controller;
use App\Controller\AppController;
use Cake\Core\Configure;
use Cake\Http\Exception\ForbiddenException;
use Cake\Http\Exception\NotFoundException;

View file

@ -2,9 +2,9 @@
namespace App\Model\Behavior;
use Cake\Event\Event;
use Cake\ORM\Behavior;
use Cake\ORM\Entity;
use Cake\Event\Event;
use Cake\Routing\Router;
class SimpleAuditBehavior extends Behavior {

View file

@ -1339,8 +1339,8 @@ print_r($response); print_r($json);
$inputs[] = [
'PrevoutHash' => $in['txid'],
'PrevoutN' => $in['vout'],
'ScriptSigAsm' => $in['scriptSig']['asm'],
'ScriptSigHex' => $in['scriptSig']['hex'],
'ScriptSigAsm' => $in->scriptSig['asm'],
'ScriptSigHex' => $in->scriptSig['hex'],
'Sequence' => $in['sequence']
];
}
@ -1350,16 +1350,16 @@ print_r($response); print_r($json);
$outputs[] = [
'Vout' => $out['vout'],
'Value' => bcdiv($out['value'], 100000000, 8),
'Type' => isset($out['scriptPubKey']['type']) ? $out['scriptPubKey']['type'] : '',
'ScriptPubKeyAsm' => isset($out['scriptPubKey']['asm']) ? $out['scriptPubKey']['asm'] : '',
'ScriptPubKeyHex' => isset($out['scriptPubKey']['hex']) ? $out['scriptPubKey']['hex'] : '',
'RequiredSignatures' => isset($out['scriptPubKey']['reqSigs']) ? $out['scriptPubKey']['reqSigs'] : '',
'Hash160' => isset($out['scriptPubKey']['hash160']) ? $out['scriptPubKey']['hash160'] : '',
'Addresses' => isset($out['scriptPubKey']['addresses']) ? json_encode($out['scriptPubKey']['addresses']) : null
'Type' => isset($out->scriptPubKey['type']) ? $out->scriptPubKey['type'] : '',
'ScriptPubKeyAsm' => isset($out->scriptPubKey['asm']) ? $out->scriptPubKey['asm'] : '',
'ScriptPubKeyHex' => isset($out->scriptPubKey['hex']) ? $out->scriptPubKey['hex'] : '',
'RequiredSignatures' => isset($out->scriptPubKey['reqSigs']) ? $out->scriptPubKey['reqSigs'] : '',
'Hash160' => isset($out->scriptPubKey['hash160']) ? $out->scriptPubKey['hash160'] : '',
'Addresses' => isset($out->scriptPubKey['addresses']) ? json_encode($out->scriptPubKey['addresses']) : null
];
if (isset($out['scriptPubKey']['addresses'])) {
foreach ($out['scriptPubKey']['addresses'] as $address) {
if (isset($out->scriptPubKey['addresses'])) {
foreach ($out->scriptPubKey['addresses'] as $address) {
$addresses[$address] = $address;
}
}
@ -1983,10 +1983,10 @@ print_r($response); print_r($json);
$return = $define[$tx_type];
if ($tx_type === 'p2pk') {
$return['hash160'] = self::hash160($data[$define[$tx_type]['data_index_for_hash']]);
$return['addresses'][0] = self::hash160_to_address($return['hash160'], self::pubKeyAddress[0]);
$return->addresses[0] = self::hash160_to_address($return['hash160'], self::pubKeyAddress[0]);
} else {
$return['hash160'] = $data[$define[$tx_type]['data_index_for_hash']];
$return['addresses'][0] = self::hash160_to_address($return['hash160'], ($tx_type === 'p2sh') ? self::scriptAddress[0] : self::pubKeyAddress[0]); // TODO: Pay to claim transaction?
$return->addresses[0] = self::hash160_to_address($return['hash160'], ($tx_type === 'p2sh') ? self::scriptAddress[0] : self::pubKeyAddress[0]); // TODO: Pay to claim transaction?
}
unset($return['data_index_for_hash']);
}

View file

@ -110,7 +110,7 @@ if (strlen(trim($desc)) == 0) {
<div class="desc">This is an identity claim.</div>
<?php else: ?>
<div class="title"><?php echo $claim->Title ?></div>
<div class="desc"><?php echo str_replace("\n", '<br />', $desc) ?></div>
<div class="desc"><?php echo str_replace("\n", '<br/>', $desc) ?></div>
<div class="details">
<div class="label half-width">Author</div>

View file

@ -113,7 +113,7 @@
<div class="home-container">
<div class="home-container-cell">
<div class="main">
<div class="title">LBRY Block Explorer</div><br>
<div class="title">LBRY Block Explorer</div><br/>
<form method="get" action="/find">
<input class="search-input" name="q" type="text" placeholder="Enter a block height or hash, claim id or name, transaction hash or address" />
<div class="ctls">

View file

@ -92,14 +92,14 @@
$setAddressIds = [];
foreach ($inputs as $in):
?>
<div id="input-<?php echo $in->Id ?>" class="input <?php if (isset($in['InputAddresses']) && count($in['InputAddresses']) > 0 && $in['InputAddresses'][0]->Address == $sourceAddress): ?>is-source<?php endif; ?>">
<div id="input-<?php echo $in->Id ?>" class="input <?php if (isset($in['InputAddresses']) && count($in['InputAddresses']) > 0 && $in->inputAddresses[0]->Address == $sourceAddress): ?>is-source<?php endif; ?>">
<?php if ($in['IsCoinbase']): ?>
<div>Block Reward (New Coins)</div>
<?php else: ?>
<?php if (strlen(trim($in->Value)) == 0): ?>
<div>Incomplete data</div>
<?php else:
$addr = $in['InputAddresses'][0];
$addr = $in->inputAddresses[0];
if (!isset($setAddressIds[$addr->Address])):
$setAddressIds[$addr->Address] = 1; ?>
@ -134,7 +134,7 @@
<?php
foreach ($outputs as $out): ?>
<div id="output-<?php echo $out->Vout ?>" class="output <?php if (isset($out['OutputAddresses']) && count($out['OutputAddresses']) > 0 && $out['OutputAddresses'][0]->Address == $sourceAddress): ?>is-source<?php endif; ?>">
<div id="output-<?php echo $out->Vout ?>" class="output <?php if (isset($out['OutputAddresses']) && count($out['OutputAddresses']) > 0 && $out->outputAddresses[0]->Address == $sourceAddress): ?>is-source<?php endif; ?>">
<div class="labels">
<?php if($out->Claim && ($out->IsClaim or $out->IsSupportClaim or $out->IsUpdateClaim)): ?><a class="view-claim" href="<?php echo $out->Claim->getExplorerLink() ?>">View</a><?php endif; ?>
<?php if($out->IsSupportClaim): ?><div class="support">SUPPORT</div><?php endif; ?>
@ -145,7 +145,7 @@
<?php if (strlen(trim($out['Value'])) == 0): ?>
<div>Incomplete data</div>
<?php else:
$addr = $out['OutputAddresses'][0];
$addr = $out->outputAddresses[0];
if (!isset($setAddressIds[$addr->Address])):
$setAddressIds[$addr->Address] = 1; ?>

View file

@ -59,8 +59,8 @@ $cakeDescription = 'CakePHP: the rapid development PHP framework';
<div id="url-rewriting-warning" class="alert url-rewriting">
<ul>
<li class="bullet problem">
URL rewriting is not properly configured on your server.<br />
1) <a target="_blank" href="http://book.cakephp.org/3.0/en/installation.html#url-rewriting">Help me configure it</a><br />
URL rewriting is not properly configured on your server.<br/>
1) <a target="_blank" href="http://book.cakephp.org/3.0/en/installation.html#url-rewriting">Help me configure it</a><br/>
2) <a target="_blank" href="http://book.cakephp.org/3.0/en/development/configuration.html#general-configuration">I don't / can't use URL rewriting</a>
</li>
</ul>
@ -139,7 +139,7 @@ $cakeDescription = 'CakePHP: the rapid development PHP framework';
if (method_exists($connectionError, 'getAttributes')):
$attributes = $connectionError->getAttributes();
if (isset($errorMsg['message'])):
$errorMsg .= '<br />' . $attributes['message'];
$errorMsg .= '<br/>' . $attributes['message'];
endif;
endif;
}
@ -148,7 +148,7 @@ $cakeDescription = 'CakePHP: the rapid development PHP framework';
<?php if ($connected): ?>
<li class="bullet success">CakePHP is able to connect to the database.</li>
<?php else: ?>
<li class="bullet problem">CakePHP is NOT able to connect to the database.<br /><?= $errorMsg ?></li>
<li class="bullet problem">CakePHP is NOT able to connect to the database.<br/><?= $errorMsg ?></li>
<?php endif; ?>
</ul>
</div>
@ -188,7 +188,7 @@ $cakeDescription = 'CakePHP: the rapid development PHP framework';
<div class="columns large-12 text-center">
<h3 class="more">More about Cake</h3>
<p>
CakePHP is a rapid development framework for PHP which uses commonly known design patterns like Front Controller and MVC.<br />
CakePHP is a rapid development framework for PHP which uses commonly known design patterns like Front Controller and MVC.<br/>
Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility.
</p>
</div>