<?php

/*
 * Additional rules or rules to override.
 * These rules will be added to default rules or will override them if the same key already exists.
 */

$additionalRules = [];
$rulesProvider = new Facile\CodingStandards\Rules\CompositeRulesProvider([
    new Facile\CodingStandards\Rules\DefaultRulesProvider(),
    new Facile\CodingStandards\Rules\ArrayRulesProvider($additionalRules),
]);

$config = new PhpCsFixer\Config();
$config->setRules($rulesProvider->getRules());

$finder = new PhpCsFixer\Finder();

/*
 * You can set manually these paths:
 */
$autoloadPathProvider = new Facile\CodingStandards\AutoloadPathProvider();
$finder->in($autoloadPathProvider->getPaths());

$config->setFinder($finder);

return $config;

<?php

/*
 * Additional rules or rules to override.
 * These rules will be added to default rules or will override them if the same key already exists.
 */

$additionalRules = [
    // see https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/4446
    'phpdoc_to_comment' => false,
];
$rulesProvider = new Facile\CodingStandards\Rules\CompositeRulesProvider([
    new Facile\CodingStandards\Rules\DefaultRulesProvider(),
    new Facile\CodingStandards\Rules\ArrayRulesProvider($additionalRules),
]);

$config = new PhpCsFixer\Config();
$config->setRules($rulesProvider->getRules());

$finder = new PhpCsFixer\Finder();

/*
 * You can set manually these paths:
 */
$autoloadPathProvider = new Facile\CodingStandards\AutoloadPathProvider();
$finder->in($autoloadPathProvider->getPaths());

$config->setFinder($finder);

return $config;

Disable phpdoc_to_comment CS rule to avoid issues with Psalm annotations


<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/

Route::get('/', function()
{
	return View::make('hello');
});

Route::resource('players', 'PlayersController');
Route::resource('users', 'UsersController');

<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/

Route::get('/', function()
{
	return View::make('hello');
});

Route::resource('users', 'UsersController');

Remove no longer used route.

Remove no longer used route.


<?php

/**
 * Log the feedback information
 * The token can be traced to a student ID for feedback follow-up
 * The user agent can be used to debug front-end/visual bugs
 */

// We can send the user back to the page they were on once completed
$ref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/';

if (isset($_POST['feedbacktxt']) && isset($_POST['token'])) {

  $feedbacktxt = $_POST['feedbacktxt'];
  $token = $_POST['token'];

  $ua = $_SERVER['HTTP_USER_AGENT'];
  $time = time();

  $msg = "Feedback:\r\n".$feedbacktxt."\r\n\r\nToken: ".$token."\r\nUser Agent: ".$ua."\r\nTimestamp: ".$time;
  $headers = 'From: AWESOME Feedback Form <awesome@bbrks.me>';

  mail('ben@bbrks.me', '[AWESOME FEEDBACK]', $msg, $headers);

  echo 'Thank you for your feedback. Redirecting in 3 seconds.';

} else {
  echo 'Error: No feedback was sent! Redirecting in 3 seconds.';
}

echo '<meta http-equiv="refresh" content="3; url='.$ref.'" />';

<?php

/**
 * Log the feedback information
 * The token can be traced to a student ID for feedback follow-up
 * The user agent can be used to debug front-end/visual bugs
 */

// We can send the user back to the page they were on once completed
$ref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/';

if (isset($_POST['feedbacktxt']) && isset($_POST['token'])) {

  ini_set('SMTP', 'smtphost.aber.ac.uk');
  ini_set('sendmail_from', Config::MAIL_FROM_ADDR);

  $feedbacktxt = $_POST['feedbacktxt'];
  $token = $_POST['token'];

  $ua = $_SERVER['HTTP_USER_AGENT'];
  $time = time();

  $msg = "Feedback:\r\n".$feedbacktxt."\r\n\r\nToken: ".$token."\r\nUser Agent: ".$ua."\r\nTimestamp: ".$time;

  mail('ben@bbrks.me', '[AWESOME FEEDBACK]', $msg);

  echo 'Thank you for your feedback. Redirecting in 3 seconds.';

} else {
  echo 'Error: No feedback was sent! Redirecting in 3 seconds.';
}

echo '<meta http-equiv="refresh" content="3; url='.$ref.'" />';

Make feedback form use smtphost too

Make feedback form use smtphost too


<?php
	# Member template for the 'medlem' shortcode function

	# The $meta includes member info
	# Uses a $content variable if available, otherwise the meta description of the actual member.

	$year = $meta['it_year'];
	$description = ($content != null) ? $content : $meta['description'];
	$avatar_size = ($args != null) ? $args['avatar_size'] : 96;
?>

		<?php echo get_avatar($id, $avatar_size); ?>

		<?php if($role) : ?>
		<hgroup>

<?php user_fullname(get_userdata($id));?>

<?php echo $role;?>

		</hgroup>
		<?php else : ?>

<?php user_fullname(get_userdata($id));?>

		<?php endif;?>

			<?php echo strip_tags($description);?>

<?php
	# Member template for the 'medlem' shortcode function

	# The $meta includes member info
	# Uses a $content variable if available, otherwise the meta description of the actual member.

	$year = $meta['it_year'];
	$userdata = get_userdata($id);
	$description = ($content != null) ? $content : $meta['description'];
	$avatar_size = ($args != null) ? $args['avatar_size'] : 96;
	# Shown email may be overriden in the shortcode attribute 'contact'
	$user_contact = ($contact != null) ? $contact : $userdata->data->user_email;
?>

		<?php echo get_avatar($id, $avatar_size); ?>

		<?php if($role) : ?>
		<hgroup>

<?php user_fullname($userdata);?>

<?php echo $role;?>

		</hgroup>
		<?php else : ?>

<?php user_fullname($userdata);?>

		<?php endif;?>

			<?php echo strip_tags($description);?>

			<?php if($user_contact) : ?>
			Kontakt: <a href="mailto:<?php echo $user_contact;?>"><?php echo $user_contact;?>
			<?php endif;?>

Add attribute for 'contact' in person shortcode


<?php

declare(strict_types=1);

namespace AlterPHP\EasyAdminExtensionBundle\Helper;

use Symfony\Component\Form\FormFactory;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\RequestStack;

/**
 * This file is part of the EasyAdmin Extension package.
 */
class ListFormFiltersHelper
{
    /**
     * @var FormFactory
     */
    private $formFactory;

    /**
     * @var RequestStack
     */
    private $requestStack;

    /**
     * @var FormInterface
     */
    private $listFiltersForm;

    /**
     * @param FormFactory $formFactory
     */
    public function __construct(FormFactory $formFactory, RequestStack $requestStack)
    {
        $this->formFactory = $formFactory;
        $this->requestStack = $requestStack;
    }

    public function getListFiltersForm(array $formFilters): FormInterface
    {
        if (!isset($this->listFiltersForm)) {
            $formBuilder = $this->formFactory->createNamedBuilder('form_filters');

            foreach ($formFilters as $name => $config) {
                $formBuilder->add(
                    $name,
                    isset($config['type']) ? $config['type'] : null,
                    array_merge(
                        array('required' => false),
                        $config['type_options']
                    )
                );
            }

            $this->listFiltersForm = $formBuilder->setMethod('GET')->getForm();
            $this->listFiltersForm->handleRequest($this->requestStack->getCurrentRequest());
        }

        return $this->listFiltersForm;
    }
}

<?php

declare(strict_types=1);

namespace AlterPHP\EasyAdminExtensionBundle\Helper;

use Symfony\Component\Form\FormFactory;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\RequestStack;

/**
 * This file is part of the EasyAdmin Extension package.
 */
class ListFormFiltersHelper
{
    /**
     * @var FormFactory
     */
    private $formFactory;

    /**
     * @var RequestStack
     */
    private $requestStack;

    /**
     * @var FormInterface
     */
    private $listFiltersForm;

    /**
     * @param FormFactory $formFactory
     */
    public function __construct(FormFactory $formFactory, RequestStack $requestStack)
    {
        $this->formFactory = $formFactory;
        $this->requestStack = $requestStack;
    }

    public function getListFiltersForm(array $formFilters): FormInterface
    {
        if (!isset($this->listFiltersForm)) {
            $formBuilder = $this->formFactory->createNamedBuilder('form_filters');

            foreach ($formFilters as $name => $config) {
                $formBuilder->add(
                    $name,
                    isset($config['type']) ? $config['type'] : null,
                    array_merge(
                        array('required' => false),
                        isset($config['type_options']) ? $config['type_options'] : []
                    )
                );
            }

            $this->listFiltersForm = $formBuilder->setMethod('GET')->getForm();
            $this->listFiltersForm->handleRequest($this->requestStack->getCurrentRequest());
        }

        return $this->listFiltersForm;
    }
}

Fix unset type_options in list form_filters config


<?php

/*
 * This file is part of the Sylius package.
 *
 * (c) Paweł Jędrzejewski
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

namespace Sylius\Component\Channel\Context;

/**
 * @author Kamil Kokot <kamil@kokot.me>
 */
class ChannelNotFoundException extends \RuntimeException
{
    /**
     * {@inheritdoc}
     */
    public function __construct(?\Exception $previousException = null)
    {
        parent::__construct('Channel could not be found!', 0, $previousException);
    }
}

<?php

/*
 * This file is part of the Sylius package.
 *
 * (c) Paweł Jędrzejewski
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

namespace Sylius\Component\Channel\Context;

/**
 * @author Kamil Kokot <kamil@kokot.me>
 */
class ChannelNotFoundException extends \RuntimeException
{
    /**
     * {@inheritdoc}
     */
    public function __construct(?\Exception $previousException = null)
    {
        parent::__construct('Channel could not be found! Tip: You can use the Web Debug Toolbar to switch between channels in development.', 0, $previousException);
    }
}

[DX] Add tip about switching channel in toolbar


<?php

namespace HostBox\Components\LinkedIn\SocialPlugins;

/**
 * Class MemberProfile
 * @package HostBox\Components\LinkedIn\SocialPlugins
 *
 * @tagClass IN/MemberProfile
 */
class MemberProfile extends Profile {

    /**
     * @var string
     * @name id
     */
    public $profileUrl;

}

<?php

namespace HostBox\Components\LinkedIn\SocialPlugins;

/**
 * Class MemberProfile
 * @package HostBox\Components\LinkedIn\SocialPlugins
 *
 * @identifier IN/MemberProfile
 */
class MemberProfile extends Profile {

    /**
     * @var string
     * @name id
     */
    public $profileUrl;

}

Fix LinkedIn - Member profile plugin

Fix LinkedIn - Member profile plugin


<?php

namespace Soy\Codeception;

trait ConfigTrait
{
    /**
     * @var Config
     */
    protected $config;

    /**
     * @return string
     */
    public function getBinary()
    {
        return $this->config->getBinary();
    }

    /**
     * @param string $binary
     * @return $this
     */
    public function setBinary($binary)
    {
        $this->config->setBinary($binary);
        return $this;
    }

    /**
     * @return string
     */
    public function getConfigDirectory()
    {
        return $this->getConfigDirectory();
    }

    /**
     * @param string $configDirectory
     * @return $this
     */
    public function setConfigDirectory($configDirectory)
    {
        $this->setConfigDirectory($configDirectory);
        return $this;
    }

    /**
     * @return bool
     */
    public function isInteractionEnabled()
    {
        return $this->config->isInteractionEnabled();
    }

    /**
     * @return $this
     */
    public function enableInteraction()
    {
        $this->config->enableInteraction();
        return $this;
    }

    /**
     * @return $this
     */
    public function disableInteraction()
    {
        $this->config->disableInteraction();
        return $this;
    }
}

<?php

namespace Soy\Codeception;

trait ConfigTrait
{
    /**
     * @var Config
     */
    protected $config;

    /**
     * @return string
     */
    public function getBinary()
    {
        return $this->config->getBinary();
    }

    /**
     * @param string $binary
     * @return $this
     */
    public function setBinary($binary)
    {
        $this->config->setBinary($binary);
        return $this;
    }

    /**
     * @return string
     */
    public function getConfigDirectory()
    {
        return $this->config->getConfigDirectory();
    }

    /**
     * @param string $configDirectory
     * @return $this
     */
    public function setConfigDirectory($configDirectory)
    {
        $this->config->setConfigDirectory($configDirectory);
        return $this;
    }

    /**
     * @return bool
     */
    public function isInteractionEnabled()
    {
        return $this->config->isInteractionEnabled();
    }

    /**
     * @return $this
     */
    public function enableInteraction()
    {
        $this->config->enableInteraction();
        return $this;
    }

    /**
     * @return $this
     */
    public function disableInteraction()
    {
        $this->config->disableInteraction();
        return $this;
    }
}

Fix incorrect function config call

Fix incorrect function config call


<?php
namespace Product\Model\Mapper;
use Zend\Stdlib\Hydrator\ClassMethods;
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of ProductHydrator
 *
 * @author wangting
 */
class ProductHydrator extends ClassMethods
{
    //put your code here
    public function hydrate(array $data, $object)
    {
        $object->writeCategoryName($data['category_name']);
        return parent::hydrate($data, $object);
    }
}

?>

<?php
namespace Product\Model\Mapper;
use Zend\Stdlib\Hydrator\ClassMethods;
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of ProductHydrator
 *
 * @author wangting
 */
class ProductHydrator extends ClassMethods
{
    //put your code here
    public function hydrate(array $data, $object)
    {
        if (isset($data['category_name'])) {
            $object->writeCategoryName($data['category_name']);
        }
        return parent::hydrate($data, $object);
    }
}

?>

Check if the category name is set before using it.


<?php

/*
 * This file is part of the PcdxParameterEncryptionBundle package.
 *
 * (c) picodexter <https://picodexter.io/>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Picodexter\ParameterEncryptionBundle\DependencyInjection;

/**
 * ServiceNames.
 *
 * Contains names for this bundle's Symfony services that are referenced in the code.
 */
final class ServiceNames
{
    const ALGORITHM_CONFIGURATION = 'pcdx_parameter_encryption.configuration.algorithm_configuration';
    const ALGORITHM_PREFIX = 'pcdx_parameter_encryption.configuration.algorithm.';
    const PARAMETER_REPLACER = 'pcdx_parameter_encryption.replacement.parameter_replacer';
    const REPLACEMENT_PATTERN_ALGORITHM_PREFIX = 'pcdx_parameter_encryption.replacement.pattern.algorithm.';

    /**
     * Constructor.
     *
     * Forbid instantiation.
     */
    public function __construct()
    {
        throw new \BadMethodCallException('This class cannot be instantiated.');
    }
}

<?php

/*
 * This file is part of the PcdxParameterEncryptionBundle package.
 *
 * (c) picodexter <https://picodexter.io/>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Picodexter\ParameterEncryptionBundle\DependencyInjection;

/**
 * ServiceNames.
 *
 * Contains names for this bundle's Symfony services that are referenced in the code.
 */
final class ServiceNames
{
    const ALGORITHM_CONFIGURATION = 'pcdx_parameter_encryption.configuration.algorithm_configuration';
    const ALGORITHM_PREFIX = 'pcdx_parameter_encryption.configuration.algorithm.';
    const PARAMETER_REPLACER = 'pcdx_parameter_encryption.replacement.parameter_replacer';
    const REPLACEMENT_PATTERN_ALGORITHM_PREFIX = 'pcdx_parameter_encryption.replacement.pattern.algorithm.';
    const REPLACEMENT_PATTERN_REGISTRY = 'pcdx_parameter_encryption.replacement.pattern.registry';

    /**
     * Constructor.
     *
     * Forbid instantiation.
     */
    public function __construct()
    {
        throw new \BadMethodCallException('This class cannot be instantiated.');
    }
}

Add service name for replacement pattern registry


<?php

return [
    'layout'       => 'ui::layouts.public.full',
    'captcha'      => false,
    'identifier'   => 'email',
    'login'        => [
        'implementation' => \Laravolt\Auth\DefaultLogin::class,
    ],
    'registration' => [
        'enable'         => true,
        'status'         => 'ACTIVE',
        'implementation' => \Laravolt\Auth\DefaultUserRegistrar::class,
    ],
    'activation'   => [
        'enable'        => false,
        'status_before' => 'PENDING',
        'status_after'  => 'ACTIVE',
    ],
    'cas'          => [
        'enable' => false,
    ],
    'ldap'         => [
        'enable'   => false,
        'resolver' => [
            'ldap_user'     => \Laravolt\Auth\Services\Resolvers\LdapUserResolver::class,
            'eloquent_user' => \Laravolt\Auth\Services\Resolvers\EloquentUserResolver::class,
        ],
    ],
    'router'       => [
        'middleware' => ['web'],
        'prefix'     => 'auth',
    ],
    'redirect'     => [
        'after_login'          => '/',
        'after_register'       => '/',
        'after_reset_password' => '/',
        'after_logout'         => '/',
    ],
];

<?php

return [
    'layout'       => 'ui::layouts.public.full',
    'captcha'      => false,
    'identifier'   => 'email',
    'login'        => [
        'implementation' => \Laravolt\Auth\DefaultLogin::class,
    ],
    'registration' => [
        'enable'         => true,
        'status'         => 'ACTIVE',
        'implementation' => \Laravolt\Auth\DefaultUserRegistrar::class,
    ],
    'activation'   => [
        'enable'        => false,
        'status_before' => 'PENDING',
        'status_after'  => 'ACTIVE',
    ],
    'cas'          => [
        'enable' => false,
    ],
    'ldap'         => [
        'enable'   => false,
        'resolver' => [
            'ldap_user'     => \Laravolt\Auth\Services\Resolvers\LdapUserResolver::class,
            'eloquent_user' => \Laravolt\Auth\Services\Resolvers\EloquentUserResolver::class,
        ],
    ],
    'router'       => [
        'middleware' => ['web'],
        'prefix'     => 'auth',
    ],
    'redirect'     => [
        'after_login'          => '/',
        'after_register'       => '/',
        'after_reset_password' => '/',

        // WARNING: after_logout redirection only valid for Laravel >= 5.7
        'after_logout'         => '/',
    ],
];

Add warning about custom logout redirection


<?php

namespace MovingImage\Meta\Interfaces;

interface ChannelInterface
{
    public function getId(): int;

    public function getName(): string;

    public function getDescription(): string;

    public function getCustomMetadata(): array;

    public function getParent(): ?self;

    /**
     * @return ChannelInterface[]
     */
    public function getChildren(): array;
}

<?php

namespace MovingImage\Meta\Interfaces;

use Doctrine\Common\Collections\ArrayCollection;

interface ChannelInterface
{
    public function getId(): int;

    public function getName(): string;

    public function getDescription(): string;

    public function getCustomMetadata(): array;

    public function getParent(): ?self;

    /**
     * @return ArrayCollection<ChannelInterface>
     */
    public function getChildren(): ArrayCollection;
}

Change return type of getChildren to ArrayCollection


<?php

/*
 * Core functions.
 *
 * Don't forget to add own ones.
 */

// `encrypt`
//
// Encrypts `$str` in rot13.
function encrypt($str) {
  echo str_rot13($str);
}

// `decrypt`
//
// Decrypts `$str` from rot13.
function decrypt($str) {
  echo str_rot13(str_rot13($str));
}

// `cfile`
//
// Checks for current file.
function cfile($file) {
  if (strpos($_SERVER['PHP_SELF'], $file)) {
    echo 'class="active"';
  }
}

// `fcount`
//
// Counts number of files in a directory.
function fcount($dir) {
  $i = 0;
  if ($handle = opendir($dir)) {
    while (($file = readdir($handle)) !== false) {
      if (!in_array($file, array('.', '..')) && !is_dir($dir.$file)) {
        $i++;
      }
    }
  }
}

// `feedparse`
//
// Parses RSS feed easily.
function feedparse($url) {
  $feed = @fopen("$url", 'r');
  if ($feed) {
    $data = '';
    while (!feof($feed)) {
      $data .= fread($feed, 8192);
    }
  }
  fclose($feed);
  echo $data;
}

?>

<?php

/*
 * Core functions.
 *
 * Don't forget to add own ones.
 */

// `encrypt`
//
// Encrypts `$str` in rot13.
function encrypt($str) {
  echo str_rot13($str);
}

// `decrypt`
//
// Decrypts `$str` from rot13.
function decrypt($str) {
  echo str_rot13(str_rot13($str));
}

// `cfile`
//
// Checks for current file. Change the class name if necessary.
function cfile($file) {
  if (strpos($_SERVER['PHP_SELF'], $file)) {
    echo 'class="active"';
  }
}

// `fcount`
//
// Counts number of files in a directory.
function fcount($dir) {
  $i = 0;
  if ($handle = opendir($dir)) {
    while (($file = readdir($handle)) !== false) {
      if (!in_array($file, array('.', '..')) && !is_dir($dir.$file)) {
        $i++;
      }
    }
  }
}

// `feedparse`
//
// Parses RSS feed easily.
function feedparse($url) {
  $feed = @fopen("$url", 'r');
  if ($feed) {
    $data = '';
    while (!feof($feed)) {
      $data .= fread($feed, 8192);
    }
  }
  fclose($feed);
  echo $data;
}

?>

Add the class name note

Add the class name note


<?php

declare(strict_types=1);

/*
 * This file is part of gpupo/common
 * Created by Gilmar Pupo <contact@gpupo.com>
 * For the information of copyright and license you should read the file
 * LICENSE which is distributed with this source code.
 * Para a informação dos direitos autorais e de licença você deve ler o arquivo
 * LICENSE que é distribuído com este código-fonte.
 * Para obtener la información de los derechos de autor y la licencia debe leer
 * el archivo LICENSE que se distribuye con el código fuente.
 * For more information, see <https://opensource.gpupo.com/>.
 *
 */

use Symfony\Component\Dotenv\Dotenv;

if (!class_exists('\Gpupo\Common\Console\Application')) {
    require __DIR__.'/../vendor/autoload.php';
}

if (!class_exists(Dotenv::class)) {
    throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
}
// load all the .env files
(new Dotenv())->loadEnv(dirname(__DIR__).'/.env');

<?php

declare(strict_types=1);

/*
 * This file is part of gpupo/common
 * Created by Gilmar Pupo <contact@gpupo.com>
 * For the information of copyright and license you should read the file
 * LICENSE which is distributed with this source code.
 * Para a informação dos direitos autorais e de licença você deve ler o arquivo
 * LICENSE que é distribuído com este código-fonte.
 * Para obtener la información de los derechos de autor y la licencia debe leer
 * el archivo LICENSE que se distribuye con el código fuente.
 * For more information, see <https://opensource.gpupo.com/>.
 *
 */

use Symfony\Component\Dotenv\Dotenv;

if (!class_exists('\Gpupo\Common\Console\Application')) {
    require __DIR__.'/../vendor/autoload.php';
}

if (!class_exists(Dotenv::class)) {
    throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
}
// load all the .env files
(new Dotenv(true))->loadEnv(dirname(__DIR__).'/.env');

Update Dotenv config to the new version

Update Dotenv config to the new version


<?php

require_once('config.inc.php');
require_once('misc.inc.php');
require_once('db.inc.php');
require_once('html.inc.php');

date_default_timezone_set('Europe/Berlin');
setlocale(LC_TIME, 'deu');

session_start();

// Actual content generation:
$db = new db();

switch ($_GET['view']) {
case 'print':
    authenticate(VIEW_PRINT, 'index.php?view=print');
    if (isset($_GET['date'])) {
        $source = new ovp_print($db, $_GET['date']);
    } else {
        $source = new ovp_print($db);
    }
    break;
case 'author':
    authenticate(VIEW_AUTHOR, 'index.php?view=author');
    $source = new ovp_author($db);
    break;
case 'admin':
    authenticate(VIEW_ADMIN, 'index.php?view=admin');
    $source = new ovp_admin($db);
    break;
case 'login':
    $source = new ovp_login($db);
    break;
case 'public':
default:
    authenticate(VIEW_PUBLIC, 'index.php?view=public');
    $source = new ovp_public($db);
}

$page = new ovp_page($source);
exit($page->get_html());

?>

<?php

require_once('config.inc.php');
require_once('misc.inc.php');
require_once('db.inc.php');
require_once('html.inc.php');

date_default_timezone_set('Europe/Berlin');
setlocale(LC_TIME, 'de_DE.utf8', 'deu');

session_start();

// Actual content generation:
$db = new db();

switch ($_GET['view']) {
case 'print':
    authenticate(VIEW_PRINT, 'index.php?view=print');
    if (isset($_GET['date'])) {
        $source = new ovp_print($db, $_GET['date']);
    } else {
        $source = new ovp_print($db);
    }
    break;
case 'author':
    authenticate(VIEW_AUTHOR, 'index.php?view=author');
    $source = new ovp_author($db);
    break;
case 'admin':
    authenticate(VIEW_ADMIN, 'index.php?view=admin');
    $source = new ovp_admin($db);
    break;
case 'login':
    $source = new ovp_login($db);
    break;
case 'public':
default:
    authenticate(VIEW_PUBLIC, 'index.php?view=public');
    $source = new ovp_public($db);
}

$page = new ovp_page($source);
exit($page->get_html());

?>

Fix locales for windows and unix

Fix locales for windows and unix

Signed-off-by: Josua Grawitter <c028c213ed5efcf30c3f4fc7361dbde0c893c5b7@greyage.org>


<?php
/**
 * Copyright 2016 The Ranger <ranger@risk.ee>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

set_include_path(dirname(__FILE__)."/lib");

include_once "config.php";
include_once "Settings.php";
include_once "net/Request.php";
include_once "net/Router.php";

$cwd = getcwd();
chdir(dirname(__FILE__));

$settings = new Settings($GLOBALS["settings"]);
$router = new Router($settings);
$request = new Request($_SERVER["PHP_SELF"], $settings);

$router->route($request);
chdir($cwd);

<?php
/**
 * Copyright 2016 The Ranger <ranger@risk.ee>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

set_include_path(dirname(__FILE__)."/lib");

include_once "config.php";
include_once "Settings.php";
include_once "net/Request.php";
include_once "net/Router.php";

$cwd = getcwd();
chdir(dirname(__FILE__));

$settings = new Settings($GLOBALS["settings"]);
$router = new Router($settings);

// When invoking with PHP built-in server using router script, REDIRECT_URL is not set
// Using Apache mod_rewrite, PHP_SELF would be set to index.php
$request = new Request(isset($_SERVER["REDIRECT_URL"]) ? $_SERVER["REDIRECT_URL"] : $_SERVER["PHP_SELF"], $settings);

$router->route($request);
chdir($cwd);

Fix obtaining current URL when using mod_rewrite


<?php

/**
* Set the key paths we'll be using
* ================================
* Here we set the theme path, as well as routes to all our core assets.
*/

define('PUBLIC_THEME_PATH', parse_url(get_template_directory_uri())['path'] . '/');
define('FULL_PATH', $_SERVER['DOCUMENT_ROOT'] . PUBLIC_THEME_PATH);
define('PUBLIC_DIR', PUBLIC_THEME_PATH . 'public/');
define('STYLES_DIR', PUBLIC_DIR . 'styles/');
define('SCRIPTS_DIR', PUBLIC_DIR . 'js/');
define('IMAGES_DIR', PUBLIC_DIR . 'img/');

/**
* Initialize the app.
*/
include(FULL_PATH . 'app/bootstrap/app.php');

<?php

/**
* Set the key paths we'll be using
* ================================
* Here we set the theme path, as well as routes to all our core assets.
*/

define('PUBLIC_THEME_PATH', parse_url(get_template_directory_uri())['path'] . '/');
define('FULL_PATH', $_SERVER['DOCUMENT_ROOT'] . PUBLIC_THEME_PATH);
define('PUBLIC_DIR', PUBLIC_THEME_PATH . 'public/');
define('STYLES_DIR', PUBLIC_DIR . 'styles/');
define('SCRIPTS_DIR', PUBLIC_DIR . 'js/');
define('IMAGES_DIR', PUBLIC_DIR . 'img/');

/**
* Initialize the app.
*/
include(FULL_PATH . 'app/bootstrap/start.php');

Correct which file to load

Correct which file to load


<?php

namespace ContentTranslator\Entity;

abstract class Translate
{
    protected $lang;
    protected $db;

    public function __construct()
    {
        global $wpdb;
        $this->db = $wpdb;
        $this->lang = \ContentTranslator\Switcher::$currentLanguage->code;
    }

    /**
     * Creates a language specific meta/options key
     * @param  string $key The meta/option key
     * @return string      Langual meta/option key
     */
    protected function createLangualKey(string $key) : string
    {
        if ($this->isLangual($key)) {
            return $key;
        }

        return $key . TRANSLATE_DELIMITER . $this->lang;
    }

    /**
     * Check if key is a langual option
     * @param  string  $key Option key
     * @return boolean
     */
    protected function isLangual($key)
    {
        return substr($key, -strlen(TRANSLATE_DELIMITER . $this->lang)) == TRANSLATE_DELIMITER . $this->lang ? true : false;
    }
}

<?php

namespace ContentTranslator\Entity;

abstract class Translate
{
    protected $lang;
    protected $db;

    public function __construct()
    {
        global $wpdb;
        $this->db = $wpdb;
        $this->lang = \ContentTranslator\Switcher::$currentLanguage->code;
    }

    /**
     * Creates a language specific meta/options key
     * @param  string $key The meta/option key
     * @return string      Langual meta/option key
     */
    protected function createLangualKey(string $key) : string
    {
        if ($this->isLangual($key)) {
            return $key;
        }

        return $key . TRANSLATE_DELIMITER . $this->lang;
    }

    /**
     * Check if key is a langual option
     * @param  string  $key Option key
     * @return boolean
     */
    protected function isLangual($key)
    {
        return substr($key, -strlen(TRANSLATE_DELIMITER . $this->lang)) == TRANSLATE_DELIMITER . $this->lang ? true : false;
    }

    function install(string $language) {}
    function isInstalled(string $language) {}
    function uninstall(string $language) {}
}

Introduce three to becom abstract methods to the translate entity for install, uninstall and isInstalled


<?php

    interface IDriver
    {
        public function connect($host, $user, $password);
        public function database($name);
        public function query($sql);
        public function bind($sql, $data=[]);
        public function lastError();
    }

?>

<?php
    namespace DB\Driver;

    interface IDriver
    {
        public function connect($host, $user, $password);
        public function database($name);
        public function query($sql);
        public function bind($sql, $data=[]);
        public function lastError();
    }

?>

Add namespace to database driver interface


<?php  namespace Rossedman\Teamwork;

use Rossedman\Teamwork\Traits\RestfulTrait;

class Tasklist extends AbstractObject {

    protected $wrapper  = 'todo-list';

    protected $endpoint = 'tasklists';

    /**
     * GET /tasklists/{$id}.json
     * @return mixed
     */
    public function find()
    {
        return $this->client->get("$this->endpoint/$this->id")->response();
    }

    /**
     * PUT /todo_lists/{$id}.json
     * @return mixed
     */
    public function update($data)
    {
        return $this->client->put("$this->endpoint/$this->id", [$this->wrapper => $data])->response();
    }

    /**
     * DELETE /todo_lists/{$id}.json
     * @return mixed
     */
    public function delete()
    {
        return $this->client->delete("$this->endpoint/$this->id")->response();
    }

    /**
     * GET /tasklists/templates.json
     * @return [type] [description]
     */
    public function templates()
    {
        return $this->client->get("$this->endpoint/templates")->response();
    }

    /**
     * Time Totals
     * GET /projects/{id}/time/total.json
     *
     * @return mixed
     */
    public function timeTotal()
    {
        return $this->client->get("tasklists/$this->id/time/total")->response();
    }

}

<?php  namespace Rossedman\Teamwork;

use Rossedman\Teamwork\Traits\RestfulTrait;

class Tasklist extends AbstractObject {

    protected $wrapper  = 'todo-list';

    protected $endpoint = 'tasklists';

    /**
     * GET /tasklists/{$id}.json
     * @return mixed
     */
    public function find()
    {
        return $this->client->get("$this->endpoint/$this->id")->response();
    }

    /**
     * PUT /todo_lists/{$id}.json
     * @return mixed
     */
    public function update($data)
    {
        return $this->client->put("$this->endpoint/$this->id", [$this->wrapper => $data])->response();
    }

    /**
     * DELETE /todo_lists/{$id}.json
     * @return mixed
     */
    public function delete()
    {
        return $this->client->delete("$this->endpoint/$this->id")->response();
    }

    /**
     * GET /tasklists/templates.json
     * @return [type] [description]
     */
    public function templates()
    {
        return $this->client->get("$this->endpoint/templates")->response();
    }

    /**
     * Time Totals
     * GET /projects/{id}/time/total.json
     *
     * @return mixed
     */
    public function timeTotal()
    {
        return $this->client->get("tasklists/$this->id/time/total")->response();
    }

    /**
     * Create Task
     * GET /tasklists/{id}/tasks.json
     *
     * @return mixed
     */
    public function createTask($data)
    {
        return $this->client->post("tasklists/$this->id/tasks", ['todo-item' => $data])->response();
    }
}

Create Tasks on a tasklist

Create Tasks on a tasklist


<?php

namespace Politix\PolitikportalBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
// use Politix\PolitikportalBundle\Model;

class SourcesController extends Controller {

    function getSourceAction($source) {

    	$out['source'] = $source;

    	$sql = 'SELECT * FROM rss_items WHERE source LIKE "' . $source . '" ORDER BY pubDate DESC LIMIT 0,10';
    	$out['items'] = $this->getDB($sql);

        return $this->render('PolitikportalBundle:Default:items.html.twig', $out);

    }

    function getSourcesAction($page) {

    	$db = $this->get('SourceModel');

    	$out['sources'] = $db->getSources($page);

    	return $this->render('PolitikportalBundle:Default:sources.html.twig', $out);

    }

}

<?php

namespace Politix\PolitikportalBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
// use Politix\PolitikportalBundle\Model;

class SourcesController extends Controller {

    function getSourceAction($source) {

    	$out['source'] = $source;

    	$sql = 'SELECT * FROM rss_items WHERE source LIKE "' . $source . '" ORDER BY pubDate DESC LIMIT 0,10';
    	$out['items'] = $this->getDB($sql);

        return $this->render('PolitikportalBundle:Default:items.html.twig', $out);

    }

    function getSourcesAction($page = 1) {

    	$db = $this->get('SourceModel');

    	$out['sources'] = $db->getSources($page);
    	$out['page'] = $page;

    	return $this->render('PolitikportalBundle:Default:sources.html.twig', $out);

    }

}

Add default page for getSources

Add default page for getSources


<?php

namespace Ddeboer\Imap;

/**
 * A connection to an IMAP server that is authenticated for a user
 */
class Connection
{
    protected $server;
    protected $resource;
    protected $mailboxes;

    public function __construct($resource, $server)
    {
        if (!is_resource($resource)) {
            throw new \InvalidArgumentException('$resource must be a resource');
        }

        $this->resource = $resource;
        $this->server = $server;
    }

    /**
     * Get a list of mailboxes
     *
     * @return array
     */
    public function getMailboxes()
    {
        if (null === $this->mailboxes) {
            $mailboxes = \imap_getmailboxes($this->resource, $this->server, '*');
            foreach ($mailboxes as $mailbox) {
                $this->mailboxes[] = str_replace($this->server, '', $mailbox->name);
            }
        }

        return $this->mailboxes;
    }

    public function getMailbox($name)
    {
        foreach ($this->getMailboxes() as $mailbox) {
            if (strcasecmp($name, $mailbox) === 0) {
                if (false === \imap_reopen($this->resource, $this->server . $mailbox)) {
                    throw new \Exception('Could not open mailbox ' . $mailbox);
                }

                return new Mailbox($mailbox, $this->resource);
            }
        }

        throw new \InvalidArgumentException('Mailbox ' . $name . ' not found');
    }

    public function count()
    {
        return \imap_num_msg($this->resource);
    }
}

<?php

namespace Ddeboer\Imap;

/**
 * A connection to an IMAP server that is authenticated for a user
 */
class Connection
{
    protected $server;
    protected $resource;
    protected $mailboxes;
    protected $mailboxNames;

    public function __construct($resource, $server)
    {
        if (!is_resource($resource)) {
            throw new \InvalidArgumentException('$resource must be a resource');
        }

        $this->resource = $resource;
        $this->server = $server;
    }

    /**
     * Get a list of mailboxes (also known as folders)
     *
     * @return array
     */
    public function getMailboxes()
    {
        if (null === $this->mailboxes) {
            foreach ($this->getMailboxNames() as $mailboxName) {
                $this->mailboxes[] = $this->getMailbox($mailboxName);
            }
        }

        return $this->mailboxes;
    }

    public function getMailbox($name)
    {
        return new Mailbox($this->server . $name, $this->resource);
    }

    /**
     * Count number of messages not in any mailbox
     *
     * @return int
     */
    public function count()
    {
        return \imap_num_msg($this->resource);
    }

    protected function getMailboxNames()
    {
        if (null === $this->mailboxNames) {
            $mailboxes = \imap_getmailboxes($this->resource, $this->server, '*');
            foreach ($mailboxes as $mailbox) {
                $this->mailboxNames[] = str_replace($this->server, '', $mailbox->name);
            }
        }

        return $this->mailboxNames;
    }
}

Return mailbox object, not name, for getMailboxes()


<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMetasTable extends Migration {

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('metas', function(Blueprint $table)
        {
            $table->increments('id');
            $table->unsignedInteger('metable_id')->nullable();
            $table->string('metable_type')->nullable();
            $table->string('identifier')->nullable()->index();
            $table->boolean('default')->default(false);
            $table->unsignedInteger('groupable_id')->nullable();
            $table->string('groupable_type')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('metas');
    }

}

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMetasTable extends Migration {

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('metas', function(Blueprint $table)
        {
            $table->increments('id');
            $table->unsignedInteger('metable_id')->nullable();
            $table->string('metable_type')->nullable();
            $table->string('identifier')->nullable()->index();
            $table->boolean('default')->default(false);
            $table->unsignedInteger('variant_id')->nullable();
            $table->string('variant_type')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('metas');
    }

}

Add variant columns to the metas table

Add variant columns to the metas table


<?php

namespace Isotop\Cargo\Contracts;

interface Content_Interface {

	/**
	 * Get JSON string for content data.
	 *
	 * @return mixed
	 */
	public function get_json();
}

<?php

namespace Isotop\Cargo\Contracts;

interface Content_Interface {

	/**
	 * Get JSON string for content data.
	 *
	 * @return mixed
	 */
	public function get_json();

	/**
	 * Is the content data valid?
	 *
	 * @return bool
	 */
	public function valid_data();
}

Add valid_data to content interface

Add valid_data to content interface


<?php

namespace Nam\Commander\Exceptions;

use Illuminate\Support\MessageBag;
use RuntimeException;

/**
 * Class CommandValidationException
 *
 * @author  Nam Hoang Luu <nam@mbearvn.com>
 * @package Nam\Commander\Exceptions
 *
 */
class CommandValidationException extends RuntimeException
{

    /**
     * @var MessageBag
     */
    private $errors;

    /**
     * @param MessageBag $errors
     */
    public function __construct(MessageBag $errors)
    {
        $this->errors = $errors;
    }

    /**
     * @return MessageBag
     */
    public function getErrors()
    {
        return $this->errors;
    }
}

<?php

namespace Nam\Commander\Exceptions;

use Illuminate\Support\Contracts\MessageProviderInterface;
use Illuminate\Support\MessageBag;
use RuntimeException;

/**
 * Class CommandValidationException
 *
 * @author  Nam Hoang Luu <nam@mbearvn.com>
 * @package Nam\Commander\Exceptions
 *
 */
class CommandValidationException extends RuntimeException implements MessageProviderInterface
{

    /**
     * @var MessageBag
     */
    private $messageBag;

    /**
     * Get the messages for the instance.
     *
     * @return \Illuminate\Support\MessageBag
     */
    public function getMessageBag()
    {
        return $this->messageBag;
    }

    /**
     * @param MessageBag $messageBag
     */
    public function __construct(MessageBag $messageBag)
    {
        $this->messageBag = $messageBag;
    }
}

Update api adapt withErrors method

Update api adapt withErrors method


<?php
    namespace Page;

    class Uninstall
    {
        public function index()
        {
            $this->load->storeView('Uninstall');

            $this->load->layout('Fresh');
        }

        public function warning()
        {
            if ($this->input->hasPost())
            {
                $this->auth->removeSession();
                $cfg = $this->config->loadInfo('DB');

                $this->db->query('DROP DATABASE '. $cfg['database']);
                $this->config->removeInfo('DB');
                $this->config->removeInfo('Manga');
                $this->config->removeInfo('Setup');

                $this->router->redirect();
            }

            $this->message->warning("Be careful since it can't be reverted");
            $this->load->storeView('Uninstall', [
                'alternative'=>true
            ]);
            $this->load->layout('Fresh');
        }
    }
?>

<?php
    namespace Page;

    class Uninstall
    {
        public function index()
        {
            $this->load->storeView('Uninstall');

            $this->load->layout('Fresh', [
                'title'=>'Uninstall'
            ]);
        }

        public function warning()
        {
            if ($this->input->hasPost())
            {
                $this->auth->removeSession();
                $cfg = $this->config->loadInfo('DB');

                $this->db->query('DROP DATABASE '. $cfg['database']);
                $this->config->removeInfo('DB');
                $this->config->removeInfo('Manga');
                $this->config->removeInfo('Setup');

                $this->router->redirect();
            }

            $this->message->warning("Be careful since it can't be reverted");
            $this->load->storeView('Uninstall', [
                'alternative'=>true
            ]);
            $this->load->layout('Fresh', [
                'title'=>'Uninstall'
            ]);
        }
    }
?>

Add title to uninstall page

Add title to uninstall page


<?php

/**
 * PHP Version 5.3
 *
 * @copyright (c) 2015 brian ridley
 * @author brian ridley <ptlis@ptlis.net>
 * @license http://opensource.org/licenses/MIT MIT
 */

namespace ptlis\ShellCommand\Test\RunningProcess;

class UnixRunningProcessSigTermIgnoredTest extends \PHPUnit_Framework_TestCase
{
    public function testRunProcess()
    {
        $command = './tests/data/sleep_binary';

        $process = new UnixRunningProcessBlockSigTerm($command, getcwd());

        $process->stop();

        $this->assertEquals(
            false,
            $process->isRunning()
        );

        $this->assertEquals(
            './tests/data/sleep_binary',
            $process->getCommand()
        );
    }
}

<?php

/**
 * PHP Version 5.3
 *
 * @copyright (c) 2015 brian ridley
 * @author brian ridley <ptlis@ptlis.net>
 * @license http://opensource.org/licenses/MIT MIT
 */

namespace ptlis\ShellCommand\Test\RunningProcess;

use Psr\Log\LogLevel;
use ptlis\ShellCommand\Logger\SignalSentLogger;
use ptlis\ShellCommand\Test\Logger\MockPsrLogger;

class UnixRunningProcessSigTermIgnoredTest extends \PHPUnit_Framework_TestCase
{
    public function testRunProcess()
    {
        $command = './tests/data/sleep_binary';

        $logger = new MockPsrLogger();

        $process = new UnixRunningProcessBlockSigTerm(
            $command,
            getcwd(),
            -1,
            1000,
            new SignalSentLogger($logger)
        );

        $process->stop();

        $this->assertEquals(
            array(
                array(
                    'level' => LogLevel::DEBUG,
                    'message' => 'Signal sent',
                    'context' => array(
                        'signal' => 9
                    )
                )
            ),
            $logger->getLogs()
        );
    }
}

Make test for sigterm more robust.

Fix: Make test for sigterm more robust.


Welcome, <?=$currentUser->firstName()?>

Edit your name or bio

Change your profile picture

<? if ($currentUser->isAdmin()) { ?>

Add a member

Manage members

<? } ?>

Upload a photo

Manage photos

Log out

Welcome, <?=$currentUser->firstName()?>

Edit your name or bio

Change your profile picture

<? if ($currentUser->isAdmin()) { ?>

Manage members

<? } ?>

Manage photos

Log out

Remove redundant links to add member and add photo


<?php
/*
 * Lily, a web application library
 *
 * (c) Luke Morton <lukemorton.dev@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Lily\Middleware;

class Flash
{
    public function __invoke($handler)
    {
        return function ($request) use ($handler) {
            if (isset($request['session']['_flash'])) {
                $request['flash'] = $request['session']['_flash'];
                unset($request['session']['_flash']);
            }

            $response = $handler($request);

            if (isset($response['flash'])) {
                $response['session']['_flash'] = $response['flash'];
            } else if (isset($request['flash'])) {
                $response['session']['_flash'] = NULL;
            }

            return $response;
        };
    }
}

<?php
/*
 * Lily, a web application library
 *
 * (c) Luke Morton <lukemorton.dev@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Lily\Middleware;

class Flash
{
    public function __invoke($handler)
    {
        return function ($request) use ($handler) {
            if (isset($request['session']['_flash'])) {
                $request['flash'] = $request['session']['_flash'];
            }

            $response = $handler($request);

            if (isset($response['flash'])) {
                $response['session']['_flash'] = $response['flash'];
            } else if (isset($request['flash'])) {
                $response['session']['_flash'] = NULL;
            }

            return $response;
        };
    }
}

Remove unsetting of request flash session key

No need to unset it.


@if (Auth::user())

            {{ Auth::user()->username }}

 {{ trans('cortex/fort::common.settings') }}

 {{ trans('cortex/fort::common.sessions') }}

                 {{ trans('cortex/fort::common.logout') }}
                {{ Form::open(['url' => route('frontend.auth.logout'), 'id' => 'logout-form', 'style' => 'display: none;']) }}
                {{ Form::close() }}

@else

{{ trans('cortex/fort::common.login') }}

{{ trans('cortex/fort::common.register') }}

@endif

Add missing guests login/register links for top navbar


<?php

namespace Nwidart\Modules\Tests;

use Illuminate\Support\Str;

class HelpersTest extends BaseTestCase
{
    /**
     * @var \Illuminate\Filesystem\Filesystem
     */
    private $finder;
    /**
     * @var string
     */
    private $modulePath;

    public function setUp(): void
    {
        parent::setUp();
        $this->modulePath = base_path('modules/Blog');
        $this->finder = $this->app['files'];
        $this->artisan('module:make', ['name' => ['Blog']]);
    }

    public function tearDown(): void
    {
        $this->finder->deleteDirectory($this->modulePath);
        parent::tearDown();
    }

    /** @test */
    public function it_finds_the_module_path()
    {
        $this->assertTrue(Str::contains(module_path('Blog'), 'modules/Blog'));
    }
}

<?php

namespace Nwidart\Modules\Tests;

use Illuminate\Support\Str;

class HelpersTest extends BaseTestCase
{
    /**
     * @var \Illuminate\Filesystem\Filesystem
     */
    private $finder;
    /**
     * @var string
     */
    private $modulePath;

    public function setUp(): void
    {
        parent::setUp();
        $this->modulePath = base_path('modules/Blog');
        $this->finder = $this->app['files'];
        $this->artisan('module:make', ['name' => ['Blog']]);
    }

    public function tearDown(): void
    {
        $this->finder->deleteDirectory($this->modulePath);
        parent::tearDown();
    }

    /** @test */
    public function it_finds_the_module_path()
    {
        $this->assertTrue(Str::contains(module_path('Blog'), 'modules/Blog'));
    }

    /** @test */
    public function it_can_bind_a_relative_path_to_module_path()
    {
        $this->assertTrue(Str::contains(module_path('Blog', 'config/config.php'), 'modules/Blog/config/config.php'));
    }
}

Add test for module_path extension

Add test for module_path extension


<?php
/**
 * This file is part of the ramsey/uuid library
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
 * @license http://opensource.org/licenses/MIT MIT
 * @link https://benramsey.com/projects/ramsey-uuid/ Documentation
 * @link https://packagist.org/packages/ramsey/uuid Packagist
 * @link https://github.com/ramsey/uuid GitHub
 */

namespace Ramsey\Uuid\Builder;

use Ramsey\Uuid\Codec\CodecInterface;

interface UuidBuilderInterface
{
    /**
     * @return Uuid
     */
    public function build(CodecInterface $codec, array $fields);
}

<?php
/**
 * This file is part of the ramsey/uuid library
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
 * @license http://opensource.org/licenses/MIT MIT
 * @link https://benramsey.com/projects/ramsey-uuid/ Documentation
 * @link https://packagist.org/packages/ramsey/uuid Packagist
 * @link https://github.com/ramsey/uuid GitHub
 */

namespace Ramsey\Uuid\Builder;

use Ramsey\Uuid\Codec\CodecInterface;
use Ramsey\Uuid\Uuid;

interface UuidBuilderInterface
{
    /**
     * @return Uuid
     */
    public function build(CodecInterface $codec, array $fields);
}

Fix incompatible return type declaration issue

Scrutinizer turned up this issue, since the declared return type in
`UuidBuilderInterface` was of `Uuid` and we weren't properly importing
`\Ramsey\Uuid\Uuid` in a `use` statement.


<?php
/**
 * Created by PhpStorm.
 * User: eduardo
 * Date: 04/02/14
 * Time: 10:54
 */

namespace Cacic\RelatorioBundle\Menu;

use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAware;

class Builder extends ContainerAware
{
    public function relatorioMenu(FactoryInterface $factory, array $options)
    {
        $logger = $this->container->get('logger');

        // Cria menu
        $menu = $factory->createItem('root');
        //$menu->addChild('Configurações', array('route' => 'cacic_relatorio_hardware_configuracoes'));

        // Carrega lista de classes WMI para coleta
        $em = $this->container->get('doctrine')->getEntityManager();
        $classes = $em->getRepository('CacicCommonBundle:ComputadorColeta')->menu();

        // Adiciona cada uma das classes como slug para um controller
        foreach ($classes as $wmiClass) {
            $menu->addChild($wmiClass['nmClassName'], array(
                'route' => 'cacic_relatorio_hardware_wmi',
                'routeParameters' => array(
                    'classe' => $wmiClass['nmClassName']
                )
            ));
        }

        return $menu;
    }
}

<?php
/**
 * Created by PhpStorm.
 * User: eduardo
 * Date: 04/02/14
 * Time: 10:54
 */

namespace Cacic\RelatorioBundle\Menu;

use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAware;

class Builder extends ContainerAware
{
    public function relatorioMenu(FactoryInterface $factory, array $options)
    {
        $logger = $this->container->get('logger');

        // Cria menu
        $menu = $factory->createItem('root');
        //$menu->addChild('Configurações', array('route' => 'cacic_relatorio_hardware_configuracoes'));

        // Carrega lista de classes WMI para coleta
        $em = $this->container->get('doctrine')->getManager();
        $classes = $em->getRepository('CacicCommonBundle:ComputadorColeta')->menu();

        // Adiciona cada uma das classes como slug para um controller
        foreach ($classes as $wmiClass) {
            $menu->addChild($wmiClass['nmClassName'], array(
                'route' => 'cacic_relatorio_hardware_wmi',
                'routeParameters' => array(
                    'classe' => $wmiClass['nmClassName']
                )
            ));
        }

        return $menu;
    }
}

Remove mensagem de erro bem chata

Remove mensagem de erro bem chata


<?php

/**
 * This file is part of Twig.
 *
 * (c) 2009 Fabien Potencier
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @author Ricard Clau <ricard.clau@gmail.com>
 */
class Twig_Extensions_Extension_Array extends Twig_Extension
{
    /**
     * {@inheritdoc}
     */
    public function getFilters()
    {
        $filters = array(
             new Twig_SimpleFilter('shuffle', 'twig_shuffle_filter'),
        );

        return $filters;
    }

    /**
     * {@inheritdoc}
     */
    public function getName()
    {
        return 'array';
    }
}

/**
 * Shuffles an array.
 *
 * @param array|Traversable $array An array
 *
 * @return array
 */
function twig_shuffle_filter($array)
{
    if ($array instanceof Traversable) {
        $array = iterator_to_array($array, false);
    }

    shuffle($array);

    return $array;
}

<?php

/**
 * This file is part of Twig.
 *
 * (c) 2009 Fabien Potencier
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @author Ricard Clau <ricard.clau@gmail.com>
 */
class Twig_Extensions_Extension_Array extends Twig_Extension
{
    /**
     * {@inheritdoc}
     */
    public function getFilters()
    {
        $filters = array(
             new Twig_SimpleFilter('shuffle', 'twig_shuffle_filter'),
        );

        return $filters;
    }

    /**
     * {@inheritdoc}
     */
    public function getName()
    {
        return 'array';
    }
}

/**
 * Shuffles an array.
 *
 * @param array|Traversable $array An array
 *
 * @return array
 */
function twig_shuffle_filter($array, $associative = false)
{
    if ($array instanceof Traversable) {
        $array = iterator_to_array($array, false);
    }

    if($associative) {
        $keys = array_keys($array);
        shuffle($keys);

        foreach($keys as $key) {
            $new[$key] = $array[$key];
        }
        $array = $new;
    }
    else {
        shuffle($array);
    }

    return $array;
}

Add possibility to shuffle an associative array

Usage: `{{ myArray | shuffle }}` will shuffle as usual (initial behaviour of the plugin); `{{ myArray | shuffle(true) }}` will preserve the keys of an associative array.


<?php
require_once __DIR__.'/../vendor/autoload.php';

$transmission = new Transmission\Transmission();
$queue = $transmission->all();

echo "Downloading to: {$transmission->getSession()->getDownloadDir()}\n";

foreach ($queue as $torrent) {
    echo "{$torrent->getName()}";

    if ($torrent->isFinished()) {
        echo ": done\n";
    } else {
        if ($torrent->isDownloading()) {
            echo ": {$torrent->getPercentDone()}% ";
            echo "(eta: ". gmdate("H:i:s", $torrent->getEta()) .")\n";
        } else{
            echo ": paused\n";
        }
    }
}

// Change download directories
// $session = $transmission->getSession();
// $session->setDownloadDir('/var/www/downloads/complete');
// $session->setIncompleteDir('/tmp/downloads');
// $session->save();

Remove commented code in examples

Remove commented code in examples


<?php

namespace AppBundle\API\Edit;

use AppBundle\API\Webservice;
use AppBundle\AppBundle;
use AppBundle\Entity\FennecUser;
use AppBundle\Entity\WebuserData;
use AppBundle\Service\DBVersion;
use Symfony\Component\HttpFoundation\ParameterBag;

class UpdateProject
{
    private $manager;

    /**
     * UpdateProject constructor.
     * @param $dbversion
     */
    public function __construct(DBVersion $dbversion)
    {
        $this->manager = $dbversion->getEntityManager();
    }

    /**
     * @inheritdoc
     */
    public function execute($projectId, $biom, FennecUser $user = null)
    {
        if($biom === null || $projectId === null){
            return array('error' => 'Missing parameter "biom" or "projectId"');
        }
        if($user == null){
            return array('error' => 'User not logged in');
        }
        if($user === null){
            return array('error' => 'Could not update project. Not found for user.');
        }
        $project = $this->manager->getRepository(WebuserData::class)->findOneBy(array('webuser' => $user, 'webuserDataId' => $projectId));
        if($project === null){
            return array('error' => 'Could not update project. Not found for user.');
        }
        $project->setProject(json_decode($biom, true));
        $this->manager->persist($project);
        $this->manager->flush();
        return array('error' => null);
    }
}

<?php

namespace AppBundle\API\Edit;

use AppBundle\API\Webservice;
use AppBundle\AppBundle;
use AppBundle\Entity\FennecUser;
use AppBundle\Entity\WebuserData;
use AppBundle\Service\DBVersion;
use Symfony\Component\HttpFoundation\ParameterBag;

class UpdateProject
{
    private $manager;

    /**
     * UpdateProject constructor.
     * @param $dbversion
     */
    public function __construct(DBVersion $dbversion)
    {
        $this->manager = $dbversion->getEntityManager();
    }

    /**
     * @inheritdoc
     */
    public function execute($projectId, $biom, FennecUser $user = null)
    {
        if($biom === null || $projectId === null){
            return array('error' => 'Missing parameter "biom" or "projectId"');
        }
        if($user == null){
            return array('error' => 'User not logged in');
        }
        if($user === null){
            return array('error' => 'Could not update project. Not found for user.');
        }
        $project = $this->manager->getRepository(WebuserData::class)->findOneBy(array('webuser' => $user, 'webuserDataId' => $projectId));
        if($project === null){
            return array('error' => 'Could not update project. Not found for user.');
        }
        $project->setProject(json_encode($biom));
        $this->manager->persist($project);
        $this->manager->flush();
        return array('error' => null);
    }
}

Fix wrong order of parameters and change json decode to json encode


<?php
    // Use in the "Post-Receive URLs" section of your GitHub repo.
    if ( $_POST['payload'] && false ) {
        file_put_contents('log/payload.txt', print_r($_POST['payload']), FILE_APPEND);

        $exec_string = 'cd /var/customers/webs/jmm/weltengeschichte.de.repo/ && git reset --hard HEAD && git pull';
        exec ( $exec_string, $output);
        file_put_contents('log/output.txt', $output, FILE_APPEND);
    }
    $json = file_get_contents('php://input');
    $obj = json_decode($json);
    print_r($obj);
    file_put_contents('log/post.txt', print_r($obj, true));
?>

<?php
    // Parse the json payload from github
    $json = file_get_contents('php://input');
    $obj = json_decode($json);

    // If there is a playload, deploy the website
    if ( $obj ) {
        // Log the payload
        file_put_contents('log/payload.txt', date("\n[d M Y H:i:s]\n").print_r($obj, true), FILE_APPEND);

        // perform the deploy
        $exec_string = 'cd /var/customers/webs/jmm/weltengeschichte.de.repo/ && git reset --hard HEAD && git pull && grunt deploy';
        exec ( $exec_string, $output);

        // Log the output
        file_put_contents('log/output.txt', date("\n[d M Y H:i:s]\n").print_r($output, true), FILE_APPEND);
    }
?>

Deploy on push, test 6

Deploy on push, test 6


Set local debug to true.

Set local debug to true.


<?php
class Wpup_Request {
	/** @var array */
	public $query = array();
	/** @var string */
	public $action;
	/** @var string */
	public $slug;
	/** @var Wpup_Package */
	public $package;

	public function __construct($query, $action, $slug = null, $package = null) {
		$this->query = $query;
		$this->action = $action;
		$this->slug = $slug;
		$this->package = $package;
	}
}

<?php
/**
 * Simple request class for the update server.
 */
class Wpup_Request {
	/** @var array Query parameters. */
	public $query = array();
	/** @var string The name of the current action. For example, "get_metadata". */
	public $action;
	/** @var string Plugin or theme slug from the current request. */
	public $slug;
	/** @var Wpup_Package The package that matches the current slug, if any. */
	public $package;

	/** @var array Other, arbitrary request properties. */
	protected $props = array();

	public function __construct($query, $action, $slug = null, $package = null) {
		$this->query = $query;
		$this->action = $action;
		$this->slug = $slug;
		$this->package = $package;
	}

	public function __get($name) {
		if ( array_key_exists($name, $this->props) ) {
			return $this->props[$name];
		}
		return null;
	}

	public function __set($name, $value) {
		$this->props[$name] = $value;
	}

	public function __isset($name) {
		return isset($this->props[$name]);
	}

	public function __unset($name) {
		unset($this->props[$name]);
	}
}

Allow adding arbitrary properties to the request class.


<?php

namespace VGMdb\Component\Queue;

/**
 * Runs the worker job loop.
 *
 * @author Gigablah <gigablah@vgmdb.net>
 */
class Runner
{
    const INTERVAL = 10000;

    protected $worker;
    protected $interval;
    protected $counter;

    public function __construct(WorkerInterface $worker, array $options = array())
    {
        $this->worker = $worker;
        $this->interval = isset($options['interval']) ? intval($options['interval']) : self::INTERVAL;
        $this->counter = null;
    }

    public function run($counter = null)
    {
        $this->counter = intval($counter) ?: null;

        while (0 !== $this->counter) {
            if ($job = $this->worker->getJob()) {
                try {
                    $this->worker->runJob($job);
                } catch (\Exception $exception) {
                    // BackOffStrategy?
                }
                if ($this->counter) {
                    $this->counter--;
                }
            }
            usleep($this->interval);
        }
    }
}

<?php

namespace VGMdb\Component\Queue;

/**
 * Runs the worker job loop.
 *
 * @author Gigablah <gigablah@vgmdb.net>
 */
class Runner
{
    const INTERVAL = 10000;

    protected $worker;
    protected $interval;
    protected $counter;

    public function __construct(WorkerInterface $worker, array $options = array())
    {
        $this->worker = $worker;
        $this->interval = isset($options['interval']) ? intval($options['interval']) : self::INTERVAL;
        $this->counter = null;
    }

    public function getWorker()
    {
        return $this->worker;
    }

    public function run($counter = null)
    {
        $this->counter = intval($counter) ?: null;

        while (0 !== $this->counter) {
            if ($job = $this->worker->getJob()) {
                try {
                    $this->worker->runJob($job);
                } catch (\Exception $exception) {
                    // BackOffStrategy?
                }
                if ($this->counter) {
                    $this->counter--;
                }
            }
            usleep($this->interval);
        }
    }
}

Add worker getter for queue runner

Add worker getter for queue runner


<?php
/**
 *
 */

namespace Mvc5\Resolver;

use RuntimeException;

trait Initializer
{
    /**
     * @var array
     */
    protected $pending = [];

    /**
     * @param string $name
     * @param callable $callback
     * @param array $args
     * @return callable|null|object
     */
    protected abstract function plugin($name, array $args = [], callable $callback = null);

    /**
     * @param string $name
     * @param null $config
     * @return null|object|callable
     */
    protected function initialize($name, $config = null)
    {
        return $this->initializing($name) ?? $this->initialized($name, $this->plugin($config ?? $name));
    }

    /**
     * @param string $name
     * @param callable|null|object $service
     * @return callable|null|object
     */
    protected function initialized($name, $service = null)
    {
        $this->pending[$name] = false;

        null !== $service && $service && $this->set($name, $service);

        return $service;
    }

    /**
     * @param string $name
     * @return bool
     */
    protected function initializing($name)
    {
        if (!empty($this->pending[$name])) {
            throw new RuntimeException('Circular dependency: ' . $name);
        }

        $this->pending[$name] = true;

        return null;
    }

    /**
     * @param string $name
     * @param mixed $service
     * @return void
     */
    protected abstract function set($name, $service);
}

<?php
/**
 *
 */

namespace Mvc5\Resolver;

use RuntimeException;

trait Initializer
{
    /**
     * @var array
     */
    protected $pending = [];

    /**
     * @param string $name
     * @param callable $callback
     * @param array $args
     * @return callable|null|object
     */
    protected abstract function plugin($name, array $args = [], callable $callback = null);

    /**
     * @param string $name
     * @param null $config
     * @return null|object|callable
     */
    protected function initialize($name, $config = null)
    {
        return $this->initializing($name) ?? $this->initialized($name, $this->plugin($config ?? $name));
    }

    /**
     * @param string $name
     * @param callable|null|object $service
     * @return callable|null|object
     */
    protected function initialized($name, $service = null)
    {
        $this->pending[$name] = false;

        null !== $service && $this->set($name, $service);

        return $service;
    }

    /**
     * @param string $name
     * @return bool
     */
    protected function initializing($name)
    {
        if (!empty($this->pending[$name])) {
            throw new RuntimeException('Circular dependency: ' . $name);
        }

        $this->pending[$name] = true;

        return null;
    }

    /**
     * @param string $name
     * @param mixed $service
     * @return void
     */
    protected abstract function set($name, $service);
}

Allow shared container to store empty, but not null values.


<?php namespace Analogue\LaravelAuth;

use Illuminate\Support\ServiceProvider;
use Illuminate\Auth\AuthManager;

class AnalogueAuthServiceProvider extends ServiceProvider {

	/**
	 * Indicates if loading of the provider is deferred.
	 *
	 * @var bool
	 */
	protected $defer = false;

	public function boot()
	{
		$this->app[AuthManager::class]->extend('analogue', function ($app) {

			return new AnalogueUserProvider(
				$app['Illuminate\Contracts\Hashing\Hasher'],
				$app['analogue'],
				$app['config']['auth.model']
			);
		});
	}

	/**
	 * Register the service provider.
	 *
	 * @return void
	 */
	public function register()
	{
		//
	}

	/**
	 * Get the services provided by the provider.
	 *
	 * @return array
	 */
	public function provides()
	{
		return array();
	}

}

<?php namespace Analogue\LaravelAuth;

use Illuminate\Support\ServiceProvider;
use Illuminate\Auth\AuthManager;

class AnalogueAuthServiceProvider extends ServiceProvider {

	/**
	 * Indicates if loading of the provider is deferred.
	 *
	 * @var bool
	 */
	protected $defer = true;

	public function boot()
	{
		//
	}

	/**
	 * Register the service provider.
	 *
	 * @return void
	 */
	public function register()
	{
		$this->app[AuthManager::class]->provider('analogue', function($app, $config) {
			return new AnalogueUserProvider(
				$app['Illuminate\Contracts\Hashing\Hasher'],
				$app['analogue'],
				$config['model']
			);
		});
	}

	/**
	 * Get the services provided by the provider.
	 *
	 * @return array
	 */
	public function provides()
	{
		return array();
	}

}

Use provider() instead of extends()

Use provider() instead of extends()


<?php

function helloWorld() {
    print "hello world!";
    $thing = true;
    $thingAgain = true;
    $thingTheThird = true;
    $otherThing = false;
    $another = false;
    $andAnother = false;
    $aNull = null;
    $anotherNull = null;
    $thirdNull = null;

}

<?php

function helloWorld() {
    print "hello world!";
    $thing = True;
    $thingAgain = TRUE;
    $thingTheThird = true;
    $otherThing = False;
    $another = false;
    $andAnother = FALSE;
    $aNull = null;
    $anotherNull = Null;
    $thirdNull = NULL;

}

Revert rewrite on example file

Revert rewrite on example file


<?php
$subject = $this->email->getHeaderValue('Subject', '<Empty Subject>');
$this->title($subject);
?>

    <a href="<?= $this->escape()->attr($this->route('list')); ?>">Outgoing emails - listing >
    <?= $this->escape()->html($subject);?>

        <?php
        foreach ($this->email->getHeaders() as $header) {
            echo "
", $this->escape()->html($header->getName()), "
\r\n";
            echo "
 ", $this->escape()->html($header->getValue()), "
\r\n";
        }
        ?>

        <a href="<?= $this->escape()->attr($this->route('list')); ?>">Back to email list

    <?php
    $html = $this->email->getHtmlContent();
    if ($html !== null) {
        echo preg_replace('/.*?(.*?)<\/body>.*?/ims', '$1', $html);
    } else {
        echo nl2br($this->escape()->html($this->email->getTextContent()));
    }
    ?>

<?php
$subject = $this->email->getHeaderValue('Subject', '<Empty Subject>');
$this->title($subject);
?>

    <a href="<?= $this->escape()->attr($this->route('list')); ?>">Outgoing emails - listing >
    <?= $this->escape()->html($subject);?>

        <?php
        foreach ($this->email->getHeaders() as $header) {
            echo "
", $this->escape()->html($header->getName()), "
\r\n";
            echo "
 ", $this->escape()->html($header->getValue()), "
\r\n";
        }
        ?>

        <a href="<?= $this->escape()->attr($this->route('list')); ?>">Back to email list

    <?php
    $html = $this->email->getHtmlContent();
    if ($html !== null) {
        echo preg_replace('/^.*?(.*?)<\/body>.*$/ims', '$1', $html);
    } else {
        echo nl2br($this->escape()->html($this->email->getTextContent()));
    }
    ?>

Fix HTML email extraction regex

Fix HTML email extraction regex


<?php
/**
 * @author    Igor Nikolaev <igor.sv.n@gmail.com>
 * @copyright Copyright (c) 2015, Darvin Studio
 * @link      https://www.darvin-studio.ru
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Darvin\Utils\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\Blank;

/**
 * Anti-spam form type
 */
class AntiSpamType extends AbstractType
{
    /**
     * {@inheritdoc}
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults([
            'label'       => false,
            'attr'        => [
                'class' => 'title_field',
            ],
            'constraints' => new Blank(),
            'mapped'      => false,
            'required'    => false,
        ]);
    }

    /**
     * {@inheritdoc}
     */
    public function getParent()
    {
        return 'Symfony\Component\Form\Extension\Core\Type\TextType';
    }
}

<?php
/**
 * @author    Igor Nikolaev <igor.sv.n@gmail.com>
 * @copyright Copyright (c) 2015, Darvin Studio
 * @link      https://www.darvin-studio.ru
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Darvin\Utils\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\Blank;

/**
 * Anti-spam form type
 */
class AntiSpamType extends AbstractType
{
    /**
     * {@inheritdoc}
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults([
            'label'       => false,
            'attr'        => [
                'class' => 'title_field',
            ],
            'constraints' => new Blank(),
            'mapped'      => false,
            'required'    => false,
        ]);
    }

    /**
     * {@inheritdoc}
     */
    public function getParent()
    {
        return TextType::class;
    }
}

Use FQCN constants instead of strings.

Use FQCN constants instead of strings.


<?php
/**
 *
 * @author malinink
 */

class ModelsFactoriesTest extends TestCase
{
    /**
     * Test User Factory
     *
     * @return void
     */
    public function testUserFactory()
    {
        $user = factory(App\User::class)->make();
        $user->save();
        $user->delete();
    }

    /**
     * Test GameType Factory
     *
     * @return void
     */
    public function testGameTypeFactory()
    {
        $gameType = factory(App\GameType::class)->make();
        $gameType->save();
        $gameType->delete();
    }

    /**
     * Test User Factory
     *
     * @return void
     */
    public function testGameFactory()
    {
        $game = factory(App\Game::class)->make();
        $game->save();
        $game->delete();
        /*
         * Delete related autogenerated models also
         */
        $game->gameType()->delete();
    }
}

<?php
/**
 *
 * @author malinink
 */

class ModelsFactoriesTest extends TestCase
{
    /**
     * Test User Factory
     *
     * @return void
     */
    public function testUserFactory()
    {
        $res=DB::table('users')->count();
        if ($res==0) {
            DB::statement('ALTER TABLE users AUTO_INCREMENT=1;');
        }
        $user = factory(App\User::class)->make();
        $user->save();
        $user->delete();
    }

    /**
     * Test GameType Factory
     *
     * @return void
     */
    public function testGameTypeFactory()
    {
        $res=DB::table('game_types')->count();
        if ($res==0) {
            DB::statement('ALTER TABLE game_types AUTO_INCREMENT=1;');
        }
        $gameType = factory(App\GameType::class)->make();
        $gameType->save();
        $gameType->delete();
    }

    /**
     * Test User Factory
     *
     * @return void
     */
    public function testGameFactory()
    {
        $res=DB::table('games')->count();
        if ($res==0) {
            DB::statement('ALTER TABLE games AUTO_INCREMENT=1;');
        }
        $game = factory(App\Game::class)->make();
        $game->save();
        $game->delete();
        /*
         * Delete related autogenerated models also
         */
        $game->gameType()->delete();
    }

    /**
     * Test UserIngameInfo Factory
     *
     * @return void
     */
    public function testUserIngameInfoFactory()
    {
        $res=DB::table('user_ingame_infos')->count();
        if ($res==0) {
            DB::statement('ALTER TABLE user_ingame_infos AUTO_INCREMENT=1;');
        }
        $user_ingame = factory(App\UserIngameInfo::class)->make();
        $user_ingame->save();
        $user_ingame->delete();
        /*
         * Delete related autogenerated models also
         */
        $user_ingame->gameType->delete();
        $user_ingame->user->delete();
    }
}

Add test for factory UserIngameInfo and fix autoincrement


<?php
namespace Wave\Framework\External\Phroute\Filters\After;

use Wave\Framework\Application\Wave;

class Encoding
{
    /**
     * Sets the content type to `application/json`
     */
    public function useJSON()
    {
        Wave::getResponse()->withHeader('content-type', 'application/json');
    }

    /**
     * Sets the content type to `text/xml`
     */
    public function useXML()
    {
        Wave::getResponse()->withHeader('content-type', 'text/xml');
    }

    /**
     * Sets the content type to `text/html`
     */
    public function useHTML()
    {
        Wave::getResponse()->withHeader('content-type', 'text/html');
    }

    public function usePlain()
    {
        Wave::getResponse()->withHeader('content-type', 'text/plain');
    }
}

<?php
namespace Wave\Framework\External\Phroute\Filters\After;

use Wave\Framework\Application\Wave;

class Encoding
{
    const ENC_JSON = 'application/json';
    const ENC_XML = 'text/xml';
    const ENC_HTML = 'text/html';
    const ENC_PLAIN = 'text/plain';

    private function verifyAcceptance($type)
    {
        $header = '*/*';
        if (Wave::getRequest()->hasHeader('Accept')) {
            $header = Wave::getRequest()->getHeader('Accept');
        }

        /**
         * if wildcard is not provided (* / *) and the content type is not found
         * in the Accept header, set the response to 406 (Not Acceptable).
         *
         * Assumes that if no content type is provided, the client accepts anything (* / *)
         */
        if (strpos($header, $type) === false && strpos($header, '*/*') === false) {
            Wave::getResponse()->withStatus(406);
        }
    }

    /**
     * Sets the content type to `application/json`
     */
    public function useJSON()
    {
        $this->verifyAcceptance(self::ENC_JSON);
        Wave::getResponse()->withHeader('content-type', 'application/json');
    }

    /**
     * Sets the content type to `text/xml`
     */
    public function useXML()
    {
        $this->verifyAcceptance(self::ENC_XML);
        Wave::getResponse()->withHeader('content-type', 'text/xml');
    }

    /**
     * Sets the content type to `text/html`
     */
    public function useHTML()
    {
        $this->verifyAcceptance(self::ENC_HTML);
        Wave::getResponse()->withHeader('content-type', 'text/html');
    }

    public function usePlain()
    {
        $this->verifyAcceptance(self::ENC_PLAIN);
        Wave::getResponse()->withHeader('content-type', 'text/plain');
    }
}

Check if the return content type is within the Accept header


<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}

<?php

namespace App\Providers;

use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        Schema::defaultStringLength(191);
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}

Fix key length to work with mariadb

Fix key length to work with mariadb


<?php

namespace Athens\Core\Renderer;

use Athens\Core\Writable\WritableInterface;
use DOMPDF;

/**
 * Class PDFRenderer
 *
 * @package Athens\Core\Renderer
 */
class PDFRenderer extends AbstractRenderer
{

    /**
     * @param WritableInterface $writable
     * @return void
     */
    public function render(WritableInterface $writable)
    {
        $documentName = $writable->getTitle() === true ? $writable->getTitle() : "document";

        $content = $this->getContent($writable);

        $dompdf = new DOMPDF();
        $dompdf->loadHtml($content);
        $dompdf->render();
        $dompdf->stream($documentName . ".pdf");
    }
}

<?php

namespace Athens\Core\Renderer;

use Athens\Core\Writable\WritableInterface;
use Dompdf\Dompdf;

/**
 * Class PDFRenderer
 *
 * @package Athens\Core\Renderer
 */
class PDFRenderer extends AbstractRenderer
{

    /**
     * @param WritableInterface $writable
     * @return void
     */
    public function render(WritableInterface $writable)
    {
        $documentName = ((string)$writable->getTitle()) !== "" ? $writable->getTitle() : "document";

        $content = $this->getContent($writable);

        $dompdf = new Dompdf();
        $dompdf->loadHtml($content);
        $dompdf->render();
        $dompdf->stream($documentName . ".pdf");
    }
}

Update to new DomPDF 7 interface.

Update to new DomPDF 7 interface.


<?php
namespace Burrow\Tactician;

use League\Tactician\Plugins\NamedCommand\NamedCommand;

interface CommandSerializer
{
    /**
     * @param NamedCommand $command
     * @return string
     */
    public function serialize(NamedCommand $command);

    /**
     * @param  string $serializedObject
     * @return NamedCommand
     */
    public function deserialize($serializedObject);
}

<?php
namespace Burrow\Tactician;

use League\Tactician\Plugins\NamedCommand\NamedCommand;

interface CommandSerializer
{
    /**
     * @param NamedCommand $command
     * @return string
     */
    public function serialize(NamedCommand $command);
}

Remove non required method in interface

Remove non required method in interface


<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

<?php

namespace ajax\listing;

use \PDO as PDO;

/**
 * Web Service.
 * Returns Taxonomy information for a given organism_id
 */
class Taxonomy extends \WebService {

    /**
     * @param $querydata[ids] array of organism ids
     * @returns array of taxonomy information for a given organism id
     * array('lineage' => [grandgrandparent, grandparent, parent])
     */
    public function execute($querydata) {

    }
}

?>

Add documentation for taxonomy webservice


<?php

namespace Phuby {
    class Regexp extends Object { }
}

namespace Phuby\Regexp {
    class ClassMethods {
        static function initialized($self) {
            $self->alias_method('quote', 'escape');
            $self->alias_method('valid?', 'valid_query');
        }

        function escape($string, $delimiter = null) {
            return preg_quote($string, $delimiter);
        }

        function valid_query($regexp) {
            return @preg_match($regexp, '') !== false;
        }
    }

    class InstanceMethods {
        static function initialized($self) {
            $self->attr_reader('regexp');
        }

        function initialize($regexp) {
            if (!$this->class->{'valid?'}($regexp))
                $regexp = "/$regexp/";

            $this->{'@regexp'} = $regexp;
        }

        function match($string) {
            $string = (string) $string;

            if (preg_match($this->regexp, $string, $matches))
                return Phuby('Phuby\MatchData')->new($this, $string, $matches);
        }
    }
}

<?php

namespace Phuby {
    class Regexp extends Object { }
}

namespace Phuby\Regexp {
    class ClassMethods {
        static function initialized($self) {
            $self->alias_method('quote', 'escape');
            $self->alias_method('valid?', 'valid_query');
        }

        function escape($string, $delimiter = null) {
            return preg_quote($string, $delimiter);
        }

        function valid_query($regexp) {
            return @preg_match($regexp, '') !== false;
        }
    }

    class InstanceMethods {
        static function initialized($self) {
            $self->attr_reader('regexp');
        }

        function initialize($regexp) {
            if (!$this->class->{'valid?'}($regexp))
                $regexp = "/$regexp/";

            $this->{'@regexp'} = $regexp;
        }

        function match($string) {
            $string = (string) $string;
            $this->{'$&'} = null;

            if (preg_match($this->regexp, $string, $matches)) {
                $match = Phuby('Phuby\MatchData')->new($this, $string, $matches);

                $this->{'$&'} = $string;
                $this->{'$~'} = $match;

                foreach ($matches as $index => $value)
                    if ($index > 0)
                        $this->{"$$index"} = $value;

                return $match;
            }
        }
    }
}

Set some Regexp related global variables

- $&
- $~


<?php
namespace TheSeer\phpDox\Generator {

    use TheSeer\fDOM\fDOMDocument;
    use TheSeer\phpDox\Collector\SourceFile;
    use TheSeer\phpDox\FileInfo;

    class TokenFile {

        /**
         * @var FileInfo
         */
        private $file;

        private $dom;

        public function __construct(FileInfo $file) {
            if (!file_exists($file->getPathname())) {
                throw new TokenFileException(
                    sprintf("File '%s' not found", $file->getPathname()),
                    TokenFileException::FileNotFound
                );
            }
            $this->file = $file;
        }

        public function getRelativeName(FileInfo $path) {
            $file = new FileInfo($this->asDom()->getElementsByTagNameNS(SourceFile::XMLNS, 'file')->item(0)->getAttribute('realpath'));
            return $file->getRelative($path, FALSE);
        }

        public function asDom() {
            if (!$this->dom instanceof fDOMDocument) {
                $this->dom = new fDOMDocument();
                $this->dom->load($this->file->getPathname());
                $this->dom->registerNamespace('phpdox', SourceFile::XMLNS);
            }
            return $this->dom;
        }

    }

    class TokenFileException extends \Exception {
        const FileNotFound = 1;
    }

}

<?php
namespace TheSeer\phpDox\Generator {

    use TheSeer\fDOM\fDOMDocument;
    use TheSeer\phpDox\Collector\SourceFile;
    use TheSeer\phpDox\FileInfo;

    class TokenFile {

        /**
         * @var FileInfo
         */
        private $file;

        private $dom;

        public function __construct(FileInfo $file) {
            if (!$file->exists()) {
                throw new TokenFileException(
                    sprintf("File '%s' not found", $file->getPathname()),
                    TokenFileException::FileNotFound
                );
            }
            $this->file = $file;
        }

        public function getRelativeName(FileInfo $path) {
            $file = new FileInfo($this->asDom()->getElementsByTagNameNS(SourceFile::XMLNS, 'file')->item(0)->getAttribute('realpath'));
            return $file->getRelative($path, FALSE);
        }

        public function asDom() {
            if (!$this->dom instanceof fDOMDocument) {
                $this->dom = new fDOMDocument();
                $this->dom->load($this->file->getPathname());
                $this->dom->registerNamespace('phpdox', SourceFile::XMLNS);
            }
            return $this->dom;
        }

    }

    class TokenFileException extends \Exception {
        const FileNotFound = 1;
    }

}

Use Fileinfo's exist method rather than performing a file exist check manually


        {{ config('app.name') }}

 {{ trans('cortex/foundation::common.home') }}

            {!! Menu::render('managerarea.header') !!}

        {{ $currentTenant->name }}

 {{ trans('cortex/foundation::common.home') }}

            {!! Menu::render('managerarea.header') !!}

Change managerarea header app name to tenant name


<?php

namespace Politix\PolitikportalBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class MainController extends Controller {

    public function getHomepageAction() {

        $TopicModel = $this->get('TopicModel');

    	$topics = $TopicModel->getHomepageTopics();

    	$out['rows'][] = 'empty';

    	foreach ($topics as $topic) {

    		$out['topics'][] = $TopicModel->getTopic($topic);

    	}

    	$response = $this->render('PolitikportalBundle:Default:topics.html.twig', $out);

    	$lastModified = new \DateTime('yesterday');

    	$response->setLastModified($lastModified);
    	$response->isNotModified($this->getRequest());

    	return $response;

    }

}

<?php

namespace Politix\PolitikportalBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class MainController extends Controller {

    public function getHomepageAction() {

        $TopicModel = $this->get('TopicModel');

    	$topics = $TopicModel->getHomepageTopics();

    	$out['rows'][] = 'empty';

    	foreach ($topics as $topic) {

    		$out['topics'][] = $TopicModel->getTopic($topic);

    	}

    	$response = $this->render('PolitikportalBundle:Default:topics.html.twig', $out);

    	$response->setPublic();
		$response->setMaxAge(60);
		$response->setSharedMaxAge(60);

    	$lastModified = new \DateTime('yesterday');

    	$response->setLastModified($lastModified);
    	$response->isNotModified($this->getRequest());

    	return $response;

    }

}

Add more HTTP cache headers

Add more HTTP cache headers


<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {

        if (env('APP_ENV') === 'local') {
                \DB::connection()->enableQueryLog();
            }
            if (env('APP_ENV') === 'local') {
                \Event::listen('kernel.handled', function ($request, $response) {
                    if ( $request->has('sql-debug') ) {
                        $queries = \DB::getQueryLog();
                        dd($queries);
                    }
                });
            }

    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {

    }
}

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {

        if ($this->app->environment("local")) {
                \DB::connection()->enableQueryLog();
            }
            if ($this->app->environment("local")) {
                \Event::listen('kernel.handled', function ($request, $response) {
                    if ( $request->has('sql-debug') ) {
                        $queries = \DB::getQueryLog();
                        dd($queries);
                    }
                });
            }

    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {

    }
}

Change env('APP_ENV') to $app->environment() to prevent .env reading again


<?php

namespace Plank\Mediable\Exceptions\MediaUpload;

use Plank\Mediable\Exceptions\MediaUploadException;

class ConfigurationException extends MediaUploadException
{
    public static function cannotSetAdapter($class)
    {
        return new static("Could not set adapter of class `{$class}`. Must implement `\Plank\Mediable\SourceAdapters\SourceAdapterInterface`.");
    }

    public static function cannotSetModel($class)
    {
        return new static("Could not set `{$class}` as Media model class. Must extend `\Plank\Mediable\Media`.");
    }

    public static function noSourceProvided()
    {
        return new static('No source provided for upload.');
    }

    public static function unrecognizedSource($source)
    {
        $source = is_object($source) ? get_class($source) : (string) $source;

        return new static("Could not recognize source, `{$source}` provided.");
    }

    public static function diskNotFound($disk)
    {
        return new static("Cannot find disk named `{$disk}`.");
    }
}

<?php

namespace Plank\Mediable\Exceptions\MediaUpload;

use Plank\Mediable\Exceptions\MediaUploadException;

class ConfigurationException extends MediaUploadException
{
    public static function cannotSetAdapter($class)
    {
        return new static("Could not set adapter of class `{$class}`. Must implement `\Plank\Mediable\SourceAdapters\SourceAdapterInterface`.");
    }

    public static function cannotSetModel($class)
    {
        return new static("Could not set `{$class}` as Media model class. Must extend `\Plank\Mediable\Media`.");
    }

    public static function noSourceProvided()
    {
        return new static('No source provided for upload.');
    }

    public static function unrecognizedSource($source)
    {
        if (is_object($source)) {
            $source = get_class($source);
        } elseif (is_resource($source)) {
            $source = get_resource_type($source);
        } else {
            $source = (string) $source;
        }

        return new static("Could not recognize source, `{$source}` provided.");
    }

    public static function diskNotFound($disk)
    {
        return new static("Cannot find disk named `{$disk}`.");
    }
}

Check source type when raising an unrecognized source exception


<?php echo anchor('admin/items', 'Edit Item Database', array('class' => 'btn btn-primary')) ?>

<?php echo anchor('admin/update_items', 'Update Items', array('class' => 'btn btn-primary')) ?>

<?php echo anchor('auth/index', 'Edit Users', array('class' => 'btn btn-primary')) ?>

<?php echo anchor('admin/items', 'Edit Item Database', array('class' => 'btn btn-primary')) ?>

<?php echo anchor('admin/home/update_items', 'Update Items', array('class' => 'btn btn-primary')) ?>

<?php echo anchor('auth/index', 'Edit Users', array('class' => 'btn btn-primary')) ?>

Fix admin controller routing bug

Fix admin controller routing bug

Signed-off-by: JWhy <6a9f7c06e789f829524fd1a3a38b8c7d794c3a1f@jwhy.de>


<?php

namespace Libs;

class Redirect
{
	protected $session;

	public function __construct(\Libs\interfaces\SessionInterface $session)
	{
		$this->session = $session;
	}

	public function back()
	{
		header('Location: ' . $_SERVER['HTTP_REFERER']);
	}

	public function backWithInput($input)
	{
		$this->session->set('input', $input);
		$this->back();
	}

	public function to($url)
	{
		header('Location: ' . WEBROOT. $url);
	}

	public function home()
	{
		$this->to(DEFAULT_CONTROLLER . '/' . DEFAULT_METHOD);
	}
}

<?php

namespace Libs;

class Redirect
{
	protected $session;

	public function __construct(\Libs\interfaces\SessionInterface $session)
	{
		$this->session = $session;
	}

	public function back()
	{
		header('Location: ' . $_SERVER['HTTP_REFERER']);
	}

	public function backWithInput($input)
	{
		$this->session->set('input', $input);
		$this->back();
	}

	public function to($url)
	{
		header('Location: ' . WEBROOT. $url);
	}

	public function home()
	{
		$config = \Core\Config::getInstance();
		$this->to($config->get('default_controller') . '/' . $config->get('default_method'));
	}
}

Use the new config system

Use the new config system