<?php

namespace Auth0\Login\Repository;

use Auth0\Login\Auth0User;
use Auth0\Login\Auth0JWTUser;
use Auth0\Login\Contract\Auth0UserRepository as Auth0UserRepositoryContract;
use Illuminate\Contracts\Auth\Authenticatable;

class Auth0UserRepository implements Auth0UserRepositoryContract
{
    /**
     * @param array $decodedJwt
     *
     * @return Auth0JWTUser
     */
    public function getUserByDecodedJWT(array $decodedJwt) : Authenticatable
    {
        return new Auth0JWTUser($decodedJwt);
    }

    /**
     * @param array $userInfo
     *
     * @return Auth0User
     */
    public function getUserByUserInfo(array $userInfo) : Authenticatable
    {
        return new Auth0User($userInfo['profile'], $userInfo['accessToken']);
    }

    /**
     * @param string|int|null $identifier
     *
     * @return Authenticatable|null
     */
    public function getUserByIdentifier($identifier) : ?Authenticatable
    {
        // Get the user info of the user logged in (probably in session)
        $user = \App::make('auth0')->getUser();

        if ($user === null) {
            return null;
        }

        // Build the user
        $auth0User = $this->getUserByUserInfo($user);

        // It is not the same user as logged in, it is not valid
        if ($auth0User && $auth0User->getAuthIdentifier() == $identifier) {
            return $auth0User;
        }
    }
}

<?php

namespace Auth0\Login\Repository;

use Auth0\Login\Auth0User;
use Auth0\Login\Auth0JWTUser;
use Auth0\Login\Contract\Auth0UserRepository as Auth0UserRepositoryContract;
use Illuminate\Contracts\Auth\Authenticatable;

class Auth0UserRepository implements Auth0UserRepositoryContract
{
    /**
     * @param array $decodedJwt
     *
     * @return Auth0JWTUser
     */
    public function getUserByDecodedJWT(array $decodedJwt) : Authenticatable
    {
        return new Auth0JWTUser($decodedJwt);
    }

    /**
     * @param array $userInfo
     *
     * @return Auth0User
     */
    public function getUserByUserInfo(array $userInfo) : Authenticatable
    {
        return new Auth0User($userInfo['profile'], $userInfo['accessToken']);
    }

    /**
     * @param string|int|null $identifier
     *
     * @return Authenticatable|null
     */
    public function getUserByIdentifier($identifier) : ?Authenticatable
    {
        // Get the user info of the user logged in (probably in session)
        $user = \App::make('auth0')->getUser();

        if ($user === null) {
            return null;
        }

        // Build the user
        $auth0User = $this->getUserByUserInfo($user);

        // It is not the same user as logged in, it is not valid
        if ($auth0User && $auth0User->getAuthIdentifier() == $identifier) {
            return $auth0User;
        }

        return null;
    }
}

Fix the missing `return null;` in `getUserByIdentifier`


<?php
class Kwc_Shop_AddToCart_FrontendForm extends Kwc_Shop_AddToCartAbstract_FrontendForm
{
    protected $_product;

    protected function _initFields()
    {
        parent::_initFields();
        $this->add(new Kwf_Form_Field_Select('amount', trlKwfStatic('Amount')))
            ->setAllowBlank(false)
            ->setValues($this->_getAmountValues())
            ->setEditable(true);
    }

    protected function _getAmountValues($count = 10)
    {
        $ret = array();
        for ($x = 1; $x <= $count; $x++) {
            $ret[$x] = $x;
        }
        return $ret;
    }

    public function setProduct(Kwc_Shop_Product $product)
    {
        $this->_product = $product;
    }

    protected function _beforeInsert(&$row)
    {
        $select = $this->_getCheckProductRowExistsSelect($row);
        $existingRow = null;
        foreach ($row->getModel()->getRows($select) as $i) {
            $match = true;
            foreach ($row->getSiblingRow(0)->toArray() as $key => $val) {
                if ($key != 'amount' && $i->$key != $row->$key) {
                    $match = false;
                    break;
                }
            }
            if ($match) {
                $existingRow = $i;
                break;
            }
        }
        if ($existingRow) {
            $existingRow->amount += $row->amount;
            $row = $existingRow;
        }
    }

    protected function _getCheckProductRowExistsSelect($row)
    {
        if (!$row->shop_order_id) return false; //happens for replacements (babytuch)

        $select = $row->getModel()->select()
            ->whereEquals('shop_order_id', $row->shop_order_id)
            ->whereEquals('shop_product_price_id', $row->shop_product_price_id)
            ->whereEquals('add_component_id', $row->add_component_id)
            ->whereEquals('add_component_class', $row->add_component_class);
        return $select;
    }
}

<?php
class Kwc_Shop_AddToCart_FrontendForm extends Kwc_Shop_AddToCartAbstract_FrontendForm
{
    protected $_product;

    protected function _initFields()
    {
        parent::_initFields();
        $this->add(new Kwf_Form_Field_Select('amount', trlKwfStatic('Amount')))
            ->setAllowBlank(false)
            ->setValues($this->_getAmountValues())
            ->setEditable(true);
    }

    protected function _getAmountValues($count = 10)
    {
        $ret = array();
        for ($x = 1; $x <= $count; $x++) {
            $ret[$x] = $x;
        }
        return $ret;
    }

    public function setProduct(Kwc_Shop_Product $product)
    {
        $this->_product = $product;
    }
}

Remove beforeInsert function - now every product added to cart will use one line at checkout, no subtraction or addition to products already in cart


<?php

namespace App\Http\Controllers;

use App\Models\Note;
use Illuminate\Support\Facades\Request;

class NoteController extends Controller
{
    /**
     * List all notes
     */
    public function index()
    {
        $notes = Note::with([
            'user',
            'tags',
        ])->get();
        return $notes;
    }

    public function show(int $id)
    {
        return (new Note())->find($id);
    }

    /**
     * Create a new note
     * @param Request $request
     * @return string
     */
    public function store(Request $request)
    {
        return 'Implement creation of note.';
    }

    /**
     * Update a note
     * @param Request $request
     * @param int $id
     * @return string
     */
    public function update(Request $request, int $id)
    {
        return 'Implement update of note.';
    }

    /**
     * Delete a note
     * @param int $id
     * @return string
     */
    public function destroy(int $id)
    {
        return 'Implement delete of note.';
    }

    /**
     * Shows most recent note
     */
    public function latest()
    {
        $note = Note::with([
            'user',
            'tags',
        ])
            ->orderBy('updated_at', 'DESC')
            ->first();
        return $note;
    }
}

<?php

namespace App\Http\Controllers;

use App\Models\Note;
use Illuminate\Support\Facades\Request;
use Symfony\Component\HttpFoundation\Response;

class NoteController extends Controller
{
    /**
     * List all notes
     */
    public function index()
    {
        $notes = Note::with([
            'user',
            'tags',
        ])->get();
        return $notes;
    }

    public function show(int $id)
    {
        return (new Note())->find($id);
    }

    /**
     * Create a new note
     * @param Request $request
     * @return string
     */
    public function store(Request $request)
    {
        return 'Implement creation of note.';
    }

    /**
     * Update a note
     * @param Request $request
     * @param int $id
     * @return string
     */
    public function update(Request $request, int $id)
    {
        return 'Implement update of note.';
    }

    /**
     * Delete a note
     * @param int $id
     * @return string
     */
    public function destroy(int $id)
    {
        $note = Note::find($id);
        if ($note === null) {
            $statusCode = Response::HTTP_NOT_FOUND;
        } else {
            $note->delete();
            $statusCode = Response::HTTP_NO_CONTENT;
        }
        return response('', $statusCode);
    }

    /**
     * Shows most recent note
     */
    public function latest()
    {
        $note = Note::with([
            'user',
            'tags',
        ])
            ->orderBy('updated_at', 'DESC')
            ->first();
        return $note;
    }
}

Implement note delete api endpoint

Implement note delete api endpoint


<?php

// comment out the following two lines when deployed to production
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

require(__DIR__ . '/../vendor/autoload.php');
require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');

$config = require(__DIR__ . '/../config/web.php');

(new yii\web\Application($config))->run();

<?php

// comment out the following two lines when deployed to production
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

require(__DIR__ . '/../vendor/autoload.php');
require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');

\Yii::setAlias('@bower', '/../vendor/bower-asset');

$config = require(__DIR__ . '/../config/web.php');

(new yii\web\Application($config))->run();

Change bower alias to bower-asset

Change bower alias to bower-asset


<?php

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

class AddThreadsColumnToServersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('servers', function (Blueprint $table) {
            $table->string('threads')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('servers', function (Blueprint $table) {
            $table->dropColumn('threads');
        });
    }
}

<?php

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

class AddThreadsColumnToServersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('servers', function (Blueprint $table) {
            $table->string('threads')->nullable()->after('cpu');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('servers', function (Blueprint $table) {
            $table->dropColumn('threads');
        });
    }
}

Move threads column to the

Move threads column to the

Put column after CPU, not at the end.


<?php

namespace CfdiUtilsTests\OpenSSL;

use CfdiUtils\OpenSSL\OpenSSL;
use CfdiUtils\OpenSSL\OpenSSLPropertyTrait;
use CfdiUtilsTests\TestCase;

final class OpenSSLPropertyTest extends TestCase
{
    public function testCorrectImplementer()
    {
        $object = new class() {
            use OpenSSLPropertyTrait;

            public function __construct(OpenSSL $openSSL = null)
            {
                $this->setOpenSSL($openSSL ?: new OpenSSL());
            }
        };

        $this->assertInstanceOf(OpenSSL::class, $object->getOpenSSL());
    }

    public function testNotInstantiatedImplementer()
    {
        $object = new class() {
            use OpenSSLPropertyTrait;
        };

        $this->expectException(\TypeError::class);
        /** @noinspection PhpExpressionResultUnusedInspection */
        $object->getOpenSSL();
    }

    public function testWithDefaultSetterVisibility()
    {
        $object = new class() {
            use OpenSSLPropertyTrait;
        };
        $this->assertFalse(is_callable([$object, 'setOpenSSL']), 'setOpenSSL must not be public accesible');
    }

    public function testChangingSetterVisibility()
    {
        $object = new class() {
            use OpenSSLPropertyTrait {
                setOpenSSL as public;
            }
        };
        $this->assertTrue(is_callable([$object, 'setOpenSSL']), 'setOpenSSL was not overrided by trait usage');
    }
}

<?php

namespace CfdiUtilsTests\OpenSSL;

use CfdiUtils\OpenSSL\OpenSSL;
use CfdiUtils\OpenSSL\OpenSSLPropertyTrait;
use CfdiUtilsTests\TestCase;

final class OpenSSLPropertyTest extends TestCase
{
    public function testCorrectImplementer()
    {
        $object = new class() {
            use OpenSSLPropertyTrait;

            public function __construct(OpenSSL $openSSL = null)
            {
                $this->setOpenSSL($openSSL ?: new OpenSSL());
            }
        };

        $this->assertInstanceOf(OpenSSL::class, $object->getOpenSSL());
    }

    public function testNotInstantiatedImplementer()
    {
        $object = new class() {
            use OpenSSLPropertyTrait;
        };

        $this->expectException(\TypeError::class);
        /** @noinspection PhpExpressionResultUnusedInspection */
        $object->getOpenSSL();
    }

    public function testWithDefaultSetterVisibility()
    {
        $object = new class() {
            use OpenSSLPropertyTrait;
        };
        $this->assertFalse(is_callable([$object, 'setOpenSSL']), 'setOpenSSL must not be public accesible');
    }
}

Remove test that does not probe anything


<?php
return [

    /*
    |----------------------------------------------------------------
    | Asset containers.
    |----------------------------------------------------------------
    |
    | Asset containers to be loaded.
    |
    */
    "containers" => array(
        "images" => [
            "print_pattern" => '<img src="{{URL}}">',
            "file_regex"    => "/\\.(jpg|jpeg|tiff|gif|png|bmp|ico)$/i",
            "path"          => "/public/assets/images",
            "url"           => "/assets/images",
            "versioned"     => false
        ],
        "scripts" => [
            "print_pattern" => '<script src="{{URL}}" type="application/javascript"></script>',
            "file_regex"    => "/\\.js$/i",
            "path"          => "/public/assets/scripts",
            "url"           => "/assets/scripts",
            "versioned"     => true
        ],
        "styles" => [
            "print_pattern" => '<link rel="stylesheet" type="text/css" href="{{URL}}" title="{{NAME}}">',
            "file_regex"    => "/\\.css$/i",
            "path"          => "/public/assets/styles",
            "url"           => "/assets/styles",
            "versioned"     => true
        ],
        //
        // Add your own custom containers here.
        //
    )
];

<?php
return [

    /*
    |----------------------------------------------------------------
    | Asset containers.
    |----------------------------------------------------------------
    |
    | Asset containers to be loaded.
    |
    */
    "containers" => array(
        "images" => [
            "print_pattern" => '<img src="{{URL}}">',
            "file_regex"    => "/\\.(jpg|jpeg|tiff|gif|png|bmp|ico)$/i",
            "path"          => "/public/assets/images",
            "url"           => "/assets/images",
            "versioned"     => false
        ],
        "scripts" => [
            "print_pattern" => '<script src="{{URL}}" type="application/javascript"></script>',
            "file_regex"    => "/\\.js$/i",
            "path"          => "/public/assets/scripts",
            "url"           => "/assets/scripts",
            "versioned"     => false
        ],
        "styles" => [
            "print_pattern" => '<link rel="stylesheet" type="text/css" href="{{URL}}" title="{{NAME}}">',
            "file_regex"    => "/\\.css$/i",
            "path"          => "/public/assets/styles",
            "url"           => "/assets/styles",
            "versioned"     => false
        ],
        //
        // Add your own custom containers here.
        //
    )
];

Set default value for "versioned" to false.


<?php
/**
 * This file is part of the Clastic package.
 *
 * (c) Dries De Peuter <dries@nousefreak.be>
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Clastic\BackofficeBundle\Tests;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

/**
 * @author Dries De Peuter <dries@nousefreak.be>
 */
class SecurityTest extends WebTestCase
{
    public function testLoginRedirect()
    {
        $client = static::createClient();
        $client->request('GET', '/admin/');

        $this->assertTrue($client->getResponse()->isRedirect());
        $this->assertRegExp('|/admin/login$|', $client->getResponse()->headers->get('location'));
    }

//    public function testLoginForm()
//    {
//        $client = static::createClient();
//        $crawler = $client->request('GET', '/admin/login');
//
//        $this->assertEquals(1, $crawler->filter('form')->count());
//        $this->assertEquals(1, $crawler->filter('form input[name="_username"]')->count());
//        $this->assertEquals(1, $crawler->filter('form input[name="_password"]')->count());
//        $this->assertEquals(1, $crawler->filter('form input[name="_remember_me"]')->count());
//        $this->assertEquals(1, $crawler->filter('form button[name="_submit"]')->count());
//    }
}

<?php
/**
 * This file is part of the Clastic package.
 *
 * (c) Dries De Peuter <dries@nousefreak.be>
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Clastic\BackofficeBundle\Tests;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

/**
 * @author Dries De Peuter <dries@nousefreak.be>
 */
class SecurityTest extends WebTestCase
{
    public function testLoginRedirect()
    {
        $client = static::createClient();
        $client->request('GET', '/admin/');

        $this->assertTrue($client->getResponse()->isRedirect());
        $this->assertRegExp('|/admin/login$|', $client->getResponse()->headers->get('location'));
    }

    public function testLoginForm()
    {
        $client = static::createClient();
        $crawler = $client->request('GET', '/admin/login');

        $this->assertEquals(1, $crawler->filter('form')->count());
        $this->assertEquals(1, $crawler->filter('form input[name="_username"]')->count());
        $this->assertEquals(1, $crawler->filter('form input[name="_password"]')->count());
        $this->assertEquals(1, $crawler->filter('form input[name="_remember_me"]')->count());
        $this->assertEquals(1, $crawler->filter('form button[name="_submit"]')->count());
    }
}

[Backoffice] Use safer checks to prevent unknown methods.


  protected function updateObjectFromRequest($content)
  {
    $this->object->importFrom('xml', $content);
  }

  protected function updateObjectFromRequest($content)
  {
    $this->object->importFrom('array', $this->parsePayload($content));
  }

[sfDoctrineRestGeneratorPlugin]: Support foreign keys serialization during object creation

git-svn-id: 61b081f4c054ffac195be9e2cfc7002f55369afb@26289 ee427ae8-e902-0410-961c-c3ed070cd9f9


<?php

/*
 * This file is part of the Nelmio SecurityBundle.
 *
 * (c) Nelmio <hello@nelm.io>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Nelmio\SecurityBundle\ContentSecurityPolicy;

class ContentSecurityPolicyParser
{
    protected $keywords = array(
        'self',
        'unsafe-inline',
        'unsafe-eval',
        'strict-dynamic',
        'unsafe-hashes',
        'report-sample',
        'unsafe-allow-redirects',
        'none',
    );

    /**
     * @param array $sourceList
     *
     * @return string
     */
    public function parseSourceList($sourceList)
    {
        if (!is_array($sourceList)) {
            return $sourceList;
        }

        $sourceList = $this->quoteKeywords($sourceList);

        return implode(' ', $sourceList);
    }

    /**
     * @param array $sourceList
     *
     * @return array
     */
    protected function quoteKeywords(array $sourceList)
    {
        $keywords = $this->keywords;

        return array_map(
            function ($source) use ($keywords) {
                if (in_array($source, $keywords, true)) {
                    return sprintf("'%s'", $source);
                }

                return $source;
            },
            $sourceList
        );
    }
}

<?php

/*
 * This file is part of the Nelmio SecurityBundle.
 *
 * (c) Nelmio <hello@nelm.io>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Nelmio\SecurityBundle\ContentSecurityPolicy;

class ContentSecurityPolicyParser
{
    protected $keywords = array(
        'self',
        'unsafe-inline',
        'unsafe-eval',
        'wasm-unsafe-eval',
        'strict-dynamic',
        'unsafe-hashes',
        'report-sample',
        'unsafe-allow-redirects',
        'none',
    );

    /**
     * @param array $sourceList
     *
     * @return string
     */
    public function parseSourceList($sourceList)
    {
        if (!is_array($sourceList)) {
            return $sourceList;
        }

        $sourceList = $this->quoteKeywords($sourceList);

        return implode(' ', $sourceList);
    }

    /**
     * @param array $sourceList
     *
     * @return array
     */
    protected function quoteKeywords(array $sourceList)
    {
        $keywords = $this->keywords;

        return array_map(
            function ($source) use ($keywords) {
                if (in_array($source, $keywords, true)) {
                    return sprintf("'%s'", $source);
                }

                return $source;
            },
            $sourceList
        );
    }
}

Add the wasm-unsafe-eval keyword for CSP


<?php

namespace Knp\IpsumBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Knp\IpsumBundle\Form\Type\ContactType;
use Knp\IpsumBundle\Form\Model\Contact;

class FormController extends Controller
{
    public function contactAction()
    {
        $contact = new Contact();
        $form = $this->get('form.factory')->create(new ContactType(), $contact);

        $request = $this->container->get('request');

        if ('POST' === $request->getMethod()) {
            $form->bindRequest($request);

            if ($form->isValid()) {
                $ret = $contact->dummySend();

                $this->get('session')->setFlash('notice', $ret);

                return new RedirectResponse($this->generateUrl('knp_ipsum'));
            }
        }

        return $this->render('KnpIpsumBundle:Form:contact.html.twig', array(
            'form' => $form->createView(),
        ));
    }
}

<?php

namespace Knp\IpsumBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Knp\IpsumBundle\Form\Type\ContactType;
use Knp\IpsumBundle\Form\Model\Contact;

class FormController extends Controller
{
    public function contactAction()
    {
        $contact = new Contact();
        $form = $this->createForm(new ContactType(), $contact);

        $request = $this->container->get('request');

        if ('POST' === $request->getMethod()) {
            $form->bindRequest($request);

            if ($form->isValid()) {
                $ret = $contact->dummySend();

                $this->get('session')->setFlash('notice', $ret);

                return new RedirectResponse($this->generateUrl('knp_ipsum'));
            }
        }

        return $this->render('KnpIpsumBundle:Form:contact.html.twig', array(
            'form' => $form->createView(),
        ));
    }
}

Use createForm instead of the form factory


<?php
/**
 * @author         Pierre-Henry Soria <hello@ph7cms.com>
 * @copyright      (c) 2019, Pierre-Henry Soria. All Rights Reserved.
 * @license        GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
 * @package        PH7 / App / System / Core / Class
 */

namespace PH7;

use PH7\Framework\Cookie\Cookie;
use PH7\Framework\Security\Security;
use PH7\Framework\Session\Session;
use stdClass;

class RememberMeCore
{
    const CHECKBOX_FIELD_NAME = 'remember';
    const STAY_LOGGED_IN_REQUESTED = 'stayedLoggedInRequested';

    /**
     * @param Session $oSession
     *
     * @return bool
     */
    public function isEligible(Session $oSession)
    {
        return $oSession->exists(self::STAY_LOGGED_IN_REQUESTED);
    }

    public function enableSession(stdClass $oUserData)
    {
        $aCookieData = [
            // Hash one more time the password for the cookie
            'member_remember' => Security::hashCookie($oUserData->password),
            'member_id' => $oUserData->profileId
        ];
        (new Cookie)->set($aCookieData);
    }
}

<?php
/**
 * @author         Pierre-Henry Soria <hello@ph7cms.com>
 * @copyright      (c) 2019, Pierre-Henry Soria. All Rights Reserved.
 * @license        GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
 * @package        PH7 / App / System / Core / Class
 */

namespace PH7;

use PH7\Framework\Cookie\Cookie;
use PH7\Framework\Security\Security;
use PH7\Framework\Session\Session;
use stdClass;

class RememberMeCore
{
    const CHECKBOX_FIELD_NAME = 'remember';
    const STAY_LOGGED_IN_REQUESTED = 'stayed_logged_requested';

    /**
     * @param Session $oSession
     *
     * @return bool
     */
    public function isEligible(Session $oSession)
    {
        return $oSession->exists(self::STAY_LOGGED_IN_REQUESTED);
    }

    public function enableSession(stdClass $oUserData)
    {
        $aCookieData = [
            // Hash one more time the password for the cookie
            'member_remember' => Security::hashCookie($oUserData->password),
            'member_id' => $oUserData->profileId
        ];
        (new Cookie)->set($aCookieData);
    }
}

[Consistency] Rename session name (to be accurate with the others)

And as mentioned in pH7CMS's Coding Conventions: https://ph7cms.com/doc/en/code-convention#function-global-variable-array-names


<?php

	return Affinity\Config::create([

		//
		// The execution mode determines default operation for some processes which should
		// naturally differ depending on the environment (development vs. production)
		//

		'execution_mode'  => IW\EXEC_MODE\DEVELOPMENT,

		//
		// Timezone
		//

		'timezone' => 'US/Pacific',

		//
		// Debugging information to use.  Keeping the debugging destination to NULL will
		// change the default depending on the execution mode.  If the execution mode
		// is IW\EXEC_MODE\DEVELOPMENT, it will dump errors to the screen.  Otherwise it will
		// use the configured $_SERVER['SERVER_ADMIN'] e-mail address.
		//

		'debugging' => [
			'destination' => NULL,
			'error_level' => E_ALL,
		],

		//
		// The write directory provides a base directory to which the system and services can write
		// files to.  If some of these files need to be public, it is suggested you create relative
		// symbolic links in the "public" folder.
		//

		'write_directory' => 'writable'
	]);

<?php

	return Affinity\Config::create([
		//
		// The system php command
		//
		'php' => 'php',

		//
		// The document root
		//
		'docroot' => 'public',

		//
		// The execution mode determines default operation for some processes which should
		// naturally differ depending on the environment (development vs. production)
		//

		'execution_mode'  => IW\EXEC_MODE\DEVELOPMENT,

		//
		// Timezone
		//

		'timezone' => 'US/Pacific',

		//
		// Debugging information to use.  Keeping the debugging destination to NULL will
		// change the default depending on the execution mode.  If the execution mode
		// is IW\EXEC_MODE\DEVELOPMENT, it will dump errors to the screen.  Otherwise it will
		// use the configured $_SERVER['SERVER_ADMIN'] e-mail address.
		//

		'debugging' => [
			'destination' => NULL,
			'error_level' => E_ALL,
		],

		//
		// The write directory provides a base directory to which the system and services can write
		// files to.  If some of these files need to be public, it is suggested you create relative
		// symbolic links in the "public" folder.
		//

		'write_directory' => 'writable'
	]);

Add some useful binary info

Add some useful binary info


<?php
/*
 * Copyright (c)
 * Kirill chEbba Chebunin <iam@chebba.org>
 *
 * This source file is subject to the MIT license that is bundled
 * with this package in the file LICENSE.
 */

namespace EventBand\Bundle;

use EventBand\Bundle\DependencyInjection\Compiler\JmsEventConfigPass;
use EventBand\Bundle\DependencyInjection\Compiler\ReplaceDispatcherPass;
use EventBand\Bundle\DependencyInjection\Compiler\SubscribeKernelListenerPass;
use EventBand\Bundle\DependencyInjection\Compiler\SubscribePass;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

/**
 * EventBandBundle main bundle class
 *
 * @author Kirill chEbba Chebunin <iam@chebba.org>
 * @license http://opensource.org/licenses/mit-license.php MIT
 */
class EventBandBundle extends Bundle
{
    public function build(ContainerBuilder $container)
    {
        $container->addCompilerPass(new SubscribeKernelListenerPass(), PassConfig::TYPE_REMOVE); // RegisterKernelListenersPass is registered on "AFTER_REMOVING"
        $container->addCompilerPass(new SubscribePass(), PassConfig::TYPE_AFTER_REMOVING);
        $container->addCompilerPass(new ReplaceDispatcherPass(), PassConfig::TYPE_BEFORE_REMOVING);

        $container->addCompilerPass(new JmsEventConfigPass());
    }
}

<?php
/*
 * Copyright (c)
 * Kirill chEbba Chebunin <iam@chebba.org>
 *
 * This source file is subject to the MIT license that is bundled
 * with this package in the file LICENSE.
 */

namespace EventBand\Bundle;

use EventBand\Bundle\DependencyInjection\Compiler\JmsEventConfigPass;
use EventBand\Bundle\DependencyInjection\Compiler\ReplaceDispatcherPass;
use EventBand\Bundle\DependencyInjection\Compiler\SubscribeKernelListenerPass;
use EventBand\Bundle\DependencyInjection\Compiler\SubscribePass;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

/**
 * EventBandBundle main bundle class
 *
 * @author Kirill chEbba Chebunin <iam@chebba.org>
 * @license http://opensource.org/licenses/mit-license.php MIT
 */
class EventBandBundle extends Bundle
{
    public function build(ContainerBuilder $container)
    {
        $container->addCompilerPass(new SubscribeKernelListenerPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION); // RegisterKernelListenersPass is registered on "BEFORE_REMOVING" since 2.3
        $container->addCompilerPass(new SubscribePass(), PassConfig::TYPE_AFTER_REMOVING);
        $container->addCompilerPass(new ReplaceDispatcherPass(), PassConfig::TYPE_BEFORE_REMOVING);

        $container->addCompilerPass(new JmsEventConfigPass());
    }
}

Change SubscribeKernelListenerPass position to BEFORE_OPTIMIZATION because original one was moved to BEFORE_REMOVE since Symfony 2.3


<?php

namespace Command;

use Database\Connect;
use Config\Config;
use Database\Query;

class setData
{
    /**
     * setData constructor.
     *
     * @param \Aura\Web\Request $request
     * @param \Aura\Web\Response $response
     * @param \Aura\View\View $view
     */
    public function __construct($request, $response, $view)
    {
        $status = 'success';
        $message = 'Data updated successfully.';

        $secureToken = (new Config)->getConfig()['secure_token'];
        $retrievedSecureToken = $request->query->get('key', '');

        if ($secureToken !== $retrievedSecureToken) {
            $status = 'error';
            $message = 'Incorrect secure token.';
        } else {
            $post = $request->post;
            $commandId = $post->get('command_id', null);
            $consumedDate = $post->get('command_consumed_date_time', '0000-00-00 00:00:00');

            if ($commandId) {
                $query = (new Query)
                    ->update()
                    ->table('commands')
                    ->cols([
                        'consumed' => 1,
                        'command_consumed_date_time' => $consumedDate,
                    ])
                    ->where('command_id = ?', $commandId);

                (new Connect)->query($query);
            }
        }

        $view->setData([
            'status' => $status,
            'message' => $message,
        ]);

        $response->content->set($view->__invoke());
    }
}

<?php

namespace Command;

use Database\Connect;
use Config\Config;
use Database\Query;

class setData
{
    /**
     * setData constructor.
     *
     * @param \Aura\Web\Request $request
     * @param \Aura\Web\Response $response
     * @param \Aura\View\View $view
     */
    public function __construct($request, $response, $view)
    {
        $status = 'success';
        $message = 'Data updated successfully.';

        $secureToken = (new Config)->getConfig()['secure_token'];
        $retrievedSecureToken = $request->query->get('key', '');

        if ($secureToken !== $retrievedSecureToken) {
            $status = 'error';
            $message = 'Incorrect secure token.';
        } else {
            $post = $request->post;
            $commandId = $post->get('command_id', null);
            $consumedDate = $post->get('command_consumed_date_time', '0000-00-00 00:00:00');
            $mongoId = $post->get('mongo_id', null);

            if ($commandId) {
                $query = (new Query)
                    ->update()
                    ->table('commands')
                    ->cols([
                        'consumed' => 1,
                        'command_consumed_date_time' => $consumedDate,
                        'mongo_id' => $mongoId,
                    ])
                    ->where('command_id = ?', $commandId);

                (new Connect)->query($query);
            }
        }

        $view->setData([
            'status' => $status,
            'message' => $message,
        ]);

        $response->content->set($view->__invoke());
    }
}

Set mongo id in database after command was consumed


<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

use Symfony\Polyfill\Ctype as p;

if (!extension_loaded('ctype')) {
    function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
    function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
    function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
    function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
    function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
    function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
    function ctype_print($text) { return p\Ctype::ctype_print($text); }
    function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
    function ctype_space($text) { return p\Ctype::ctype_space($text); }
    function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
    function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
}

<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

use Symfony\Polyfill\Ctype as p;

if (!function_exists('ctype_alnum')) {
    function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
    function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
    function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
    function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
    function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
    function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
    function ctype_print($text) { return p\Ctype::ctype_print($text); }
    function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
    function ctype_space($text) { return p\Ctype::ctype_space($text); }
    function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
    function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
}

Use function exsists instead of extension loaded


<?php
$message = trim($_REQUEST['message']);
if($_REQUEST['action'] == 'Preview announcement') {
	$container = create_container('skeleton.php','announcement_create.php');
	$container['preview'] = $message;
	forward($container);
}

if (strlen($message) > 255) {
	create_error('No more than 255 characters per announcement!');
}

// put the msg into the database
$db->query('INSERT INTO announcement (time, admin_id, msg) VALUES('.$db->escapeNumber(TIME).', '.$db->escapeNumber(SmrSession::$account_id).', '.$db->escapeString($message).')');

forward(create_container('skeleton.php', 'admin_tools.php'));

<?php
$message = trim($_REQUEST['message']);
if($_REQUEST['action'] == 'Preview announcement') {
	$container = create_container('skeleton.php','announcement_create.php');
	$container['preview'] = $message;
	forward($container);
}

// put the msg into the database
$db->query('INSERT INTO announcement (time, admin_id, msg) VALUES('.$db->escapeNumber(TIME).', '.$db->escapeNumber(SmrSession::$account_id).', '.$db->escapeString($message).')');

forward(create_container('skeleton.php', 'admin_tools.php'));

Remove restriction on admin announcement message length

Messages can now be unlimited in size, instead of limited to
255 characters.


<?php

namespace RadDB\Http\Requests;

use Illuminate\Http\Request;
use Illuminate\Foundation\Http\FormRequest;

class StoreRecommendationRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules(Request $request)
    {
        // Build the validation rules
        $rules = [
            'surveyId'       => 'required|exists:testdates,id|integer',
            'recommendation' => 'required|string|max:500',
            'resolved'       => 'integer',
            'WONum'          => 'string|nullable|max:20',
            'ServiceReport'  => 'file|mimes:pdf',
        ];

        // If 'resolved' was checked, then add validation rules for
        // 'RecResolveDate' and 'ResolvedBy'.
        if ($request->filled('resolved')) {
            $rules['RecResolveDate'] = 'required|date_format:Y-m-d';
            $rules['ResolvedBy'] = 'required|string|max:10';
        }

        return $rules;
    }
}

<?php

namespace RadDB\Http\Requests;

use Illuminate\Http\Request;
use Illuminate\Foundation\Http\FormRequest;

class StoreRecommendationRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules(Request $request)
    {
        // Build the validation rules
        $rules = [
            'surveyId'       => 'required|exists:testdates,id|integer',
            'recommendation' => 'required|string|max:1000',
            'resolved'       => 'integer',
            'WONum'          => 'string|nullable|max:20',
            'ServiceReport'  => 'file|mimes:pdf',
        ];

        // If 'resolved' was checked, then add validation rules for
        // 'RecResolveDate' and 'ResolvedBy'.
        if ($request->filled('resolved')) {
            $rules['RecResolveDate'] = 'required|date_format:Y-m-d';
            $rules['ResolvedBy'] = 'required|string|max:10';
        }

        return $rules;
    }
}

Increase max accepted size of recommendation field


<?php

namespace Dflydev\Hawk\Header;

class HeaderFactory
{
    public static function create($fieldName, array $attributes = null)
    {
        $fieldValue = 'Hawk';

        if (null !== $attributes) {
            $index = 0;
            foreach ($attributes as $key => $value) {
                if ($index++ > 0) {
                    $fieldValue .= ',';
                }

                $fieldValue .= ' ' . $key . '="' . $value . '"';
            }
        }

        return new Header($fieldName, $fieldValue, $attributes);
    }

    public static function createFromString($fieldName, $fieldValue, array $requiredKeys = null)
    {
        return static::create(
            $fieldName,
            HeaderParser::parseFieldValue($fieldValue, $requiredKeys)
        );
    }

    public static function createFromHeaderObjectOrString($fieldName, $headerObjectOrString, callable $onError)
    {
        if (is_string($headerObjectOrString)) {
            return static::createFromString($fieldName, $headerObjectOrString);
        } elseif ($headerObjectOrString instanceof Header) {
            return $headerObjectOrString;
        } else {
            throw new \InvalidArgumentException(
                'Header must either be a string or an instance of "Dflydev\Hawk\Header\Header"'
            );
        }
    }
}

<?php

namespace Dflydev\Hawk\Header;

class HeaderFactory
{
    public static function create($fieldName, array $attributes = null)
    {
        $fieldValue = 'Hawk';

        if (null !== $attributes) {
            $index = 0;
            foreach ($attributes as $key => $value) {
                if ($index++ > 0) {
                    $fieldValue .= ',';
                }

                $fieldValue .= ' ' . $key . '="' . $value . '"';
            }
        }

        return new Header($fieldName, $fieldValue, $attributes);
    }

    public static function createFromString($fieldName, $fieldValue, array $requiredKeys = null)
    {
        return static::create(
            $fieldName,
            HeaderParser::parseFieldValue($fieldValue, $requiredKeys)
        );
    }

    public static function createFromHeaderObjectOrString($fieldName, $headerObjectOrString, $onError)
    {
        if (is_string($headerObjectOrString)) {
            return static::createFromString($fieldName, $headerObjectOrString);
        } elseif ($headerObjectOrString instanceof Header) {
            return $headerObjectOrString;
        } else {
            call_user_func($onError);
        }
    }
}

Remove callable for php 5.3 compat.

Remove callable for php 5.3 compat.


<?php

namespace Sstalle\php7cc\Infrastructure;

use Symfony\Component\Console\Input\InputInterface;

class Application extends \Symfony\Component\Console\Application
{
    /**
     * {@inheritdoc}
     */
    public function getDefinition()
    {
        $inputDefinition = parent::getDefinition();
        $inputDefinition->setArguments();

        return $inputDefinition;
    }

    /**
     * {@inheritdoc}
     */
    protected function getCommandName(InputInterface $input)
    {
        return PHP7CCCommand::COMMAND_NAME;
    }

    /**
     * {@inheritdoc}
     */
    protected function getDefaultCommands()
    {
        $defaultCommands = parent::getDefaultCommands();
        $defaultCommands[] = new PHP7CCCommand();

        return $defaultCommands;
    }
}

<?php

namespace Sstalle\php7cc\Infrastructure;

use Symfony\Component\Console\Input\InputInterface;

class Application extends \Symfony\Component\Console\Application
{
    const VERSION = '1.0.0-beta';

    /**
     * {@inheritdoc}
     */
    public function __construct()
    {
        parent::__construct('PHP 7 Compatibility Checker', static::VERSION);
    }

    /**
     * {@inheritdoc}
     */
    public function getDefinition()
    {
        $inputDefinition = parent::getDefinition();
        $inputDefinition->setArguments();

        return $inputDefinition;
    }

    /**
     * {@inheritdoc}
     */
    protected function getCommandName(InputInterface $input)
    {
        return PHP7CCCommand::COMMAND_NAME;
    }

    /**
     * {@inheritdoc}
     */
    protected function getDefaultCommands()
    {
        $defaultCommands = parent::getDefaultCommands();
        $defaultCommands[] = new PHP7CCCommand();

        return $defaultCommands;
    }
}

Add application name & version

Add application name & version


<?
/**
 * Nooku Platform - http://www.nooku.org/platform
 *
 * @copyright	Copyright (C) 2011 - 2014 Johan Janssens and Timble CVBA. (http://www.timble.net)
 * @license		GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link		https://github.com/nooku/nooku-platform for the canonical source repository
 */
?>

<?= object($module->identifier, array(
        'title' => $module->title,
        'data'  => array('module' => $module)
    ))->render(); ?>

<?
/**
 * Nooku Platform - http://www.nooku.org/platform
 *
 * @copyright	Copyright (C) 2011 - 2014 Johan Janssens and Timble CVBA. (http://www.timble.net)
 * @license		GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link		https://github.com/nooku/nooku-platform for the canonical source repository
 */
?>

<?= object($module->identifier, array(
        'title'      => $module->title,
        'data'       => array('module' => $module),
        'parameters' => $module->getParameters()->getData()
    ))->render(); ?>

Rename 'template_parameters' to 'parameters' and move to KViewAbstract.


<?php
/* Copyright (C) NAVER <http://www.navercorp.com> */

class IpFilter
{
	public function filter($ip_list, $ip = NULL)
	{
		if(!$ip) $ip = $_SERVER['REMOTE_ADDR'];
		return Rhymix\Framework\Filters\IpFilter::inRanges($ip, $ip_list);
	}

	public function validate($ip_list = array())
	{
		return Rhymix\Framework\Filters\IpFilter::validateRanges($ip_list);
	}

}

/* End of file : IpFilter.class.php */
/* Location: ./classes/security/IpFilter.class.php */

<?php
/* Copyright (C) NAVER <http://www.navercorp.com> */

class IpFilter
{
	public function filter($ip_list, $ip = NULL)
	{
		if(!$ip) $ip = \RX_CLIENT_IP;
		return Rhymix\Framework\Filters\IpFilter::inRanges($ip, $ip_list);
	}

	public function validate($ip_list = array())
	{
		return Rhymix\Framework\Filters\IpFilter::validateRanges($ip_list);
	}

}

/* End of file : IpFilter.class.php */
/* Location: ./classes/security/IpFilter.class.php */

Fix outdated use of REMOTE_ADDR instead of RX_CLIENT_IP


<?php
/**
 *
 * @param array &$hookinfo  hookinfo
 */
function consentSimpleAdmin_hook_sanitycheck(&$hookinfo) {
	assert('is_array($hookinfo)');
	assert('array_key_exists("errors", $hookinfo)');
	assert('array_key_exists("info", $hookinfo)');

	try {
		$consentconfig = SimpleSAML_Configuration::getConfig('module_consentSimpleAdmin.php');

		// Parse consent config
		$consent_storage = sspmod_consent_Store::parseStoreConfig($consentconfig->getValue('store'));

		// Get all consents for user
		$stats = $consent_storage->getStatistics();

		$hookinfo['info'][] = '[consentSimpleAdmin] Consent Storage connection OK.';

	} catch (Exception $e) {
		$hookinfo['errors'][] = '[consentSimpleAdmin] Error connecting to storage: ' . $e->getMessage();
	}

}
?>

<?php
/**
 *
 * @param array &$hookinfo  hookinfo
 */
function consentSimpleAdmin_hook_sanitycheck(&$hookinfo) {
	assert('is_array($hookinfo)');
	assert('array_key_exists("errors", $hookinfo)');
	assert('array_key_exists("info", $hookinfo)');

	try {
		$consentconfig = SimpleSAML_Configuration::getConfig('module_consentSimpleAdmin.php');

		// Parse consent config
		$consent_storage = sspmod_consent_Store::parseStoreConfig($consentconfig->getValue('store'));

		if (!is_callable(array($consent_storage, 'selftest'))) {
			/* Doesn't support a selftest. */
			return;
		}
		$testres = $consent_storage->selftest();
		if ($testres) {
			$hookinfo['info'][] = '[consentSimpleAdmin] Consent Storage selftest OK.';
		} else {
			$hookinfo['errors'][] = '[consentSimpleAdmin] Consent Storage selftest failed.';
		}

	} catch (Exception $e) {
		$hookinfo['errors'][] = '[consentSimpleAdmin] Error connecting to storage: ' . $e->getMessage();
	}

}
?>

consentSimpleAdmin: Use new selftest-function on database backend.


<?php

class SV_ConversationImprovements_XenForo_Route_Prefix_Conversations extends XFCP_SV_ConversationImprovements_XenForo_Route_Prefix_Conversations
{
    public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
    {
        if (isset($data['message_id']) &&
            !isset($extraParams['message_id']) &&
            ($action != 'message' ||
             $action == 'like' ||
             $action == 'message-history' ||
             $action == 'ip' ||
             $action == 'preview'
            ))
        {
            $extraParams['message_id'] = $data['message_id'];
        }
        return parent::buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, $extraParams);
    }
}

<?php

class SV_ConversationImprovements_XenForo_Route_Prefix_Conversations extends XFCP_SV_ConversationImprovements_XenForo_Route_Prefix_Conversations
{
    public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
    {
        if (isset($data['message_id']) &&
            !isset($extraParams['m']) &&
            !isset($extraParams['message_id']) &&
            ($action == 'message'))
        {
            $extraParams['message_id'] = $data['message_id'];
        }
        return parent::buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, $extraParams);
    }
}

Simplify buildLink for Edit History support


<?php

namespace Yajra\DataTables\Facades;

use Illuminate\Support\Facades\Facade;

class DataTables extends Facade
{
    /**
     * Get the registered name of the component.
     *
     * @return string
     */
    protected static function getFacadeAccessor()
    {
        return 'datatables';
    }
}

<?php

namespace Yajra\DataTables\Facades;

use Illuminate\Support\Facades\Facade;

/**
 * @mixin \Yajra\DataTables\Factory
 * @method eloquent($builder)
 * @method queryBuilder($builder)
 * @method collection($collection)
 */
class DataTables extends Facade
{
    /**
     * Get the registered name of the component.
     *
     * @return string
     */
    protected static function getFacadeAccessor()
    {
        return 'datatables';
    }
}

Add mixin and method annotation for better facade ide support.


<?php

namespace Pinq\Tests;

use Exception;
use PHPUnit_Framework_Test;

class Timer implements \PHPUnit_Framework_TestListener
{
    private static $log = [];

    public static function getLongRunningTests($amount)
    {
        arsort(Timer::$log);

        return array_slice(Timer::$log, 0, $amount);
    }

    public function endTest(\PHPUnit_Framework_Test $test, $length)
    {
        self::$log[get_class($test) . '::' . $test->getName()] = $length;
    }

    public function startTest(\PHPUnit_Framework_Test $test) {}
    public function addError(\PHPUnit_Framework_Test $test, \Exception $e, $time) {}
    public function addFailure(\PHPUnit_Framework_Test $test, \PHPUnit_Framework_AssertionFailedError $e, $time) {}
    public function addIncompleteTest(\PHPUnit_Framework_Test $test, \Exception $e, $time) {}
    public function addSkippedTest(\PHPUnit_Framework_Test $test, \Exception $e, $time) {}
    public function startTestSuite(\PHPUnit_Framework_TestSuite $suite) { }
    public function endTestSuite(\PHPUnit_Framework_TestSuite $suite) {}
    public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) {}
}

<?php

namespace Pinq\Tests;

use Exception;
use PHPUnit_Framework_Test;

class Timer implements \PHPUnit_Framework_TestListener
{
    private static $log = [];

    public static function getLongRunningTests($amount)
    {
        arsort(Timer::$log);

        return array_slice(Timer::$log, 0, $amount);
    }

    public function endTest(\PHPUnit_Framework_Test $test, $length)
    {
        self::$log[get_class($test) . '::' . $test->getName()] = $length;
    }

    public function startTest(\PHPUnit_Framework_Test $test) {}
    public function addWarning(PHPUnit_Framework_Test $test, \PHPUnit_Framework_Warning $e, $time) {}
    public function addError(\PHPUnit_Framework_Test $test, \Exception $e, $time) {}
    public function addFailure(\PHPUnit_Framework_Test $test, \PHPUnit_Framework_AssertionFailedError $e, $time) {}
    public function addIncompleteTest(\PHPUnit_Framework_Test $test, \Exception $e, $time) {}
    public function addSkippedTest(\PHPUnit_Framework_Test $test, \Exception $e, $time) {}
    public function startTestSuite(\PHPUnit_Framework_TestSuite $suite) { }
    public function endTestSuite(\PHPUnit_Framework_TestSuite $suite) {}
    public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) {}
}

Add missing test listener method

Add missing test listener method


<?php
namespace Dkplus\CsrfApiUnprotectionBundle;

use Dkplus\CsrfApiUnprotectionBundle\UnprotectionRule\UnprotectionRule;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\OptionsResolver\OptionsResolver;

final class CsrfDisablingExtension extends AbstractTypeExtension
{
    /** @var RequestStack */
    private $requests;

    /** @var UnprotectionRule */
    private $unprotectionRule;

    /**
     * @param RequestStack   $requests
     * @param UnprotectionRule $unprotectionRule
     */
    public function __construct(RequestStack $requests, UnprotectionRule $unprotectionRule)
    {
        $this->requests         = $requests;
        $this->unprotectionRule = $unprotectionRule;
    }

    public function getExtendedType()
    {
        return FormType::class;
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        if ($this->requests->getMasterRequest()
            && ! $this->unprotectionRule->matches($this->requests->getMasterRequest())
        ) {
            return;
        }

        $resolver->setDefaults(['csrf_protection' => false]);
    }
}

<?php
namespace Dkplus\CsrfApiUnprotectionBundle;

use Dkplus\CsrfApiUnprotectionBundle\UnprotectionRule\UnprotectionRule;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\OptionsResolver\OptionsResolver;

final class CsrfDisablingExtension extends AbstractTypeExtension
{
    /** @var RequestStack */
    private $requests;

    /** @var UnprotectionRule */
    private $unprotectionRule;

    public static function getExtendedTypes()
    {
        return [FormType::class];
    }

    /**
     * @param RequestStack   $requests
     * @param UnprotectionRule $unprotectionRule
     */
    public function __construct(RequestStack $requests, UnprotectionRule $unprotectionRule)
    {
        $this->requests         = $requests;
        $this->unprotectionRule = $unprotectionRule;
    }

    public function getExtendedType()
    {
        return FormType::class;
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        if ($this->requests->getMasterRequest()
            && ! $this->unprotectionRule->matches($this->requests->getMasterRequest())
        ) {
            return;
        }

        $resolver->setDefaults(['csrf_protection' => false]);
    }
}

Implement new static form extension methods

Necessary for Symfony 5.0


<?php
/**
 * @license MIT
 * Full license text in LICENSE file
 */

namespace Eadrax\Core\Tool;

interface Image
{
    /**
     * Resizes an image.
     *
     * Example:
     * $image->resize(100, 100);
     *
     * @param int $width  The width of the resized image in px
     * @param int $height The height of the resized image in px
     * @return void
     */
    public function resize($width, $height);
}

<?php
/**
 * @license MIT
 * Full license text in LICENSE file
 */

namespace Eadrax\Core\Tool;

interface Image
{
    /**
     * Resizes an image to a height in px, maintaining aspect ratio
     *
     * Example:
     * $image->thumbnail_image('path/to/file.png', 'path/to/thumbnail.png');
     *
     * @param string $load Path to the image file
     * @param string $save The path to save the thumbnail to
     * @return void
     */
    public function thumbnail_image($load, $save);

    /**
     * Thumbnails a video to a height in px, maintaining aspect ratio
     *
     * The thumbnail is automatically taken from the mid-point of the video
     *
     * Example:
     * $image->thumbnail_video('path/to/file.avi', 'path/to/thumbnail.png');
     *
     * @param string $load Path to the video file
     * @param string $save The path to save the thumbnail to
     * @return void
     */
    public function thumbnail_video($load, $save);

    /**
     * Thumbnails a sound to a height in px, maintaining aspect ratio
     *
     * The thumbnail is essentially a sound wave.
     *
     * Example:
     * $image->thumbnail_sound('path/to/file.avi', 'path/to/thumbnail.png');
     *
     * @param string $load Path to the sound file
     * @param string $save The path to save the thumbnail to
     * @return void
     */
    public function thumbnail_sound($load, $save);

    /**
     * Screenshots a website, and generates a thumbnail of it
     *
     * Example:
     * $image->screenshot_website('http://foo.com', '/path/to/thumbnail.png');
     *
     * @param string $url The website to screenshot
     * @param string $save The path to save the thumbnail to
     * @return void
     */
    public function screenshot_website($url, $save);
}

Add more functionality into the image tool


        OD
        OpenDominion

            Toggle navigation

                @include('partials.notification-nav')
                @include('partials.staff-nav')
                @include('partials.auth-user-nav')

        OD
        OpenDominion

            Toggle navigation

                @include('partials.notification-nav')
                @include('partials.wiki-nav')
                @include('partials.staff-nav')
                @include('partials.auth-user-nav')

Add link to wiki in navbar in app layout


<?php

namespace Korobi\WebBundle\Repository;

use Doctrine\ODM\MongoDB\DocumentRepository;

class ChannelRepository extends DocumentRepository {

    /**
     * @param $network
     * @return mixed
     */
    public function findAllByNetwork($network) {
        return $this->createQueryBuilder()
            ->sort('channel', 'ASC')
            ->field('network')
                ->equals($network)
            ->getQuery()
            ->execute();
    }

    /**
     * @param $network
     * @param $channel
     * @return mixed
     */
    public function findByChannel($network, $channel) {
        return $this->createQueryBuilder()
            ->sort('channel', 'ASC')
            ->field('network')
                ->equals($network)
            ->field('channel')
                ->equals(new \MongoRegex('/^' . $channel . '/i'))
            ->getQuery()
            ->execute();
    }

    /**
     * @param int $limit Number of channels to grab.
     * @return array The public n last channels.
     */
    public function getRecentlyActiveChannels($limit) {
        return $this->createQueryBuilder()
            ->sort('last_activity', 'DESC')
            ->field('key')
            ->equals(null)
            ->limit($limit)
            ->getQuery()
            ->execute();
    }
}

<?php

namespace Korobi\WebBundle\Repository;

use Doctrine\ODM\MongoDB\DocumentRepository;

class ChannelRepository extends DocumentRepository {

    /**
     * @param $network
     * @return mixed
     */
    public function findAllByNetwork($network) {
        return $this->createQueryBuilder()
            ->sort('channel', 'ASC')
            ->field('network')
                ->equals($network)
            ->getQuery()
            ->execute();
    }

    /**
     * @param $network
     * @param $channel
     * @return mixed
     */
    public function findByChannel($network, $channel) {
        return $this->createQueryBuilder()
            ->sort('channel', 'ASC')
            ->field('network')
                ->equals($network)
            ->field('channel')
                ->equals(new \MongoRegex('/^' . $channel . '/i'))
            ->getQuery()
            ->execute();
    }

    /**
     * Looks for messages, actions etc (valid content only).
     *
     * @param int $limit Number of channels to grab.
     * @return array The public n last channels.
     */
    public function getRecentlyActiveChannels($limit) {
        return $this->createQueryBuilder()
            ->sort('last_valid_content_at', 'DESC')
            ->field('key')
            ->equals(null)
            ->limit($limit)
            ->getQuery()
            ->execute();
    }
}

Use new field in repo

Use new field in repo


<?php

namespace meysampg\formbuilder;

use yii\web\AssetBundle;
use yii\base\InvalidConfigException;

class FormBuilderAsset extends AssetBundle
{
    public $sourcePath = '@vendor/meysampg/yii2-formbuilder/dist';

    public function init()
    {
        // Add css file based on app environment
        $this->css[] = YII_DEBUG ? 'form-builder.css' : 'form-builder.min.css';

        // Add js file based on app environment
        $this->js[] = YII_DEBUG ? 'form-builder.js' : 'form-builder.min.js';
        $this->js[] = YII_DEBUG ? 'form-render.js' : 'form-render.min.js';
    }

    public $depends = [
        'yii\jui\JuiAsset',
    ];
}

<?php

namespace meysampg\formbuilder;

use yii\web\AssetBundle;
use yii\base\InvalidConfigException;

class FormBuilderAsset extends AssetBundle
{
    public $sourcePath = '@vendor/meysampg/yii2-formbuilder/dist';

    public function init()
    {
        // Add js file based on app environment
        $this->js[] = YII_DEBUG ? 'form-builder.js' : 'form-builder.min.js';
        $this->js[] = YII_DEBUG ? 'form-render.js' : 'form-render.min.js';
    }

    public $depends = [
        'yii\jui\JuiAsset',
    ];
}

Remove css file respect to js version of plugin


<?php
namespace Systemblast\Engine\Http;

class Request
{
    private static $instance = null;

    public static function make()
    {
        // Check if instance is already exists
        if (self::$instance == null) {
            self::$instance = (new Request())->create();
        }
        return self::$instance;
    }

    protected function create()
    {
        /**
         * to get the same $_SERVER['REQUEST_URI'] on both localhost and live server
         */
        if ($_SERVER['HTTP_HOST'] == 'localhost') {
            $url                    = preg_replace('#^https?://#', '', $_SERVER['APP_URL']);
            $url                    = str_replace($_SERVER['HTTP_HOST'], '', $url);
            $_SERVER['REQUEST_URI'] = str_replace($url, '', $_SERVER['REQUEST_URI']);
        }
        return \Zend\Diactoros\ServerRequestFactory::fromGlobals(
            $_SERVER, $_GET, $_POST, $_COOKIE, $_FILES
        );
    }

    private function __clone()
    {
        // Stopping Clonning of Object
    }

    private function __wakeup()
    {
        // Stopping unserialize of object
    }
}

<?php
namespace Systemblast\Engine\Http;

class Request
{
    private static $instance = null;

    public static function make()
    {
        // Check if instance is already exists
        if (self::$instance == null) {
            self::$instance = (new Request())->create();
        }
        return self::$instance;
    }

    protected function create()
    {
        /**
         * to get the same $_SERVER['REQUEST_URI'] on both localhost and live server
         */
        if (isset($_SERVER['HTTP_HOST']) && $_SERVER['HTTP_HOST'] == 'localhost') {
            $url                    = preg_replace('#^https?://#', '', $_SERVER['APP_URL']);
            $url                    = str_replace($_SERVER['HTTP_HOST'], '', $url);
            $_SERVER['REQUEST_URI'] = str_replace($url, '', $_SERVER['REQUEST_URI']);
        }
        return \Zend\Diactoros\ServerRequestFactory::fromGlobals(
            $_SERVER, $_GET, $_POST, $_COOKIE, $_FILES
        );
    }

    private function __clone()
    {
        // Stopping Clonning of Object
    }

    private function __wakeup()
    {
        // Stopping unserialize of object
    }
}

Make sure $_SERVER['HTTP_HOST'] is defined


<?php

namespace App;

use App\Appointment;
use App\Business;
use Carbon\Carbon;

class BookingStrategyDateslot implements BookingStrategyInterface
{
    public function makeReservation(Business $business, $data)
    {
        $data['issuer_id'] = \Auth::user()->id;
        $data['business_id'] = $business->id;
        $data['start_at'] = Carbon::parse($data['_date'] . ' 08:00 AM', $business->tz)->timezone('UTC')->toDateTimeString();
        $data['duration'] = 0;
        return new Appointment($data);
    }
}

<?php

namespace App;

use App\Appointment;
use App\Business;
use Carbon\Carbon;

class BookingStrategyDateslot implements BookingStrategyInterface
{
    public function makeReservation(Business $business, $data)
    {
        $data['issuer_id'] = \Auth::user()->id;
        $data['business_id'] = $business->id;
        $data['start_at'] = Carbon::parse($data['_date'] . $business->pref('start_at'), $business->tz)->timezone('UTC')->toDateTimeString();
        $data['duration'] = 0;
        return new Appointment($data);
    }
}

Remove time hardcode, get from pref()

Remove time hardcode, get from pref()


<?php
/**
 * User: Simon Libaud
 * Date: 12/03/2017
 * Email: simonlibaud@gmail.com.
 */
namespace Sil\RouteSecurityBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
 * Class Configuration.
 */
class Configuration implements ConfigurationInterface
{
    public function getConfigTreeBuilder()
    {
        $tree = new TreeBuilder('sil_route_security');
        // Keep compatibility with symfony/config < 4.2
        if (false === method_exists($tree, 'getRootNode')) {
            $root = $tree->root('sil_route_security');
        } else {
            $root = $tree->getRootNode();
        }

        $root
            ->children()
                ->booleanNode('enable_access_control')->defaultFalse()->end()
                ->scalarNode('secured_routes_format')->defaultNull()->end()
                ->scalarNode('ignored_routes_format')->defaultNull()->end()
                ->arrayNode('ignored_routes')->prototype('scalar')->end()->end()
                ->arrayNode('secured_routes')->prototype('scalar')->end()->end()
                ->scalarNode('naming_strategy')->defaultNull()->end()
        ;

        return $tree;
    }
}

<?php
/**
 * User: Simon Libaud
 * Date: 12/03/2017
 * Email: simonlibaud@gmail.com.
 */
namespace Sil\RouteSecurityBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
 * Class Configuration.
 */
class Configuration implements ConfigurationInterface
{
    public function getConfigTreeBuilder(): TreeBuilder
    {
        $tree = new TreeBuilder('sil_route_security');
        // Keep compatibility with symfony/config < 4.2
        if (false === method_exists($tree, 'getRootNode')) {
            $root = $tree->root('sil_route_security');
        } else {
            $root = $tree->getRootNode();
        }

        $root
            ->children()
                ->booleanNode('enable_access_control')->defaultFalse()->end()
                ->scalarNode('secured_routes_format')->defaultNull()->end()
                ->scalarNode('ignored_routes_format')->defaultNull()->end()
                ->arrayNode('ignored_routes')->prototype('scalar')->end()->end()
                ->arrayNode('secured_routes')->prototype('scalar')->end()->end()
                ->scalarNode('naming_strategy')->defaultNull()->end()
        ;

        return $tree;
    }
}

Add return type declaration (TreeBuilder)


<?php

/*
 * Copyright 2014 郷.
 *
 * 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.
 */

namespace Chigi\Bundle\ChijiBundle\Project;

use Chigi\Chiji\Project\SourceRoad;
use Chigi\Chiji\Project\UrlStampEnum;

/**
 * Description of RootRoad
 *
 * @author 郷
 */
class RootRoad extends SourceRoad {

    public $bundleName = "";

    protected function getReleaseFormatMap() {
        $map = parent::getReleaseFormatMap();
        $map['TWIG_CSS_LINK'] = '<link type="text/css" href="{{ asset("chiji/' . $this->bundleName . '/[FILE]") }}?[STAMP]" rel="stylesheet">';
        return $map;
    }

    protected function getUrlStampType() {
        return UrlStampEnum::TIME_HUMAN;
    }

}

<?php

/*
 * Copyright 2014 郷.
 *
 * 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.
 */

namespace Chigi\Bundle\ChijiBundle\Project;

use Chigi\Chiji\Project\SourceRoad;
use Chigi\Chiji\Project\UrlStampEnum;

/**
 * Description of RootRoad
 *
 * @author 郷
 */
class RootRoad extends SourceRoad {

    public $bundleName = "";

    protected function getReleaseFormatMap() {
        $map = parent::getReleaseFormatMap();
        $map['TWIG_CSS_LINK'] = '<link type="text/css" href="{{ asset("chiji/' . $this->bundleName . '/[FILE]") }}?[STAMP]" rel="stylesheet">';
        return $map;
    }

    protected function getUrlStampType() {
        return UrlStampEnum::HASH;
    }

}

MODIFY to use hash stamp.

MODIFY to use hash stamp.

Signed-off-by: Richard Lea <5e20e57f18b15612bae274c2aef7dc395ee6b2a1@zoho.com>


<?php namespace Codesleeve\AssetPipeline\Filters;

use Assetic\Asset\AssetInterface;
use Assetic\Filter\FilterInterface;

class JST extends FilterHelper implements FilterInterface
{
    public function __construct($basePath = '/app/assets/javascripts/')
    {
        $this->basePath = $basePath;
    }

    public function filterLoad(AssetInterface $asset)
    {
        // do nothing when asset is loaded
    }

    public function filterDump(AssetInterface $asset)
    {
        $relativePath = $this->getRelativePath($this->basePath, $asset->getSourceRoot() . '/');
        $filename =  pathinfo($asset->getSourcePath(), PATHINFO_FILENAME);

    	$content = str_replace('"', '\\"', $asset->getContent());
    	$content = str_replace(PHP_EOL, "", $content);

    	$jst = 'JST = (typeof JST === "undefined") ? JST = {} : JST;' . PHP_EOL;
    	$jst .= 'JST["' . $relativePath . $filename . '"] = "';
    	$jst .= $content;
    	$jst .= '";' . PHP_EOL;

		$asset->setContent($jst);
    }
}

<?php namespace Codesleeve\AssetPipeline\Filters;

use Assetic\Asset\AssetInterface;
use Assetic\Filter\FilterInterface;

class JST extends FilterHelper implements FilterInterface
{
    public function __construct($basePath = '/app/assets/javascripts/')
    {
        $this->basePath = $basePath;
    }

    public function filterLoad(AssetInterface $asset)
    {
        // do nothing when asset is loaded
    }

    public function filterDump(AssetInterface $asset)
    {
        $relativePath = $this->getRelativePath($this->basePath, $asset->getSourceRoot() . '/');
        $filename =  pathinfo($asset->getSourcePath(), PATHINFO_FILENAME);

    	$content = str_replace('"', '\\"', $asset->getContent());
        $content = preg_replace("/[\r?\n]+/", "", $content);

    	$jst = 'JST = (typeof JST === "undefined") ? JST = {} : JST;' . PHP_EOL;
    	$jst .= 'JST["' . $relativePath . $filename . '"] = "';
    	$jst .= $content;
    	$jst .= '";' . PHP_EOL;

		$asset->setContent($jst);
    }
}

Replace any kind of line break (LF, CRLF or CR) instead of relying on platform specific PHP_EOL


<?php
namespace ZfcUserList\Controller\Factory;

use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use ZfcUserList\Controller\UserListController;

class UserListController implements FactoryInterface
{
    public function createService(ServiceLocatorInterface $sm)
    {
        $parentLocator = $sm->getServiceLocator();

        $controller = new UserListController(
            $parentLocator->get("zfcuserlist_module_options"),
            $parentLocator->get("zfcuser_user_mapper")
        );
        return $controller;
    }
}

<?php
namespace ZfcUserList\Controller\Factory;

use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use ZfcUserList\Controller\UserListController as controller;
use Interop\Container\ContainerInterface;

class UserListController implements FactoryInterface
{
    public function createService(ServiceLocatorInterface $sm)
    {
        return $this->__invoke($sm, "UserListController");
    }

    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
    {
        $controller = new controller(
            $container->get("zfcuserlist_module_options"),
            $container->get("zfcuser_user_mapper")
        );
        return $controller;
    }
}

Fix for zf3 factory interface

Fix for zf3 factory interface


<?php

namespace App\Jobs;

use App\Jobs\Job;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Bus\SelfHandling;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\User;

class WeeklyMail extends Job implements SelfHandling, ShouldQueue
{
    use InteractsWithQueue, SerializesModels;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        for(User::where('unsubscribed_email', 'no') as $user){
            $this->dispatch( new SendEmail($user) );
        }
    }
}

<?php

namespace App\Jobs;

use App\Jobs\Job;
use App\Jobs\SendEmail;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Bus\SelfHandling;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\User;
use App\Event;

use Facebook\FacebookSession;
use Facebook\FacebookRequest;
use Facebook\GraphUser;
use Facebook\FacebookRequestException;
use Facebook\FacebookRedirectLoginHelper;

class WeeklyMail extends Job implements SelfHandling, ShouldQueue
{
    use InteractsWithQueue, SerializesModels;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        // Same time next week! :D
        $job = (new \App\Jobs\WeeklyMail())->delay(604800);
        $this->dispatch($job);

        // We'll just want to double-check our Facebook events still exist
        // before we email people about them...
        FacebookSession::setDefaultApplication( getenv('FB_ID'), getenv('FB_SECRET') );
        $session = FacebookSession::newAppSession();

        try {
          $session->validate();
        } catch (FacebookRequestException $ex) {
          // Session not valid, Graph API returned an exception with the reason.
          dd($ex);
        } catch (\Exception $ex) {
          // Graph API returned info, but it may mismatch the current app or have expired.
          dd($ex);
        }

        $all_events = Event::where( 'time', '>', date('Y-m-d H:i:s') )
                           ->where( 'time', '<', date('Y-m-d H:i:s', time()+604800) )
                           ->get();

        for($all_events as $event){
            $request = new FacebookRequest($session, 'GET', "/events/" . $event->facebook_id);

            try{
                $response = $request->execute();
            } catch(\Exception $ex) {
                // Facebook Exception looking up event; probably deleted, should mirror here.
                $event->delete();
            }
        }

        for(User::where('unsubscribed_email', 'no') as $user){
            $this->dispatch( new SendEmail($user) );
        }
    }
}

Check Facebook events before we start mailing


<?php namespace Lamosty\Lamosty_Dot_Com;
/**
 * @ Lamosty.com 2015
 */

class Config_Init {

	public function actions_init() {

		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
	}

	public function enqueue_scripts() {

	}

	public function enqueue_styles() {
		wp_enqueue_style( 'parent-theme-css', get_template_directory_uri() . '/style.css' );

         wp_register_style( 'ttfmake-main-style', get_stylesheet_directory_uri() . '/style.css',
             array(), '1.0.1' );
	}

}

<?php namespace Lamosty\Lamosty_Dot_Com;
/**
 * @ Lamosty.com 2015
 */

class Config_Init {

	public function actions_init() {

		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );

		add_filter( 'make_social_links', array( $this, 'make_social_links' ) );
	}

	public function enqueue_scripts() {

	}

	public function enqueue_styles() {
		wp_enqueue_style( 'parent-theme-css', get_template_directory_uri() . '/style.css' );

		wp_register_style( 'ttfmake-main-style', get_stylesheet_directory_uri() . '/style.css',
			array(), '1.0.1' );
	}

	public function make_social_links( $services_with_links ) {
		$services_with_links['github'] = array(
			'title' => 'GitHub',
			'url'   => 'https://github.com/lamosty',
			'class' => 'fa-github',
		);

		return $services_with_links;
	}

}

Add GitHub profile social link

Add GitHub profile social link


<?php
if (!array_key_exists('timeline-id', $options)) {
    return;
}
$timeline = get_record_by_id('NeatlineTimeTimeline',  $options['timeline-id']);
if (!$timeline) {
    return;
}
set_current_record('neatline_time_timeline', $timeline);
print_r($timeline->center_date);
// Need to pass through the center date here to make this work in exhibit builder
// echo $this->partial('timelines/_timeline.php', array('center_date' => metadata($neatline_time_timeline, 'center_date')));
echo $this->partial('timelines/_timeline.php');
?>

<?php
  if (!array_key_exists('timeline-id', $options)) {
      return;
  }
  $timeline = get_record_by_id('NeatlineTimeTimeline',  $options['timeline-id']);
  if (!$timeline) {
      return;
  }
  set_current_record('neatline_time_timeline', $timeline);
  echo $this->partial('timelines/_timeline.php', array('center_date' => metadata($timeline, 'center_date')));
?>

Set center date of timelines in an exhibit


<?php

/*
 * This file is part of the PHP CS utility.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Symfony\CS\Fixer;

use Symfony\CS\FixerInterface;

/**
 * @author Fabien Potencier <fabien@symfony.com>
 */
class IndentationFixer implements FixerInterface
{
    public function fix(\SplFileInfo $file, $content)
    {
        // [Structure] Indentation is done by steps of four spaces (tabs are never allowed)
        return preg_replace_callback('/^([ \t]+)/m', function ($matches) use ($content) {
            return str_replace("\t", '    ', $matches[0]);
        }, $content);
    }

    public function getLevel()
    {
        // defined in PSR2 ¶2.4
        return FixerInterface::PSR2_LEVEL;
    }

    public function getPriority()
    {
        return 0;
    }

    public function supports(\SplFileInfo $file)
    {
        return 'php' == $file->getExtension();
    }

    public function getName()
    {
        return 'indentation';
    }

    public function getDescription()
    {
        return 'Code must use 4 spaces for indenting, not tabs.';
    }
}

<?php

/*
 * This file is part of the PHP CS utility.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Symfony\CS\Fixer;

use Symfony\CS\FixerInterface;

/**
 * @author Fabien Potencier <fabien@symfony.com>
 */
class IndentationFixer implements FixerInterface
{
    public function fix(\SplFileInfo $file, $content)
    {
        // [Structure] Indentation is done by steps of four spaces (tabs are never allowed)
        return preg_replace_callback('/^([ \t]+)/m', function ($matches) use ($content) {
            return str_replace("\t", '    ', $matches[0]);
        }, $content);
    }

    public function getLevel()
    {
        // defined in PSR2 ¶2.4
        return FixerInterface::PSR2_LEVEL;
    }

    public function getPriority()
    {
        return 50;
    }

    public function supports(\SplFileInfo $file)
    {
        return 'php' == $file->getExtension();
    }

    public function getName()
    {
        return 'indentation';
    }

    public function getDescription()
    {
        return 'Code must use 4 spaces for indenting, not tabs.';
    }
}

Boost priority of the indentation fixer

Boost priority of the indentation fixer

Many other fixers have the assumption that this has been ran, so it should run early


<?php

namespace spec\PhpSpec\Wrapper\Subject;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

use PhpSpec\Formatter\Presenter\PresenterInterface;

class WrappedObjectSpec extends ObjectBehavior
{
    function let(PresenterInterface $presenter)
    {
        $this->beConstructedWith(null, $presenter);
    }

    function it_instantiates_object_using_classname()
    {
        $this->callOnWrappedObject('beAnInstanceOf', array('ArrayObject'));
        $this->instantiate()->shouldHaveType('ArrayObject');
    }

    function it_keeps_instantiated_object()
    {
        $this->callOnWrappedObject('beAnInstanceOf', array('ArrayObject'));
        $this->instantiate()->shouldBeEqualTo($this->getInstance());
    }

    function it_can_be_instantiated_with_a_factory_method()
    {
        $this->callOnWrappedObject(
            'beConstructedThrough',
            array(
                '\DateTime::createFromFormat',
                array('d-m-Y', '01-01-1970')
            )
        );
        $this->instantiate()->shouldHaveType('\DateTime');
    }

    function it_can_be_instantiated_with_a_factory_method_with_method_name_only()
    {
        $this->callOnWrappedObject('beAnInstanceOf', ['\DateTime']);
        $this->callOnWrappedObject(
            'beConstructedThrough',
            array(
                'createFromFormat',
                array('d-m-Y', '01-01-1970')
            )
        );
        $this->instantiate()->shouldHaveType('\DateTime');
    }
}

<?php

namespace spec\PhpSpec\Wrapper\Subject;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

use PhpSpec\Formatter\Presenter\PresenterInterface;

class WrappedObjectSpec extends ObjectBehavior
{
    function let(PresenterInterface $presenter)
    {
        $this->beConstructedWith(null, $presenter);
    }

    function it_instantiates_object_using_classname()
    {
        $this->callOnWrappedObject('beAnInstanceOf', array('ArrayObject'));
        $this->instantiate()->shouldHaveType('ArrayObject');
    }

    function it_keeps_instantiated_object()
    {
        $this->callOnWrappedObject('beAnInstanceOf', array('ArrayObject'));
        $this->instantiate()->shouldBeEqualTo($this->getInstance());
    }

    function it_can_be_instantiated_with_a_factory_method()
    {
        $this->callOnWrappedObject(
            'beConstructedThrough',
            array(
                '\DateTime::createFromFormat',
                array('d-m-Y', '01-01-1970')
            )
        );
        $this->instantiate()->shouldHaveType('\DateTime');
    }

    function it_can_be_instantiated_with_a_factory_method_with_method_name_only()
    {
        $this->callOnWrappedObject('beAnInstanceOf', array('\DateTime'));
        $this->callOnWrappedObject(
            'beConstructedThrough',
            array(
                'createFromFormat',
                array('d-m-Y', '01-01-1970')
            )
        );
        $this->instantiate()->shouldHaveType('\DateTime');
    }
}

Remove square bracket array syntax for 5.3 compatibility


<?php
class Vpc_Abstract_List_Form extends Vps_Form_NonTableForm
{
    public function __construct($name, $class)
    {
        parent::__construct($name, $class);
        $this->setProperty('class', $class);
        $this->add($this->_getMultiFields());
    }

    protected function _getMultiFields()
    {
        $multifields = new Vpc_Abstract_Field_MultiFields($this->getClass());
        $multifields->setReferences(array(
            'columns' => array('component_id'),
            'refColumns' => array('id')
        ));
        $multifields->setMinEntries(0);
        $multifields->fields->add(new Vps_Form_Field_Checkbox('visible', trlVps('Visible')));
        $multifields->setPosition(true);

        $form = Vpc_Abstract_Form::createChildComponentForm($this->getClass(), 'child');
        $form->setIdTemplate('{component_id}-{id}');
        $multifields->fields->add($form);

        return $multifields;
    }

}

<?php
class Vpc_Abstract_List_Form extends Vpc_Abstract_Form
{
    public function __construct($name, $class)
    {
        parent::__construct($name, $class);
        $this->setProperty('class', $class);
        $this->add($this->_getMultiFields());
    }

    protected function _getMultiFields()
    {
        $multifields = new Vps_Form_Field_MultiFields('Children');
        $multifields->setMinEntries(0);
        $multifields->fields->add(new Vps_Form_Field_Checkbox('visible', trlVps('Visible')));
        $multifields->setPosition(true);

        $form = Vpc_Abstract_Form::createChildComponentForm($this->getClass(), 'child');
        $form->setIdTemplate('{component_id}-{id}');
        $multifields->fields->add($form);

        return $multifields;
    }

}

Fix MultiFields admin mit unterkomponenten

statt NonTableForm Form mit OwnModel verwenden, das es ja jetzt gibt.
Macht alles viel einfacher.

problem war dass die list row _nach_ der child row gespeichert wurde und die
child row daher keine id hatte

(von niko)


<?php
namespace Scheb\TwoFactorBundle\Tests\Security\TwoFactor;

use Scheb\TwoFactorBundle\Security\TwoFactor\TrustedTokenGenerator;

class TrustedTokenGeneratorTest extends \PHPUnit_Framework_TestCase
{

    /**
     * @test
     */
    public function generateToken_useSecureRandom_validToken()
    {
        $generator = new TestableTrustedTokenGenerator();
        $generator->useSecureRandom = true; //Use SecureRandom
        $token = $generator->generateToken(20);
        $this->assertEquals(20, strlen($token));
    }

    /**
     * @test
     */
    public function generateToken_useFallback_validToken()
    {
        $generator = new TestableTrustedTokenGenerator();
        $generator->useSecureRandom = false; //Use fallback
        $token = $generator->generateToken(20);
        $this->assertEquals(20, strlen($token));
        $this->assertRegExp("/^A+$/", $token);
    }

}

/**
 * Makes the TrustedTokenGenerator more testable
 */
class TestableTrustedTokenGenerator extends TrustedTokenGenerator
{
    public $useSecureRandom = true; //Override generator selection

    protected $charspace = "A"; //Override charspace

    protected function useSecureRandom()
    {
        return $this->useSecureRandom;
    }

}

<?php
namespace Scheb\TwoFactorBundle\Tests\Security\TwoFactor;

use Scheb\TwoFactorBundle\Security\TwoFactor\TrustedTokenGenerator;

class TrustedTokenGeneratorTest extends \PHPUnit_Framework_TestCase
{

    /**
     * @test
     */
    public function generateToken_useSecureRandom_validToken()
    {
        $generator = new TrustedTokenGenerator(); //Use SecureRandom
        $token = $generator->generateToken(20);
        $this->assertEquals(20, strlen($token));
    }

    /**
     * @test
     */
    public function generateToken_useFallback_validToken()
    {
        $generator = new TestableTrustedTokenGenerator();
        $generator->useSecureRandom = false; //Use fallback
        $token = $generator->generateToken(20);
        $this->assertEquals(20, strlen($token));
        $this->assertRegExp("/^A+$/", $token);
    }

}

/**
 * Makes the TrustedTokenGenerator more testable
 */
class TestableTrustedTokenGenerator extends TrustedTokenGenerator
{
    public $useSecureRandom = true; //Override generator selection

    protected $charspace = "A"; //Override charspace

    protected function useSecureRandom()
    {
        return $this->useSecureRandom;
    }

}

Test coverage for useSecureRandom method


<?php

namespace Doctrine\Bundle\MongoDBBundle\Tests\Fixtures\Validator;

use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;

/** @ODM\Document(collection="DoctrineMongoDBBundle_Tests_Validator_Document") */
class Document
{
    /** @ODM\Id(strategy="none") */
    protected $id;

    /** @ODM\Field(type="string") */
    public $name;

    /** @ODM\Field(type="hash") */
    public $hash;

    /** @ODM\Collection */
    public $collection;

    /** @ODM\ReferenceOne(targetDocument="Doctrine\Bundle\MongoDBBundle\Tests\Fixtures\Validator\Document") */
    public $referenceOne;

    /** @ODM\EmbedOne(targetDocument="Doctrine\Bundle\MongoDBBundle\Tests\Fixtures\Validator\EmbeddedDocument") */
    public $embedOne;

    /** @ODM\EmbedMany(targetDocument="Doctrine\Bundle\MongoDBBundle\Tests\Fixtures\Validator\EmbeddedDocument") */
    public $embedMany = [];

    public function __construct($id) {
        $this->id = $id;
    }
}

/** @ODM\EmbeddedDocument */
class EmbeddedDocument
{
    /** @ODM\Field(type="string") */
    public $name;
}

<?php

namespace Doctrine\Bundle\MongoDBBundle\Tests\Fixtures\Validator;

use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;

/** @ODM\Document(collection="DoctrineMongoDBBundle_Tests_Validator_Document") */
class Document
{
    /** @ODM\Id(strategy="none") */
    protected $id;

    /** @ODM\Field(type="string") */
    public $name;

    /** @ODM\Field(type="hash") */
    public $hash;

    /** @ODM\Field(type="collection") */
    public $collection;

    /** @ODM\ReferenceOne(targetDocument="Doctrine\Bundle\MongoDBBundle\Tests\Fixtures\Validator\Document") */
    public $referenceOne;

    /** @ODM\EmbedOne(targetDocument="Doctrine\Bundle\MongoDBBundle\Tests\Fixtures\Validator\EmbeddedDocument") */
    public $embedOne;

    /** @ODM\EmbedMany(targetDocument="Doctrine\Bundle\MongoDBBundle\Tests\Fixtures\Validator\EmbeddedDocument") */
    public $embedMany = [];

    public function __construct($id) {
        $this->id = $id;
    }
}

/** @ODM\EmbeddedDocument */
class EmbeddedDocument
{
    /** @ODM\Field(type="string") */
    public $name;
}

Remove usage of deprecated Collection

Remove usage of deprecated Collection


<?php

namespace Phug\Formatter\Element;

use Phug\Formatter\AbstractElement;

class VariableElement extends AbstractElement
{
    /**
     * @var CodeElement
     */
    protected $variable;

    /**
     * @var ExpressionElement
     */
    protected $expression;

    public function __construct(CodeElement $variable = null, ExpressionElement $expression = null)
    {
        $variable && $this->setVariable($variable);
        $expression && $this->setExpression($expression);
    }

    public function setVariable(CodeElement $variable)
    {
        $this->variable = $variable;
    }

    public function setExpression(ExpressionElement $expression)
    {
        $this->expression = $expression;
    }

    public function getVariable()
    {
        return $this->variable;
    }

    public function getExpression()
    {
        return $this->expression;
    }
}

<?php

namespace Phug\Formatter\Element;

use Phug\Formatter\AbstractElement;
use Phug\Util\UnorderedArguments;

class VariableElement extends AbstractElement
{
    /**
     * @var CodeElement
     */
    protected $variable;

    /**
     * @var ExpressionElement
     */
    protected $expression;

    public function __construct()
    {
        $arguments = new UnorderedArguments(func_get_args());

        $variable = $arguments->optional(CodeElement::class);
        $expression = $arguments->optional(ExpressionElement::class);
        $parent = $arguments->optional(NodeInterface::class);
        $children = $arguments->optional('array');

        $arguments->noMoreDefinedArguments();

        if ($variable !== null) {
            $this->setVariable($variable);
        }

        if ($expression !== null) {
            $this->setExpression($expression);
        }

        parent::__construct($parent, $children);
    }

    public function setVariable(CodeElement $variable)
    {
        $this->variable = $variable;
    }

    public function setExpression(ExpressionElement $expression)
    {
        $this->expression = $expression;
    }

    public function getVariable()
    {
        return $this->variable;
    }

    public function getExpression()
    {
        return $this->expression;
    }
}

Fix variable element construct to match other AST


<?php
/**
 * @version     $Id$
 * @category	Nooku
 * @package     Nooku_Server
 * @subpackage  Categories
 * @copyright   Copyright (C) 2011 Timble CVBA and Contributors. (http://www.timble.net).
 * @license     GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link        http://www.nooku.org
 */

/**
 * Save Toolbar Button Class
 *
 * @author		John Bell <http://nooku.assembla.com/profile/johnbell>
 * @category	Nooku
 * @package     Nooku_Server
 * @subpackage  Categories
 */
class ComCategoriesToolbarButtonSave extends KToolbarButtonSave
{
    public function getOnClick()
    {
        $msg    = JText::_('Category must have a title');
        return 'var form =document.adminForm;'
            .'if(form.title.value != \'\'){'.parent::getOnClick().'} '
            .'else { alert(\''.$msg.'\'); return false; }';
    }

}

<?php
/**
 * @version     $Id$
 * @category	Nooku
 * @package     Nooku_Server
 * @subpackage  Categories
 * @copyright   Copyright (C) 2011 Timble CVBA and Contributors. (http://www.timble.net).
 * @license     GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link        http://www.nooku.org
 */

/**
 * Save Toolbar Button Class
 *
 * @author		John Bell <http://nooku.assembla.com/profile/johnbell>
 * @category	Nooku
 * @package     Nooku_Server
 * @subpackage  Categories
 */
class ComCategoriesToolbarButtonSave extends KToolbarButtonPost
{
    public function getOnClick()
    {
        $msg    = JText::_('Category must have a title');
        return 'var form =document.adminForm;'
            .'if(form.title.value != \'\'){'.parent::getOnClick().'} '
            .'else { alert(\''.$msg.'\'); return false; }';
    }

}

Save button needs to extend from KToolbarButtonPost


<?php

declare(strict_types=1);

namespace Tests\Stub;

class FatalErrorTestStub extends BrokenTestBase implements BrokenTestInterface
{
    public function testBrokenTest()
    {
        ini_set('memory_limit', '2M');

        $arr = [];

        while (true) {
            $arr[] = 'Allocated memory... allocated memory everywhere!';
        }
    }
}

<?php

declare(strict_types=1);

namespace Tests\Stub;

class FatalErrorTestStub extends BrokenTestBase implements BrokenTestInterface
{
    public function testBrokenTest(): void
    {
        $foo = new class() implements \Serializable {
        };

        $message = 'This assertion should not happen: ' . json_encode($foo);

        self::assertTrue(true, $message);
    }
}

Improve stub to avoid memory leak

Improve stub to avoid memory leak


<?php

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

class AddLastVisitToUsersTable extends Migration
{

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::table('users', function (Blueprint $table) {
			$table->timestamp('last_visit');
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::table('users', function (Blueprint $table) {
			$table->dropColumn('last_visit');
		});
	}

}

<?php

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

class AddLastVisitToUsersTable extends Migration
{

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::table('users', function (Blueprint $table) {
			$table->timestamp('last_visit')->nullable();
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::table('users', function (Blueprint $table) {
			$table->dropColumn('last_visit');
		});
	}

}

Fix for timestamps on MySQL

Fix for timestamps on MySQL