Merge pull request 'Fix PHPStan errors on level 0' (#1575) from MrPetovan/friendica-addons:bug/Art4-1367 into develop
Reviewed-on: https://git.friendi.ca/friendica/friendica-addons/pulls/1575develop
commit
93a91a95e9
|
@ -192,9 +192,30 @@ function advancedcontentfilter_init()
|
|||
if (DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] == 'api') {
|
||||
$slim = \Slim\Factory\AppFactory::create();
|
||||
|
||||
require __DIR__ . '/src/middlewares.php';
|
||||
/**
|
||||
* The routing middleware should be added before the ErrorMiddleware
|
||||
* Otherwise exceptions thrown from it will not be handled
|
||||
*/
|
||||
$slim->addRoutingMiddleware();
|
||||
|
||||
$slim->addErrorMiddleware(true, true, true, DI::logger());
|
||||
|
||||
// register routes
|
||||
$slim->group('/advancedcontentfilter/api', function (\Slim\Routing\RouteCollectorProxy $app) {
|
||||
$app->group('/rules', function (\Slim\Routing\RouteCollectorProxy $app) {
|
||||
$app->get('', 'advancedcontentfilter_get_rules');
|
||||
$app->post('', 'advancedcontentfilter_post_rules');
|
||||
|
||||
$app->get('/{id}', 'advancedcontentfilter_get_rules_id');
|
||||
$app->put('/{id}', 'advancedcontentfilter_put_rules_id');
|
||||
$app->delete('/{id}', 'advancedcontentfilter_delete_rules_id');
|
||||
});
|
||||
|
||||
$app->group('/variables', function (\Slim\Routing\RouteCollectorProxy $app) {
|
||||
$app->get('/{guid}', 'advancedcontentfilter_get_variables_guid');
|
||||
});
|
||||
});
|
||||
|
||||
require __DIR__ . '/src/routes.php';
|
||||
$slim->run();
|
||||
|
||||
exit;
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2020, Friendica
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\DI;
|
||||
|
||||
/** @var $slim \Slim\App */
|
||||
|
||||
/**
|
||||
* The routing middleware should be added before the ErrorMiddleware
|
||||
* Otherwise exceptions thrown from it will not be handled
|
||||
*/
|
||||
$slim->addRoutingMiddleware();
|
||||
|
||||
$errorMiddleware = $slim->addErrorMiddleware(true, true, true, DI::logger());
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2020, Friendica
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/* @var $slim Slim\App */
|
||||
$slim->group('/advancedcontentfilter/api', function (\Slim\Routing\RouteCollectorProxy $app) {
|
||||
$app->group('/rules', function (\Slim\Routing\RouteCollectorProxy $app) {
|
||||
$app->get('', 'advancedcontentfilter_get_rules');
|
||||
$app->post('', 'advancedcontentfilter_post_rules');
|
||||
|
||||
$app->get('/{id}', 'advancedcontentfilter_get_rules_id');
|
||||
$app->put('/{id}', 'advancedcontentfilter_put_rules_id');
|
||||
$app->delete('/{id}', 'advancedcontentfilter_delete_rules_id');
|
||||
});
|
||||
|
||||
$app->group('/variables', function (\Slim\Routing\RouteCollectorProxy $app) {
|
||||
$app->get('/{guid}', 'advancedcontentfilter_get_variables_guid');
|
||||
});
|
||||
});
|
|
@ -762,13 +762,13 @@ class CodebirdSN
|
|||
* @param string $method The API method to call
|
||||
* @param array $params The parameters to send along
|
||||
*
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
protected function _buildMultipart($method, $params)
|
||||
{
|
||||
// well, files will only work in multipart methods
|
||||
if (! $this->_detectMultipart($method)) {
|
||||
return;
|
||||
return '';
|
||||
}
|
||||
|
||||
// only check specific parameters
|
||||
|
@ -783,7 +783,7 @@ class CodebirdSN
|
|||
);
|
||||
// method might have files?
|
||||
if (! in_array($method, array_keys($possible_files))) {
|
||||
return;
|
||||
return '';
|
||||
}
|
||||
|
||||
$possible_files = explode(' ', $possible_files[$method]);
|
||||
|
@ -794,7 +794,6 @@ class CodebirdSN
|
|||
// is it an array?
|
||||
if (is_array($value)) {
|
||||
throw new \Exception('Using URL-encoded parameters is not supported for uploading media.');
|
||||
continue;
|
||||
}
|
||||
|
||||
// check for filenames
|
||||
|
|
|
@ -70,6 +70,7 @@ class tictac {
|
|||
private $dimen;
|
||||
private $first_move = true;
|
||||
private $handicap = 0;
|
||||
private $mefirst;
|
||||
private $yours;
|
||||
private $mine;
|
||||
private $winning_play;
|
||||
|
@ -163,8 +164,8 @@ class tictac {
|
|||
|
||||
function __construct($dimen, $handicap, $mefirst, $yours, $mine) {
|
||||
$this->dimen = 3;
|
||||
$this->handicap = (($handicap) ? 1 : 0);
|
||||
$this->mefirst = (($mefirst) ? 1 : 0);
|
||||
$this->handicap = $handicap ? 1 : 0;
|
||||
$this->mefirst = $mefirst ? 1 : 0;
|
||||
$this->yours = str_replace('XXX','',$yours);
|
||||
$this->mine = $mine;
|
||||
$this->you = $this->parse_moves('you');
|
||||
|
@ -175,6 +176,7 @@ class tictac {
|
|||
}
|
||||
|
||||
function play() {
|
||||
$o = '';
|
||||
|
||||
if($this->first_move) {
|
||||
if(rand(0,1) == 1) {
|
||||
|
@ -629,7 +631,7 @@ function winning_move() {
|
|||
function draw_board() {
|
||||
if(! strlen($this->yours))
|
||||
$this->yours = 'XXX';
|
||||
$o .= "<form action=\"tictac/{$this->handicap}/{$this->mefirst}/{$this->dimen}/{$this->yours}/{$this->mine}\" method=\"post\" />";
|
||||
$o = "<form action=\"tictac/{$this->handicap}/{$this->mefirst}/{$this->dimen}/{$this->yours}/{$this->mine}\" method=\"post\" />";
|
||||
for($x = 0; $x < $this->dimen; $x ++) {
|
||||
$o .= '<table>';
|
||||
for($y = 0; $y < $this->dimen; $y ++) {
|
||||
|
|
Loading…
Reference in New Issue