<?php
/**
 * Vainyl
 *
 * PHP Version 7
 *
 * @package   Core
 * @license   https://opensource.org/licenses/MIT MIT License
 * @link      https://vainyl.com
 */
declare(strict_types=1);

namespace Vainyl\Core\Renderer\Decorator;

use Vainyl\Core\AbstractIdentifiable;
use Vainyl\Core\IdentifiableInterface;
use Vainyl\Core\Renderer\RendererInterface;

/**
 * Class AbstractRendererDecorator
 *
 * @author Taras P. Girnyk <taras.p.gyrnik@gmail.com>
 */
abstract class AbstractRendererDecorator extends AbstractIdentifiable implements RendererInterface
{
    private $renderer;

    /**
     * AbstractRendererDecorator constructor.
     *
     * @param RendererInterface $renderer
     */
    public function __construct(RendererInterface $renderer)
    {
        $this->renderer = $renderer;
    }

    /**
     * @inheritDoc
     */
    public function getName(): string
    {
        return $this->renderer->getName();
    }

    /**
     * @inheritDoc
     */
    public function render(IdentifiableInterface $identifiable): array
    {
        return $this->renderer->render($identifiable);
    }
}

<?php
/**
 * Vainyl
 *
 * PHP Version 7
 *
 * @package   Core
 * @license   https://opensource.org/licenses/MIT MIT License
 * @link      https://vainyl.com
 */
declare(strict_types=1);

namespace Vainyl\Core\Renderer\Decorator;

use Vainyl\Core\AbstractIdentifiable;
use Vainyl\Core\IdentifiableInterface;
use Vainyl\Core\Renderer\RendererInterface;

/**
 * Class AbstractRendererDecorator
 *
 * @author Taras P. Girnyk <taras.p.gyrnik@gmail.com>
 */
abstract class AbstractRendererDecorator extends AbstractIdentifiable implements RendererInterface
{
    private $renderer;

    /**
     * AbstractRendererDecorator constructor.
     *
     * @param RendererInterface $renderer
     */
    public function __construct(RendererInterface $renderer)
    {
        $this->renderer = $renderer;
    }

    /**
     * @inheritDoc
     */
    public function render(IdentifiableInterface $identifiable): array
    {
        return $this->renderer->render($identifiable);
    }
}

:fire: Remove declaring non-interface public method


<?php
	require_once 'dbHandler.php';

	if(isset($_POST['action']) && !empty($_POST['action'])) {
		$dbHandler = new DatabaseHandler();
		$action = $_POST['action'];

	    switch($action) {
	        case 'addSitting' : addSitting($dbHandler);break;
	        case 'removeSitting' : removeSitting($dbHandler);break;
	    }
	    $dbHandler.disconnect();
	}

	function addSitting($dbHandler){
		if(isset($_POST['date']) && !empty($_POST['date'])) {
			$dbHandler->addSitting($_POST['date'], $_POST['preldate'], $_POST['paydate']);
		}
	}

	function removeSitting($dbHandler){
		if(isset($_POST['date']) && !empty($_POST['date'])) {
			$dbHandler->deleteSitting($_POST['date']);
		}
	}
?>

<?php
	require_once 'dbHandler.php';

	if(isset($_POST['action']) && !empty($_POST['action'])) {
		$dbHandler = new DatabaseHandler();
		$action = $_POST['action'];

	    switch($action) {
	        case 'addSitting' : addSitting($dbHandler);break;
	        case 'removeSitting' : removeSitting($dbHandler);break;
	    }
	    $dbHandler.disconnect();
	}

	function addSitting($dbHandler){
		if(isset($_POST['date']) && !empty($_POST['date'])) {
			$dbHandler->addSitting($_POST['date'], $_POST['preldate'], $_POST['paydate'], $_POST['resName']);
		}
	}

	function removeSitting($dbHandler){
		if(isset($_POST['date']) && !empty($_POST['date'])) {
			$dbHandler->deleteSitting($_POST['date']);
		}
	}
?>

Send the restaurant name when creating sitting


// navigation.php. part of orsee. see orsee.org.
//
// menu entry format:
//     0         1          2      3   4     5     6        7          8
// entrytype|menu__area|lang_item|url|icon|target|addp?|showonlyifp?|hideifp?

link|mainpage|mainpage|/public/index.php|||true

link|public_register|register|/public/participant_create.php|||||true

link|my_data|my_data|/public/participant_edit.php|||true|true
link|my_registrations|my_registrations|/public/participant_show.php|||true|true

//link|calendar|calendar|/public/show_calendar.php|||true

link|rules|rules|/public/rules.php|||true

link|privacy|privacy_policy|/public/privacy.php|||true

link|faqs|faqs|/public/faq.php|||true

//headlink|internet_exp|internet_experiments|/public/ie.php|||true||true

head|||
link||impressum|/public/directions.php
link|contact|contact|/public/contact.php|||true

link||login|/admin/admin_login.php

// navigation.php. part of orsee. see orsee.org.
//
// menu entry format:
//     0         1          2      3   4     5     6        7          8
// entrytype|menu__area|lang_item|url|icon|target|addp?|showonlyifp?|hideifp?

link|mainpage|mainpage|/public/index.php|||true

link|public_register|register|/public/participant_create.php|||||true

//Participant section
link|my_data|my_data|/public/participant_edit.php|||true|true
link|my_registrations|my_registrations|/public/participant_show.php|||true|true

//link|calendar|calendar|/public/show_calendar.php|||true

// Addp
link|rules|rules|/public/rules.php|||true

link|privacy|privacy_policy|/public/privacy.php|||true

link|faqs|faqs|/public/faq.php|||true

//headlink|internet_exp|internet_experiments|/public/ie.php|||true||true

head|||
link||impressum|/public/directions.php|||true
//link|contact|contact|/public/contact.php|||true

link||login|/admin/admin_login.php

Hide contact; section out nav

Hide contact; section out nav


<?php

/*
 * (c) Christian Gripp <mail@core23.de>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Core23\SetlistFm\Bridge\Symfony\Bundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

final class Core23SetlistFmBundle extends Bundle
{
    /**
     * {@inheritdoc}
     */
    protected function getContainerExtensionClass()
    {
        return 'Core23\SetlistFm\Bridge\Symfony\DependencyInjection\Core23SetlistFmExtension';
    }
}

<?php

/*
 * (c) Christian Gripp <mail@core23.de>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Core23\SetlistFm\Bridge\Symfony\Bundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;
use Core23\SetlistFm\Bridge\Symfony\DependencyInjection\Core23SetlistFmExtension;

final class Core23SetlistFmBundle extends Bundle
{
    /**
     * {@inheritdoc}
     */
    protected function getContainerExtensionClass()
    {
        return Core23SetlistFmExtension::class;
    }
}

Use new PHP features (::class, null coalescing)


<?php

namespace App\Http\Controllers;

use App;

use Illuminate\Http\Request;

use App\Http\Requests;

use App\Design;
use App\Designer;
use App\Place;
use App\Story;
use App\Support\Random;
use App\Tag;

class HomeController extends Controller
{

    /**
     * Home page.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $designers = Designer::orderByRaw('RAND(' . Random::getUserSeed() . ')')->get();
        return view('pages.home', [
            'designers' => $designers,
        ]);
    }

}

<?php

namespace App\Http\Controllers;

use App;

use Illuminate\Http\Request;

use App\Http\Requests;

use App\Design;
use App\Designer;
use App\Place;
use App\Story;
use App\Support\Random;
use App\Tag;

class HomeController extends Controller
{

    /**
     * Home page.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $designers = Designer::orderBy('editor_pick', 'desc')->orderByRaw('RAND(' . Random::getUserSeed() . ')')->paginate(30);
        return view('pages.home', [
            'designers' => $designers,
        ]);
    }

}

Sort designer list by editor's pick

Sort designer list by editor's pick


<?php
	add_action( 'wp_ajax_form_to_disk', 'form_to_disk' );
	add_action( 'wp_ajax_nopriv_form_to_disk', 'form_to_disk' );

	$f2d_option = get_option( 'f2d_options', '' );

	function form_to_disk() {

		global $f2d_option;
		date_default_timezone_set('America/Los_Angeles');

		if ( isset( $_POST[ 'marker' ] ) && 'sweepstakes' == $_POST[ 'marker' ] ) {
			$protected_dir = ABSPATH . trailingslashit( $f2d_option[ 'path' ] );
			$form_data	   = $_POST[ 'firstName' ] . ',';
			$form_data    .= $_POST[ 'lastName' ] . ',';
			$form_data    .= $_POST[ 'email' ];
			$entries       = fopen( $protected_dir . $f2d_option[ 'filename' ], 'a' )
				or die( 'Unable to process that request' );
			$txt           = date( 'Ymd' );
			$txt          .= ',';
			$txt          .= $form_data;
			fwrite( $entries, $txt . PHP_EOL );
			fclose( $entries );
			die();
		}
	}

<?php
	add_action( 'wp_ajax_form_to_disk', 'form_to_disk' );
	add_action( 'wp_ajax_nopriv_form_to_disk', 'form_to_disk' );

	$f2d_option = get_option( 'f2d_options', '' );

	function form_to_disk() {

		global $f2d_option;
		date_default_timezone_set('America/Los_Angeles');

		if ( isset( $_POST[ 'marker' ] ) && 'sweepstakes' == $_POST[ 'marker' ] ) {
			$protected_dir = ABSPATH . trailingslashit( $f2d_option[ 'path' ] );
			$form_data	   = trim( $_POST[ 'firstName' ] ) . ',';
			$form_data    .= trim( $_POST[ 'lastName' ] ) . ',';
			$form_data    .= trim( $_POST[ 'email' ] );
			$entries       = fopen( $protected_dir . $f2d_option[ 'filename' ], 'a' )
				or die( 'Unable to process that request' );
			$txt           = date( 'Ymd' );
			$txt          .= ',';
			$txt          .= $form_data;
			fwrite( $entries, $txt . PHP_EOL );
			fclose( $entries );
			die();
		}
	}

Trim whitespace from either side of name / email.


<?php

declare(strict_types=1);

namespace Kreait\Firebase\Tests\Integration\Auth;

use Kreait\Firebase\Auth;
use Kreait\Firebase\Auth\CustomTokenViaGoogleIam;
use Kreait\Firebase\Tests\IntegrationTestCase;
use Kreait\Firebase\Util\JSON;

/**
 * @internal
 */
class CustomTokenViaGoogleIamTest extends IntegrationTestCase
{
    /**
     * @var CustomTokenViaGoogleIam
     */
    private $generator;

    /**
     * @var Auth
     */
    private $auth;

    protected function setUp()
    {
        $this->generator = new CustomTokenViaGoogleIam(
            self::$serviceAccount->getClientEmail(),
            self::$factory->createApiClient()
        );

        $this->auth = self::$firebase->getAuth();
    }

    public function testCreateCustomToken()
    {
        $user = $this->auth->createUser([]);

        $idTokenResponse = $this->auth->getApiClient()->exchangeCustomTokenForIdAndRefreshToken(
            $this->generator->createCustomToken($user->uid, ['a-claim' => 'a-value'])
        );
        $idToken = JSON::decode($idTokenResponse->getBody()->getContents(), true)['idToken'];

        $verifiedToken = $this->auth->verifyIdToken($idToken);

        $this->assertTrue($verifiedToken->hasClaim('a-claim'));
        $this->assertSame('a-value', $verifiedToken->getClaim('a-claim'));

        $this->assertTrue($verifiedToken->hasClaim('user_id'));
        $this->assertSame($user->uid, $verifiedToken->getClaim('user_id'));

        $this->auth->deleteUser($user->uid);
    }
}

<?php

declare(strict_types=1);

namespace Kreait\Firebase\Tests\Integration\Auth;

use Kreait\Firebase\Auth\CustomTokenViaGoogleIam;
use Kreait\Firebase\Exception\AuthException;
use Kreait\Firebase\Tests\IntegrationTestCase;
use PHPUnit\Framework\AssertionFailedError;
use Throwable;

/**
 * @internal
 */
class CustomTokenViaGoogleIamTest extends IntegrationTestCase
{
    /**
     * @var CustomTokenViaGoogleIam
     */
    private $generator;

    protected function setUp()
    {
        $this->generator = new CustomTokenViaGoogleIam(
            self::$serviceAccount->getClientEmail(),
            self::$factory->createApiClient()
        );
    }

    public function testCreateCustomToken()
    {
        $this->generator->createCustomToken('some-uid', ['a-claim' => 'a-value']);
        $this->addToAssertionCount(1);
    }

    public function testCreateCustomTokenWithAnInvalidClientEmail()
    {
        $generator = new CustomTokenViaGoogleIam('user@domain.tld', self::$factory->createApiClient());

        try {
            $generator->createCustomToken('some-uid', ['kid' => '$&§']);
            $this->fail('An exception should have been thrown');
        } catch (AuthException $e) {
            $this->addToAssertionCount(1);
        } catch (AssertionFailedError $e) {
            $this->fail($e->getMessage());
        } catch (Throwable $e) {
            echo \get_class($e);
            $this->fail('An '.AuthException::class.' should have been thrown');
        }
    }
}

Simplify tests for custom tokens via IAM


<?php

class ClientTest extends PHPUnit_Framework_TestCase {
    protected $client;

    protected function setUp(){
        // Mock the notify function
        $this->client = $this->getMockBuilder('Bugsnag_Client')
                             ->setMethods(array('notify'))
                             ->setConstructorArgs(array('6015a72ff14038114c3d12623dfb018f'))
                             ->getMock();

        // Activate the Bugsnag handlers
        set_error_handler(array($this->client, "errorHandler"));
        set_exception_handler(array($this->client, "exceptionHandler"));
    }

    protected function tearDown() {
        // Remove the Bugsnag handlers
        restore_error_handler();
        restore_exception_handler();
    }

    public function testErrorHandler() {
        $this->client->expects($this->once())
                     ->method('notify');

        // Triggers a E_NOTICE, which should be handled by our errorHandler
        $foo = $bar;
    }

    public function testExceptionHandler() {
        $this->client->expects($this->once())
                     ->method('notify');

        $this->client->exceptionHandler(new Exception("Something broke"));
    }

    public function testManualErrorNotification() {
        $this->client->expects($this->once())
                     ->method('notify');

        $this->client->notifyError("SomeError", "Some message");
    }

    public function testManualExceptionNotification() {
        $this->client->expects($this->once())
                     ->method('notify');

        $this->client->notifyException(new Exception("Something broke"));
    }
}

?>

<?php

class ClientTest extends PHPUnit_Framework_TestCase {
    protected $client;

    protected function setUp(){
        // Mock the notify function
        $this->client = $this->getMockBuilder('Bugsnag_Client')
                             ->setMethods(array('notify'))
                             ->setConstructorArgs(array('6015a72ff14038114c3d12623dfb018f'))
                             ->getMock();

        // Activate the Bugsnag handlers
        set_error_handler(array($this->client, "errorHandler"));
        set_exception_handler(array($this->client, "exceptionHandler"));
    }

    protected function tearDown() {
        // Remove the Bugsnag handlers
        restore_error_handler();
        restore_exception_handler();
    }

    public function testErrorHandler() {
        $this->client->expects($this->once())
                     ->method('notify');

        $this->client->errorHandler(E_NOTICE, "Something broke", "somefile.php", 123);
    }

    public function testExceptionHandler() {
        $this->client->expects($this->once())
                     ->method('notify');

        $this->client->exceptionHandler(new Exception("Something broke"));
    }

    public function testManualErrorNotification() {
        $this->client->expects($this->once())
                     ->method('notify');

        $this->client->notifyError("SomeError", "Some message");
    }

    public function testManualExceptionNotification() {
        $this->client->expects($this->once())
                     ->method('notify');

        $this->client->notifyException(new Exception("Something broke"));
    }
}

?>

Update error handler test for php52

Update error handler test for php52


<?php

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::group(['middleware' => 'auth:api', 'namespace' => 'Api'], function () {
    Route::any('', 'HomeController@index');
    Route::get('user', 'UserController@index');
    Route::get('user/orgs', 'UserController@orgs');
    Route::get('org', 'HomeController@org');
    Route::get('org/{id?}', 'OrgController@index');
    Route::post('org/{id?}', 'OrgController@password');
    Route::put('org/{id?}', 'OrgController@update');
    Route::delete('org/{id?}', 'OrgController@delete');
    Route::post('join/{id?}', 'OrgController@join');
    Route::get('stats', 'HomeController@stats');
});

<?php

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::group(['middleware' => 'auth:api', 'namespace' => 'Api'], function () {
    Route::any('', 'HomeController@index');
    Route::get('user', 'UserController@index');
    Route::get('user/orgs', 'UserController@orgs');
    Route::get('org', 'HomeController@org');
    Route::get('org/{org?}', 'OrgController@index');
    Route::post('org/{org?}', 'OrgController@password');
    Route::put('org/{org?}', 'OrgController@update');
    Route::delete('org/{org?}', 'OrgController@delete');
    Route::post('join/{org?}', 'OrgController@join');
    Route::get('stats', 'HomeController@stats');
});

Apply refractor also in routes

:sparkles: Apply refractor also in routes


<?php
namespace app\controllers;

use app\models\Question;
use yii\filters\VerbFilter;

class QuestionController extends base\QuestionController
{
    /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return array_merge(parent::behaviors(), [
            'verbs' => [
                'class' => VerbFilter::className(),
                'actions' => [
                    'create-question' => ['POST'],
                ],
            ],
        ]);
    }

    public function actionNewQuestion()
    {
        return $this->render('new');
    }

    public function actionCreateQuestion()
    {
        $model = new Question();
        $model->content = \Yii::$app->request->getRawBody();
        $model->save();
    }

    public function actionUploadImage()
    {
        $filename = $_FILES['file']['name'];
        $destination = \Yii::getAlias('@webroot/upload/') . $filename;
        if(move_uploaded_file( $_FILES['file']['tmp_name'] , $destination )) {
            return \Yii::getAlias('@web/upload/') . $filename;
        } else
            return false;
    }
}

<?php
namespace app\controllers;

use app\models\Question;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;

class QuestionController extends base\QuestionController
{
    /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return array_merge(parent::behaviors(), [
            'access' => [
                'class' => AccessControl::className(),
                'rules' => [
                    [
                        'allow' => true,
                        'actions' => ['index', 'view'],
                        'roles' => ['?'],
                    ],
                    [
                        'allow' => true,
                        'actions' => [
                            'create', 'update', 'delete', 'new-question', 'create-question', 'upload-image'
                        ],
                        'roles' => ['@'],
                    ],
                ],
            ],
            'verbs' => [
                'class' => VerbFilter::className(),
                'actions' => [
                    'create-question' => ['POST'],
                ],
            ],
        ]);
    }

    public function actionNewQuestion()
    {
        return $this->render('new');
    }

    public function actionCreateQuestion()
    {
        $model = new Question();
        $model->content = \Yii::$app->request->getRawBody();
        $model->save();
    }

    public function actionUploadImage()
    {
        $filename = $_FILES['file']['name'];
        $destination = \Yii::getAlias('@webroot/upload/') . $filename;
        if(move_uploaded_file( $_FILES['file']['tmp_name'] , $destination )) {
            return \Yii::getAlias('@web/upload/') . $filename;
        } else
            return false;
    }
}

Add access behavior for question controller :watch:


<?php
/**
 * Redirect class
 *
 * @package NamelessMC\Core
 * @author Samerton
 * @author computerwizjared
 * @version 2.0.0-pr8
 * @license MIT
 */
class Redirect {

    /**
     * Redirect the user to the specified location.
     *
     * @param string $location Path or URL to redirect to
     * @return never
     */
    public static function to(string $location): void {
        // `attribute data-cfasync="false"` fixes Cloudflare caching issues
        echo '<script data-cfasync="false">window.location.replace("' . str_replace('&', '&', htmlspecialchars($location)) . '");</script>';
        die();
    }
}

<?php
/**
 * Redirect class
 *
 * @package NamelessMC\Core
 * @author Samerton
 * @author computerwizjared
 * @version 2.0.0-pr8
 * @license MIT
 */
class Redirect {

    /**
     * Redirect the user to the specified location.
     *
     * @param string $location Path or URL to redirect to
     * @return never
     */
    public static function to(string $location): void {
        if (!headers_sent()) {
            header("Location: $location");
        } else {
            // `attribute data-cfasync="false"` fixes Cloudflare caching issues
            echo '<script data-cfasync="false">window.location.replace("' . Output::getClean($location) . '");</script>';
        }
        die();
    }
}

Use header redirection when possible

Use header redirection when possible


<?php

namespace AppBundle\ConsolidateUsedFiles;

use Helper\FileSystem;
use Helper\NullStyle;
use Symfony\Component\Console\Style\StyleInterface;

/**
 * Consolidate the list of used files by removing duplicates and sorting them. Improves performance for later tasks.
 */
final class Task
{
    /**
     * @param string $userProvidedPathToConsolidate
     * @param StyleInterface|null $ioStyle
     */
    public function consolidate($userProvidedPathToConsolidate, StyleInterface $ioStyle = null)
    {
        $ioStyle = $ioStyle ?: new NullStyle();
        $ioStyle->progressStart(4);

        $pathToConsolidate = FileSystem::getRealPathToReadableAndWritableFile($userProvidedPathToConsolidate);
        if ($pathToConsolidate === null) {
            $message = $userProvidedPathToConsolidate . ' has to be a file both readable and writable.';
            $ioStyle->error($message);
            throw new \InvalidArgumentException($message);
        }
        $ioStyle->progressAdvance();

        $usedFiles = FileSystem::readFileIntoArray($pathToConsolidate);
        $ioStyle->progressAdvance();

        $usedFiles = array_unique($usedFiles);
        sort($usedFiles);
        $ioStyle->progressAdvance();

        FileSystem::writeArrayToFile($usedFiles, $pathToConsolidate);
        $ioStyle->progressFinish();

        $ioStyle->success('Finished consolidating ' . $pathToConsolidate);
    }
}

<?php

namespace AppBundle\ConsolidateUsedFiles;

use Helper\FileSystem;
use Helper\NullStyle;
use Symfony\Component\Console\Style\StyleInterface;

/**
 * Consolidate the list of used files by removing duplicates and sorting them. Improves performance for later tasks.
 */
final class Task
{
    /**
     * @param string $userProvidedPathToConsolidate
     * @param StyleInterface|null $ioStyle
     */
    public function consolidate($userProvidedPathToConsolidate, StyleInterface $ioStyle = null)
    {
        $ioStyle = $ioStyle ?: new NullStyle();

        $pathToConsolidate = FileSystem::getRealPathToReadableAndWritableFile($userProvidedPathToConsolidate);
        if ($pathToConsolidate === null) {
            $message = $userProvidedPathToConsolidate . ' has to be a file both readable and writable.';
            $ioStyle->error($message);
            throw new \InvalidArgumentException($message);
        }

        $usedFiles = FileSystem::readFileIntoArray($pathToConsolidate);
        $usedFiles = array_unique($usedFiles);
        sort($usedFiles);
        FileSystem::writeArrayToFile($usedFiles, $pathToConsolidate);

        $ioStyle->success('Finished consolidating ' . $pathToConsolidate);
    }
}

Remove progress bar from fast running command


<?php
/* @var $addedByUser \Sil\DevPortal\models\User */
/* @var $api \Sil\DevPortal\models\Api */
?>

A new API has been added to the API Developer Portal.

<?php echo sprintf(
    '%s%s added an API named "%s". Click here for more '
    . 'information.',
    CHtml::encode($addedByUser ? $addedByUser->display_name : 'Someone'),
    ($addedByUser ? ' (' . $addedByUser->email . ')' : ''),
    CHtml::encode($api->display_name),
    \Yii::app()->createAbsoluteUrl('/api/details/', array(
        'code' => $api->code,
    ))
); ?>

    API Added <?php echo date(Yii::app()->params['friendlyDateFormat']); ?>

<?php
/* @var $addedByUser \Sil\DevPortal\models\User */
/* @var $api \Sil\DevPortal\models\Api */
?>

A new API has been added to the API Developer Portal.

<?= sprintf(
    '%s%s added an API named "%s" (%s). Click here for more '
    . 'information.',
    CHtml::encode($addedByUser ? $addedByUser->display_name : 'Someone'),
    CHtml::encode($addedByUser ? ' (' . $addedByUser->email . ')' : ''),
    CHtml::encode($api->display_name),
    CHtml::encode($api->getInternalApiEndpoint()),
    \Yii::app()->createAbsoluteUrl('/api/details/', array(
        'code' => $api->code,
    ))
); ?>

    API Added <?php echo date(Yii::app()->params['friendlyDateFormat']); ?>

Include API internal endpoint in notification email to super admins.


<?php namespace ImguBox\Providers;

use Illuminate\Routing\Router;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;

class RouteServiceProvider extends ServiceProvider
{
    /**
     * This namespace is applied to the controller routes in your routes file.
     *
     * In addition, it is set as the URL generator's root namespace.
     *
     * @var string
     */
    protected $namespace = 'ImguBox\Http\Controllers';

    /**
     * Define your route model bindings, pattern filters, etc.
     *
     * @param  \Illuminate\Routing\Router  $router
     * @return void
     */
    public function boot(Router $router)
    {
        //

        parent::boot($router);
    }

    /**
     * Define the routes for the application.
     *
     * @param  \Illuminate\Routing\Router  $router
     * @return void
     */
    public function map(Router $router)
    {
        $router->group(['namespace' => $this->namespace], function ($router) {
            require app_path('Http/routes.php');
        });
    }
}

<?php namespace ImguBox\Providers;

use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Routing\Router;
use ImguBox\Log;

class RouteServiceProvider extends ServiceProvider
{
    /**
     * This namespace is applied to the controller routes in your routes file.
     *
     * In addition, it is set as the URL generator's root namespace.
     *
     * @var string
     */
    protected $namespace = 'ImguBox\Http\Controllers';

    /**
     * Define your route model bindings, pattern filters, etc.
     *
     * @param  \Illuminate\Routing\Router  $router
     * @return void
     */
    public function boot(Router $router)
    {
        $router->model('logs', Log::class);

        parent::boot($router);
    }

    /**
     * Define the routes for the application.
     *
     * @param  \Illuminate\Routing\Router  $router
     * @return void
     */
    public function map(Router $router)
    {
        $router->group(['namespace' => $this->namespace], function ($router) {
            require app_path('Http/routes.php');
        });
    }
}

Add Route Model Binding for "logs"

Add Route Model Binding for "logs"


<?php

namespace Redking\ParseBundle\Bridge\FOSUser;

use FOS\UserBundle\Mailer\TwigSwiftMailer as BaseMailer;

use FOS\UserBundle\Model\UserInterface;

class Mailer extends BaseMailer
{
    /**
     * {@inheritdoc}
     */
    public function sendResettingEmailMessage(UserInterface $user, $route = 'fos_user_resetting_reset')
    {
        $template = $this->parameters['template']['resetting'];
        $url = $this->router->generate($route, array('token' => $user->getConfirmationToken()), true);
        $context = array(
            'user' => $user,
            'confirmationUrl' => $url
        );
        $this->sendMessage($template, $context, $this->parameters['from_email']['resetting'], $user->getEmail());
    }
}

<?php

namespace Redking\ParseBundle\Bridge\FOSUser;

use FOS\UserBundle\Mailer\TwigSwiftMailer as BaseMailer;
use FOS\UserBundle\Model\UserInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

class Mailer extends BaseMailer
{
    /**
     * {@inheritdoc}
     */
    public function sendResettingEmailMessage(UserInterface $user, $route = 'fos_user_resetting_reset')
    {
        $template = $this->parameters['template']['resetting'];
        $url = $this->router->generate($route, array('token' => $user->getConfirmationToken()), UrlGeneratorInterface::ABSOLUTE_URL);
        $context = array(
            'user' => $user,
            'confirmationUrl' => $url
        );
        $this->sendMessage($template, $context, $this->parameters['from_email']['resetting'], $user->getEmail());
    }
}

Fix fos user mailer generated route to be absolute


<?php

namespace HMS\Behat\Context;

trait DatabaseMigrations
{

    /**
     * Migrate the database
     *
     * @BeforeScenario
     */
    public static function migrate()
    {
        \Artisan::call('migrate');
    }

    /**
     *
     * Roll it back after the scenario.
     *
     * @AfterScenario
     */
    public static function refresh()
    {
        \Artisan::call('migrate:rollback');
    }

}

<?php

namespace HMS\Behat\Context;

/**
 * This trait is pulled into Behat testing contexts to carry out some automated
 * operations when carrying out testing scenarios. The annotations BeforeScenario
 * and AfterScenario cause these methods to be called before and after each and
 * every testing scenario.
 *
 * In this case the methods ensure that the database is cleared and re-migrated
 * (and seeded) for every test. This means that each test can rely on the system
 * being consistant.
 *
 * As you can appreciate this means you want to be running a testing specific
 * database for your tests, which is what the .env.behat.yml file sets things up
 * to do.
 */
trait DatabaseMigrations
{

    /**
     * Migrate the database
     *
     * @BeforeScenario
     */
    public static function migrate()
    {
        \Artisan::call('migrate');
    }

    /**
     *
     * Roll it back after the scenario.
     *
     * @AfterScenario
     */
    public static function refresh()
    {
        \Artisan::call('migrate:rollback');
    }

}

Add some explanation to what is, in hindsight, a non-obvious file for a testing setup.


<?php
/*
 * This file is part of Account.
 *
 * (c) 2014 Nord Software
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace nord\yii\account\components\mailsender;

use Yii;

class YiiMailSender extends LocalMailSender
{
    /**
     * @inheritdoc
     */
    public function send(array $config = [])
    {
        return Yii::$app->mailer->compose()
            ->setTo($config['to'])
            ->setFrom($config['from'])
            ->setSubject($config['subject'])
            ->setTextBody($config['body'])
            ->send();
    }
}

<?php
/*
 * This file is part of Account.
 *
 * (c) 2014 Nord Software
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace nord\yii\account\components\mailsender;

use Yii;

class YiiMailSender extends LocalMailSender
{
    /**
     * @inheritdoc
     */
    public function send(array $config = [])
    {
        return Yii::$app->mailer->compose()
            ->setTo($config['to'])
            ->setFrom($config['from'])
            ->setSubject($config['subject'])
            ->setHtmlBody($config['body'])
            ->send();
    }
}

Fix templates of default Yii mail sender.


<?php

namespace App\Models;

class FindEvent extends Base
{
    public static $NODE_TYPE = 'E10';
    public static $NODE_NAME = 'findEvent';

    protected $has_unique_id = true;

    protected $related_models = [
        'P12' => [
            'key' => 'object',
            'model_name' => 'Object',
            'cascade_delete' => true
        ],
        'P7' => [
            'key' => 'findSpot',
            'model_name' => 'FindSpot',
            'cascade_delete' => true
        ],
        'P29' => [
            'key' => 'person',
            'model_name' => 'person',
            'cascade_delete' => false,
            'link_only' => true,
            'reverse_relationhip' => 'P29'
        ]
    ];

    protected $implicit_models = [
        [
            'relationship' => 'P4',
            'config' => [
                'key' => 'findDate',
                'name' => 'findPeriod',
                'value_node' => true,
                'cidoc_type' => 'E52'
            ]
        ],
    ];
}

<?php

namespace App\Models;

class FindEvent extends Base
{
    public static $NODE_TYPE = 'E10';
    public static $NODE_NAME = 'findEvent';

    protected $has_unique_id = true;

    protected $related_models = [
        'P12' => [
            'key' => 'object',
            'model_name' => 'Object',
            'cascade_delete' => true
        ],
        'P7' => [
            'key' => 'findSpot',
            'model_name' => 'FindSpot',
            'cascade_delete' => true
        ],
        'P29' => [
            'key' => 'person',
            'model_name' => 'person',
            'cascade_delete' => false,
            'link_only' => true,
            'reverse_relationhip' => 'P29'
        ]
    ];

    protected $implicit_models = [
        [
            'relationship' => 'P4',
            'config' => [
                'key' => 'findDate',
                'name' => 'findDate',
                'value_node' => true,
                'cidoc_type' => 'E52'
            ]
        ],
    ];
}

Use the same vocabulary to make a findDate as well as retrieving it


<?php
/**
 * Class Google\Site_Kit\Modules\Idea_Hub\Post_Idea_Topics
 *
 * @package   Google\Site_Kit\Modules\Idea_Hub
 * @copyright 2021 Google LLC
 * @license   https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
 * @link      https://sitekit.withgoogle.com
 */

namespace Google\Site_Kit\Modules\Idea_Hub;

use Google\Site_Kit\Core\Storage\Post_Meta_Setting;

/**
 * Class for Idea Hub topics setting.
 *
 * @since n.e.x.t
 * @access private
 * @ignore
 */
class Post_Idea_Topics extends Post_Meta_Setting {

	const META_KEY = 'googlesitekitpersistent_idea_topics';

	/**
	 * Gets the setting type.
	 *
	 * @since n.e.x.t
	 *
	 * @return string The array type.
	 */
	protected function get_type() {
		return 'array';
	}

	/**
	 * Returns a sanitize callback.
	 *
	 * @since n.e.x.t
	 *
	 * @return callable Sanitize callback function.
	 */
	protected function get_sanitize_callback() {
		return function ( $option ) {
			return $option;
		};
	}

}

<?php
/**
 * Class Google\Site_Kit\Modules\Idea_Hub\Post_Idea_Topics
 *
 * @package   Google\Site_Kit\Modules\Idea_Hub
 * @copyright 2021 Google LLC
 * @license   https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
 * @link      https://sitekit.withgoogle.com
 */

namespace Google\Site_Kit\Modules\Idea_Hub;

use Google\Site_Kit\Core\Storage\Post_Meta_Setting;

/**
 * Class for Idea Hub topics setting.
 *
 * @since n.e.x.t
 * @access private
 * @ignore
 */
class Post_Idea_Topics extends Post_Meta_Setting {

	const META_KEY = 'googlesitekitpersistent_idea_topics';

	/**
	 * Gets the setting type.
	 *
	 * @since n.e.x.t
	 *
	 * @return string The array type.
	 */
	protected function get_type() {
		return 'array';
	}

	/**
	 * Returns a sanitize callback.
	 *
	 * @since n.e.x.t
	 *
	 * @return callable Sanitize callback function.
	 */
	protected function get_sanitize_callback() {
		return function ( $option ) {
			$sanitized = array();
			if ( ! is_array( $option ) ) {
				return $sanitized;
			}

			foreach ( $option as $mid => $display_name ) {
				if ( is_string( $mid ) && is_string( $display_name ) ) {
					$sanitized[ sanitize_text_field( $mid ) ] = sanitize_text_field( $display_name );
				}
			}

			return $option;
		};
	}

}

Update sanitize callback for the topics setting.


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

namespace Darvin\AdminBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

/**
 * Menu compiler pass
 */
class MenuPass implements CompilerPassInterface
{
    const TAG_MENU_ITEM = 'darvin_admin.menu_item';

    /**
     * {@inheritdoc}
     */
    public function process(ContainerBuilder $container)
    {
        $menu = $container->getDefinition('darvin_admin.menu');

        $menuItems = $container->findTaggedServiceIds(self::TAG_MENU_ITEM);
        uasort($menuItems, function (array $a, array $b) {
            if ($a[0]['position'] === $b[0]['position']) {
                return 0;
            }

            return $a[0]['position'] > $b[0]['position'] ? 1 : -1;
        });

        foreach ($menuItems as $id => $attr) {
            $menu->addMethodCall('addItem', array(
                $attr[0]['group'],
                new Reference($id),
            ));
        }
    }
}

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

namespace Darvin\AdminBundle\DependencyInjection\Compiler;

use Darvin\Utils\DependencyInjection\TaggedServiceIdsSorter;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

/**
 * Menu compiler pass
 */
class MenuPass implements CompilerPassInterface
{
    const TAG_MENU_ITEM = 'darvin_admin.menu_item';

    /**
     * {@inheritdoc}
     */
    public function process(ContainerBuilder $container)
    {
        $menu = $container->getDefinition('darvin_admin.menu');

        $menuItems = $container->findTaggedServiceIds(self::TAG_MENU_ITEM);

        if (empty($menuItems)) {
            return;
        }

        $sorter = new TaggedServiceIdsSorter();
        $sorter->sort($menuItems);

        foreach ($menuItems as $id => $attr) {
            $menu->addMethodCall('addItem', array(
                $attr[0]['group'],
                new Reference($id),
            ));
        }
    }
}

Use tagged service IDs sorter to sort tagged services.


<?php

namespace Presentit\Laravel;

use Presentit\Present;
use Illuminate\Support\Collection;
use Illuminate\Support\ServiceProvider;
use Presentit\Transformer\TransformerFactoryInterface;

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

    /**
     * Boot the presentit service.
     *
     * @return void
     */
    public function boot()
    {
        $this->setPresentCollectionMacros();
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->app->singleton(TransformerFactoryInterface::class, function ($app) {
            return new TransformerFactory($app);
        });

        Present::setTransformerFactory($this->app[TransformerFactoryInterface::class]);
    }

    /**
     * Set presentit functionality to the base collection.
     */
    protected function setPresentCollectionMacros()
    {
        Collection::macro('present', function () {
            return Present::collection($this);
        });

        Collection::macro('transformWith', function ($transformer) {
            return $this->present()->with($transformer);
        });
    }

    /**
     * Get the services provided by the provider.
     *
     * @return array
     */
    public function provides()
    {
        return [
            TransformerFactoryInterface::class,
        ];
    }
}

<?php

namespace Presentit\Laravel;

use Presentit\Present;
use Illuminate\Support\Collection;
use Illuminate\Support\ServiceProvider;
use Presentit\Transformer\TransformerFactoryInterface;

class PresentitServiceProvider extends ServiceProvider
{
    /**
     * Boot the presentit service.
     *
     * @return void
     */
    public function boot()
    {
        $this->setPresentCollectionMacros();
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->app->singleton(TransformerFactoryInterface::class, function ($app) {
            return new TransformerFactory($app);
        });

        Present::setTransformerFactory($this->app[TransformerFactoryInterface::class]);
    }

    /**
     * Set presentit functionality to the base collection.
     */
    protected function setPresentCollectionMacros()
    {
        Collection::macro('present', function () {
            return Present::collection($this);
        });

        Collection::macro('transformWith', function ($transformer) {
            return $this->present()->with($transformer);
        });
    }
}

Set service provider defer to false

Set service provider defer to false


@extends('layouts.app')

@section('content')

Remember to pack everything

Go to my packing list

@stop

@extends('layouts.app')

@section('content')

Pack exactly what you need

            Have you ever gone on a trip and forgotten something important? Maybe
            you have the opposite problem and pack too much. The problem is that
            every time you pack for a trip, you have to start over from the
            beginning and remember what to bring. It's hard to remember what
            you packed last time, so you pack too little or too much.

            Fill My Suitcase is a packing list that you use every time you pack.
            If you forget something on this trip, add it to your list and you'll
            never forget it again. Did you take something and not use it? Take
            it off of your list and never pack it again.

Go to your packing list

@stop

Add some verbiage to the root page

Add some verbiage to the root page


<?php

namespace Lily\Test\Usage;

use Symfony\Component\DomCrawler\Crawler;

use Lily\Application\MiddlewareApplication;
use Lily\Application\RoutedApplication;

use Lily\Util\Request;
use Lily\Util\Response;

class DescribeTestingTest extends \PHPUnit_Framework_TestCase
{
    private function crawler($html)
    {
        return new Crawler($html);
    }

    private function applicationToTest()
    {
        $html = file_get_contents(dirname(__FILE__).'/example.html');
        return
            new MiddlewareApplication(
                [new RoutedApplication(
                    [['POST', '/form', $html]])]);
    }

    public function testFormShouldSuccessfullySubmit()
    {
        $application = $this->applicationToTest();
        $response = $application(Request::post('/form'));
        $crawler = $this->crawler($response['body']);
        $this->assertSame(1, $crawler->filter('h1.success')->count());
    }
}

<?php

namespace Lily\Test\Usage;

use Symfony\Component\DomCrawler\Crawler;

use Lily\Application\MiddlewareApplication;
use Lily\Application\RoutedApplication;

use Lily\Util\Request;
use Lily\Util\Response;

class DescribeTestingTest extends \PHPUnit_Framework_TestCase
{
    private function crawler($html)
    {
        return new Crawler($html);
    }

    private function applicationToTest()
    {
        $html = file_get_contents(dirname(__FILE__).'/example.html');
        return
            new MiddlewareApplication(
                [new RoutedApplication(
                    [['POST', '/form', $html]])]);
    }

    private function applicationResponse($request)
    {
        $application = $this->applicationToTest();
        return $application($request);
    }

    public function testFormShouldSuccessfullySubmit()
    {
        $response = $this->applicationResponse(Request::post('/form'));
        $crawler = $this->crawler($response['body']);
        $this->assertSame(1, $crawler->filter('h1.success')->count());
    }
}

Refactor some test logic out of test

Refactor some test logic out of test


<?php

namespace Admingenerator\GeneratorBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;

class UploadedFileType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('id', 'hidden');
    }

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

<?php

namespace Admingenerator\GeneratorBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;

class UploadedFileType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('name', 'hidden');
    }

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

Use name field instead of ID field.

Use name field instead of ID field.


<?php defined('BASEPATH') OR exit('No direct script access allowed');?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title><?php echo $content['title'] ; ?></title>
	<link rel="stylesheet" href="">
</head>
<body>
	<?php echo content('body') ; ?>
	<hr>
	<?php echo content('footer', 'Footer did not exists, this is the default footer text') ; ?>
</body>
</html>

<?php defined('BASEPATH') OR exit('No direct script access allowed');?>
<!DOCTYPE html>
<html>
<head>
	<title><?php echo content('title','Untitled') ; ?></title>
</head>
<body>
	<?php echo content('body', 'No Content') ; ?>
	<hr>
	<?php echo content('footer', 'If footer block is not provided, this is the default footer text') ; ?>
</body>
</html>

Fix template error in title

Fix template error in title


<?php

namespace Jgustavo99\Gerencianet\Tests;

use Jgustavo99\Gerencianet\Tests\AbstractTestCase;

class FacadeTest extends AbstractTestCase
{
    public function test_facade_instance () {
        $this->assertInstanceOf('Gerencianet\Gerencianet', app('Gerencianet'));
    }
}

<?php

namespace Jgustavo99\Gerencianet\Tests;

use Jgustavo99\Gerencianet\Facades\Gerencianet;
use Jgustavo99\Gerencianet\Tests\AbstractTestCase;

class FacadeTest extends AbstractTestCase
{
    public function test_container_instance () {
        $this->assertInstanceOf('Gerencianet\Gerencianet', app('Gerencianet'));
    }

    public function test_facade_instance () {
        $this->assertInstanceOf('Gerencianet\Gerencianet', app(\Jgustavo99\Gerencianet\Facades\Gerencianet::class)->getFacadeRoot());
    }
}

Test facade and container instance

Test facade and container instance


<?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\NodeBundle\Filter;

use Doctrine\ORM\Mapping\ClassMetaData;
use Doctrine\ORM\Query\Filter\SQLFilter;
use Symfony\Component\Security\Core\SecurityContext;

/**
 * @author Dries De Peuter <dries@nousefreak.be>
 */
class NodePublicationConfigurator
{
    protected $em;

    /**
     * @var SecurityContext
     */
    protected $securityContext;

    public function __construct($em, SecurityContext $securityContext)
    {
        $this->em              = $em;
        $this->securityContext = $securityContext;
    }

    public function onKernelRequest()
    {
        if (!$this->securityContext->getToken()) {
            return;
        }

        if ($this->securityContext->getToken()->getProviderKey() != 'backoffice') {
            return;
        }

        /** @var NodePublicationFilter $filter */
        $filter = $this->em->getFilters()->enable('node_publication_filter');
        $filter->setApplyPublication(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\NodeBundle\Filter;

use Doctrine\ORM\Mapping\ClassMetaData;
use Doctrine\ORM\Query\Filter\SQLFilter;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Security\Core\SecurityContext;

/**
 * @author Dries De Peuter <dries@nousefreak.be>
 */
class NodePublicationConfigurator
{
    protected $em;

    /**
     * @var SecurityContext
     */
    protected $securityContext;

    public function __construct($em, SecurityContext $securityContext)
    {
        $this->em              = $em;
        $this->securityContext = $securityContext;
    }

    public function onKernelRequest()
    {
        $token = $this->securityContext->getToken();
        if (!$token) {
            return;
        }

        if (!$token instanceof UsernamePasswordToken) {
            return;
        }

        if ($this->securityContext->getToken()->getProviderKey() != 'backoffice') {
            return;
        }

        /** @var NodePublicationFilter $filter */
        $filter = $this->em->getFilters()->enable('node_publication_filter');
        $filter->setApplyPublication(false);
    }
}

[Backoffice] Use safer checks to prevent unknown methods.


<?php
  $filename = $_POST['name'];
  $events   = stripslashes($_POST['events']);

  $file = fopen('logs/' . $filename . '.log.json', "w" );
  if($file == false) {
    echo "Error opening file";
    exit();
  }

  fwrite($file, $events);
  fclose($file);
?>

<?php
  $filename = str_replace(':', '-', $_POST['name']);
  $events   = stripslashes($_POST['events']);

  $file = fopen('logs/' . $filename . '.log.json', "w" );
  if($file == false) {
    echo "Error opening file";
    exit();
  }

  fwrite($file, $events);
  fclose($file);
?>

Replace colons in file name for linux compatibility


<?php
namespace Concrete\Package\CkeditorContent\Block\CkeditorContent;
use \Concrete\Core\Block\BlockController;
use Loader;
use Core;

class Controller extends BlockController {

	protected $btName = 'Content (CKEditor)';
	protected $btTable = 'btCKEditorContent';

	protected $btCacheBlockOutput = true;
	protected $btCacheBlockOutputOnPost = true;
	protected $btCacheBlockOutputForRegisteredUsers = false;

	protected $btSupportsInlineEdit = true;
	protected $btSupportsInlineAdd = true;

	public function getSearchableContent() {
		return $this->content;
	}

	public function getBlockTypeName()
	{
		return t($this->btName);
	}

	public function getBlockTypeDescription() {
		return t("A content block based on CKEditor");
	}

	public function save($args) {
 		parent::save($args);
	}

	public function add(){
		$this->requireAsset('ckeditor');
	}

	public function edit() {
		$this->requireAsset('ckeditor');
	}

}

<?php
namespace Concrete\Package\CkeditorContent\Block\CkeditorContent;
use \Concrete\Core\Block\BlockController;
use Loader;
use Core;

class Controller extends BlockController {

	protected $btName = 'Content (CKEditor)';
	protected $btTable = 'btCKEditorContent';

	protected $btCacheBlockOutput = true;
	protected $btCacheBlockOutputOnPost = true;
	protected $btCacheBlockOutputForRegisteredUsers = false;

	protected $btSupportsInlineEdit = true;
	protected $btSupportsInlineAdd = true;
	protected $btDefaultSet = 'basic';

	public function getSearchableContent() {
		return $this->content;
	}

	public function getBlockTypeName()
	{
		return t($this->btName);
	}

	public function getBlockTypeDescription() {
		return t("A content block based on CKEditor");
	}

	public function save($args) {
 		parent::save($args);
	}

	public function add(){
		$this->requireAsset('ckeditor');
	}

	public function edit() {
		$this->requireAsset('ckeditor');
	}

}

Set the default block set to basic

Set the default block set to basic


<?php

require_once "../vendor/autoload.php";

use BitWasp\Bitcoin\Script\ScriptFactory;
use BitWasp\Bitcoin\Transaction\Transaction;

$ec = \BitWasp\Bitcoin\Bitcoin::getEcAdapter();

$script = ScriptFactory::create()->op('OP_1')->op('OP_1')->op('OP_ADD')->op('OP_2')->op('OP_EQUALVERIFY')->getScript();

echo "Formed script: " . $script->getHex() . "\n";
print_r($script->getScriptParser()->parse());

$flags = new \BitWasp\Bitcoin\Flags(0);
$i = new \BitWasp\Bitcoin\Script\Interpreter\Interpreter($ec, new Transaction(), $flags);
$result = $i->setScript($script)->run();
echo "Script result: " . ($result ? 'true' : 'false') . "\n";

<?php

require_once "../vendor/autoload.php";

use BitWasp\Bitcoin\Script\ScriptFactory;
use BitWasp\Bitcoin\Transaction\Transaction;
use BitWasp\Bitcoin\Script\Script;

$ec = \BitWasp\Bitcoin\Bitcoin::getEcAdapter();

$scriptSig = ScriptFactory::create()->int(1)->int(1)->getScript();
$scriptPubKey = ScriptFactory::create()->op('OP_ADD')->int(2)->op('OP_EQUAL')->getScript();

echo "Formed script: " . $scriptSig->getHex() . " " . $scriptPubKey->getHex() . "\n";

$flags = new \BitWasp\Bitcoin\Flags(0);
$i = new \BitWasp\Bitcoin\Script\Interpreter\Interpreter($ec, new Transaction, $flags);

$result = $i->verify($scriptSig, $scriptPubKey, 0);
echo "Script result: " . ($result ? 'true' : 'false') . "\n";

Fix an example since run() visibility is now private


<?php

namespace Backend\Modules\Tags\Tests\Engine;

use Backend\Core\Engine\Model as BackendModel;
use Backend\Modules\Tags\Engine\Model as TagsModel;
use Common\WebTestCase;

final class ModelTest extends WebTestCase
{
    public function setUp(): void
    {
        parent::setUp();

        if (!defined('APPLICATION')) {
            define('APPLICATION', 'Backend');
        }

        $client = self::createClient();
        $this->loadFixtures($client);
    }

    public function testGetStartsWith(): void
    {

    }

    public function testExistsTag(): void
    {

    }

    public function testInsert(): void
    {

    }

    public function testDelete(): void
    {

    }

    public function testGetTags(): void
    {

    }

    public function testGet(): void
    {

    }

    public function testUpdate(): void
    {

    }

    public function testSaveTags(): void
    {

    }

    public function testGetAll(): void
    {

    }

    public function testGetUrl(): void
    {

    }

    public function testGetTagNames(): void
    {

    }

    public function testExists(): void
    {

    }
}

<?php

namespace Backend\Modules\Tags\Tests\Engine;

use Backend\Core\Engine\Model as BackendModel;
use Backend\Modules\Tags\Engine\Model as TagsModel;
use Common\WebTestCase;

final class ModelTest extends WebTestCase
{
    public function setUp(): void
    {
        parent::setUp();

        if (!defined('APPLICATION')) {
            define('APPLICATION', 'Backend');
        }

        $client = self::createClient();
        $this->loadFixtures($client);

        BackendModel::get('database')->execute(
            'INSERT INTO `modules_tags` (`module`, `tag_id`, `other_id`)
            VALUES
                (\'Pages\', 1, 1),
                (\'Pages\', 2, 2),
                (\'Pages\', 2, 3),
                (\'Pages\', 2, 404),
                (\'Pages\', 2, 405),
                (\'Pages\', 2, 406),
                (\'Faq\', 1, 1)'
        );
        BackendModel::get('database')->execute(
            'INSERT INTO `tags` (`id`, `language`, `tag`, `number`, `url`)
            VALUES
                (1, \'en\', \'test\', 1, \'test\'),
                (2, \'en\', \'most used\', 5, \'most-used\')'
        );
    }

    public function testGetStartsWith(): void
    {

    }

    public function testExistsTag(): void
    {

    }

    public function testInsert(): void
    {

    }

    public function testDelete(): void
    {

    }

    public function testGetTags(): void
    {

    }

    public function testGet(): void
    {

    }

    public function testUpdate(): void
    {

    }

    public function testSaveTags(): void
    {

    }

    public function testGetAll(): void
    {

    }

    public function testGetUrl(): void
    {

    }

    public function testGetTagNames(): void
    {

    }

    public function testExists(): void
    {

    }
}

Add test data for tags in the backend

Add test data for tags in the backend


<?php

namespace Bundle\DoctrineUserBundle\DependencyInjection;

use Symfony\Components\DependencyInjection\Extension\Extension;
use Symfony\Components\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Components\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Components\DependencyInjection\ContainerBuilder;

class DoctrineUserExtension extends Extension
{

    public function configLoad(array $config, ContainerBuilder $container)
    {
        $loader = new XmlFileLoader($container, __DIR__.'/../Resources/config');
        $loader->load('auth.xml');
        $loader->load('form.xml');
        $loader->load('templating.xml');

        if(!isset($config['db_driver'])) {
            throw new \InvalidConfigurationException('You must provide the auth.db_driver configuration');
        }
        if('orm' === $config['db_driver']) {
            $loader->load('orm.xml');
        }
        elseif('odm' === $config['db_driver']) {
            $loader->load('odm.xml');
        }
        else {
            throw new \InvalidConfigurationException(sprintf('The %s driver is not supported', $config['db_driver']));
        }
    }

    /**
     * Returns the base path for the XSD files.
     *
     * @return string The XSD base path
     */
    public function getXsdValidationBasePath()
    {
        return null;
    }

    public function getNamespace()
    {
        return 'http://www.symfony-project.org/schema/dic/symfony';
    }

    public function getAlias()
    {
        return 'doctrine_user';
    }
}

<?php

namespace Bundle\DoctrineUserBundle\DependencyInjection;

use Symfony\Components\DependencyInjection\Extension\Extension;
use Symfony\Components\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Components\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Components\DependencyInjection\ContainerBuilder;

class DoctrineUserExtension extends Extension
{

    public function configLoad(array $config, ContainerBuilder $container)
    {
        $loader = new XmlFileLoader($container, __DIR__.'/../Resources/config');
        $loader->load('auth.xml');
        $loader->load('form.xml');
        $loader->load('templating.xml');

        if(!isset($config['db_driver'])) {
            throw new \InvalidArgumentException('You must provide the doctrine_user.db_driver configuration');
        }
        if('orm' === $config['db_driver']) {
            $loader->load('orm.xml');
        }
        elseif('odm' === $config['db_driver']) {
            $loader->load('odm.xml');
        }
        else {
            throw new \InvalidArgumentException(sprintf('The %s driver is not supported', $config['db_driver']));
        }
    }

    /**
     * Returns the base path for the XSD files.
     *
     * @return string The XSD base path
     */
    public function getXsdValidationBasePath()
    {
        return null;
    }

    public function getNamespace()
    {
        return 'http://www.symfony-project.org/schema/dic/symfony';
    }

    public function getAlias()
    {
        return 'doctrine_user';
    }
}

Fix exceptions in dependency injection configuration


<?php
/**
 * event_ListAvailablemodelsService
 * @package modules.event.lib.services
 */
class event_ListAvailablemodelsService extends BaseService implements list_ListItemsService
{
	/**
	 * @var event_ListAvailablemodelsService
	 */
	private static $instance;

	/**
	 * @return event_ListAvailablemodelsService
	 */
	public static function getInstance()
	{
		if (self::$instance === null)
		{
			self::$instance = self::getServiceClassInstance(get_class());
		}
		return self::$instance;
	}

	/**
	 * @see list_persistentdocument_dynamiclist::getItems()
	 * @return list_Item[]
	 */
	public final function getItems()
	{
		$items = array();

		$ls = LocaleService::getInstance();
		$baseModel = f_persistentdocument_PersistentDocumentModel::getInstance('event', 'baseevent');
		foreach ($baseModel->getChildrenNames() as $modelName)
		{
			$model = f_persistentdocument_PersistentDocumentModel::getInstanceFromDocumentModelName($modelName);
			if ($model->getName() == $modelName)
			{
				$items[] = new list_Item($ls->transBO($model->getLabelKey(), array('ucf')), $modelName);
			}
		}

		return $items;
	}

	/**
	 * @var Array
	 */
	private $parameters = array();

	/**
	 * @see list_persistentdocument_dynamiclist::getListService()
	 * @param array $parameters
	 */
	public function setParameters($parameters)
	{
		$this->parameters = $parameters;
	}
}

<?php
/**
 * event_ListAvailablemodelsService
 * @package modules.event.lib.services
 */
class event_ListAvailablemodelsService extends BaseService implements list_ListItemsService
{
	/**
	 * @var event_ListAvailablemodelsService
	 */
	private static $instance;

	/**
	 * @return event_ListAvailablemodelsService
	 */
	public static function getInstance()
	{
		if (self::$instance === null)
		{
			self::$instance = self::getServiceClassInstance(get_class());
		}
		return self::$instance;
	}

	/**
	 * @see list_persistentdocument_dynamiclist::getItems()
	 * @return list_Item[]
	 */
	public function getItems()
	{
		$items = array();

		$ls = LocaleService::getInstance();
		$baseModel = f_persistentdocument_PersistentDocumentModel::getInstance('event', 'baseevent');
		foreach ($baseModel->getChildrenNames() as $modelName)
		{
			$model = f_persistentdocument_PersistentDocumentModel::getInstanceFromDocumentModelName($modelName);
			if ($model->getName() == $modelName)
			{
				$items[] = new list_Item($ls->transBO($model->getLabelKey(), array('ucf')), $modelName);
			}
		}

		return $items;
	}

	/**
	 * @var Array
	 */
	private $parameters = array();

	/**
	 * @see list_persistentdocument_dynamiclist::getListService()
	 * @param array $parameters
	 */
	public function setParameters($parameters)
	{
		$this->parameters = $parameters;
	}
}

[REFACTOR] Remove "final" keyword on getItems and getDefaultId methods in dynamic list services.


<?php

global $project;
$project = 'isu';

global $database;
$database = 'isuweb55';

// Set the site locale
i18n::set_locale('sk_SK');

require_once("conf/ConfigureFromEnv.php");

<?php

global $project;
$project = 'isu';

global $database;
$database = 'isuweb';

// Set the site locale
i18n::set_locale('sk_SK');

require_once("conf/ConfigureFromEnv.php");

Change db to MariaDB 5.5

Change db to MariaDB 5.5


<?php

namespace BenAllfree\Trackable\Models;

use Illuminate\Database\Eloquent\Model;

class Site extends Model
{
  protected $fillable = ['host'];

  function metas()
  {
    return $this->hasManyThrough(\ContactMeta::class, \Contact::class);
  }

  function currentMetas()
  {
    return $this->metas()->whereIsCurrent(true);
  }

  function contacts()
  {
    return $this->hasMany(\Contact::class);
  }

  function contactsWith($meta_key, $meta_value)
  {
    return $this->contacts()->whereMeta($meta_key, '=', $meta_value);
  }
}

<?php

namespace BenAllfree\Trackable\Models;

class Site extends \TrackableModelBase
{
  protected $fillable = ['host'];

  public function metas()
  {
    return $this->hasManyThrough(\ContactMeta::class, \Contact::class);
  }

  public function currentMetas()
  {
    return $this->metas()->whereIsCurrent(true);
  }

  public function contacts()
  {
    return $this->hasMany(\Contact::class);
  }

  public function contactsWith($meta_key, $meta_value)
  {
    return $this->contacts()->whereMeta($meta_key, '=', $meta_value);
  }
}

Use Alias so Model base class can be changed


<?php

namespace SimpleSAML\Test\Module\core\Auth;

use SimpleSAML\Module\core\Auth\UserPassOrgBase;

class UserPassOrgBaseTest extends \PHPUnit_Framework_TestCase
{
    public function testRememberOrganizationEnabled()
    {
        $config = array(
            'ldap:LDAPMulti',

            'remember.organization.enabled' => true,
            'remember.organization.checked' => false,

            'my-org' => array(
                'description' => 'My organization',
                // The rest of the options are the same as those available for
                // the LDAP authentication source.
                'hostname' => 'ldap://ldap.myorg.com',
                'dnpattern' => 'uid=%username%,ou=employees,dc=example,dc=org',
                // Whether SSL/TLS should be used when contacting the LDAP server.
                'enable_tls' => false,
            )
        );

        $mockUserPassOrgBase = $this->getMockBuilder(\SimpleSAML\Module\core\Auth\UserPassOrgBase::class)
            ->setConstructorArgs(array(array('AuthId' => 'my-org'), &$config))
            ->setMethods(array())
            ->getMockForAbstractClass();

        $this->assertTrue($mockUserPassOrgBase->getRememberOrganizationEnabled());
    }
}

<?php

namespace SimpleSAML\Test\Module\core\Auth;

use SimpleSAML\Module\core\Auth\UserPassOrgBase;

class UserPassOrgBaseTest extends \PHPUnit_Framework_TestCase
{
    public function testRememberOrganizationEnabled()
    {
        $config = array(
            'ldap:LDAPMulti',

            'remember.organization.enabled' => true,
            'remember.organization.checked' => false,

            'my-org' => array(
                'description' => 'My organization',
                // The rest of the options are the same as those available for
                // the LDAP authentication source.
                'hostname' => 'ldap://ldap.myorg.com',
                'dnpattern' => 'uid=%username%,ou=employees,dc=example,dc=org',
                // Whether SSL/TLS should be used when contacting the LDAP server.
                'enable_tls' => false,
            )
        );

        // When PHP 5.4 support is dropped, replace with:
        // $mockUserPassOrgBase = $this->getMockBuilder(\SimpleSAML\Module\core\Auth\UserPassOrgBase::class)
        $mockUserPassOrgBase = $this->getMockBuilder(get_parent_class(new \SimpleSAML\Module\ldap\Auth\Source\LDAPMulti(array('AuthId' => 'my-org'), array())))
            ->setConstructorArgs(array(array('AuthId' => 'my-org'), &$config))
            ->setMethods(array())
            ->getMockForAbstractClass();

        $this->assertTrue($mockUserPassOrgBase->getRememberOrganizationEnabled());
    }
}

Fix tests for PHP 5.4

Fix tests for PHP 5.4


<?php
include 'reports/db_queries.php';
echo ("You have sucessfully unsubscribed from OsmAnd's mailing list.");
insertIntoUnsubscribed(base64_decode( urldecode( $_GET["id"] ) ), $_GET["group"]);

?>

<?php
include 'reports/db_queries.php';
insertIntoUnsubscribed(base64_decode( urldecode( $_GET["id"] ) ), $_GET["group"]);

?>

You have sucessfully unsubscribed from OsmAnd's mailing list.

Add styling for Unsubscribe page

Add styling for Unsubscribe page


<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;

class Init extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'mangapie:init';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Initializes mangapie';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $this->comment('Generating app key...');
        // avoid generating a key if it already exists
        if (!config('app.key')) {
            Artisan::call('key:generate');
        } else {
            $this->comment('App key already exists. Skipping.');
        }

        $this->comment('Publishing vendor files...');
        Artisan::call('vendor:publish');

        $this->comment('Migrating...');
        Artisan::call('migrate', ['--force' => true]);

        $this->comment('Seeding database...');
        Artisan::call('db:seed', ['--force' => true]);

        $this->comment('Finished initializing mangapie.');
    }
}

<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;

class Init extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'mangapie:init';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Initializes mangapie';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $this->comment('Generating app key...');
        // avoid generating a key if it already exists
        if (!config('app.key')) {
            Artisan::call('key:generate');
        } else {
            $this->comment('App key already exists. Skipping.');
        }

        $this->comment('Publishing vendor files...');
        if (\File::exists('config/image.php') == false) {
            Artisan::call('vendor:publish', ['--provider' => 'Intervention\\Image\\ImageServiceProviderLaravel5']);
        } else {
            $this->comment('Config file for Intervention\\Image already exists. Skipping.');
        }

        $this->comment('Migrating...');
        Artisan::call('migrate', ['--force' => true]);

        $this->comment('Seeding database...');
        Artisan::call('db:seed', ['--force' => true]);

        $this->comment('Finished initializing mangapie.');
    }
}

Update init command to not hang.

Update init command to not hang.


<?php

namespace Construct\Constructors;

class LgtmFiles extends Constructor implements ConstructorContract
{
    /**
     * Generate LGTM configuration files.
     *
     * @return void
     */
    public function run()
    {
        if ($this->settings->withLgtmConfiguration()) {
            $this->filesystem->copy(
                __DIR__ . '/../stubs/MAINTAINERS.stub',
                $this->settings->getProjectLower() . '/' . 'MAINTAINERS'
            );

            $this->filesystem->copy(
                __DIR__ . '/../stubs/lgtm.stub',
                $this->getProjectLower() . '/' . '.lgtm'
            );

            $this->gitAttributes->addExportIgnore('MAINTAINERS');
            $this->gitAttributes->addExportIgnore('.lgtm');
        }
    }
}

<?php

namespace Construct\Constructors;

class LgtmFiles extends Constructor implements ConstructorContract
{
    /**
     * Generate LGTM configuration files.
     *
     * @return void
     */
    public function run()
    {
        if ($this->settings->withLgtmConfiguration()) {
            $this->filesystem->copy(
                __DIR__ . '/../stubs/MAINTAINERS.stub',
                $this->settings->getProjectLower() . '/' . 'MAINTAINERS'
            );

            $this->filesystem->copy(
                __DIR__ . '/../stubs/lgtm.stub',
                $this->settings->getProjectLower() . '/' . '.lgtm'
            );

            $this->gitAttributes->addExportIgnore('MAINTAINERS');
            $this->gitAttributes->addExportIgnore('.lgtm');
        }
    }
}

Use the settings object when getting the project name.


<?php

namespace Amp\Optimizer\Error;

/**
 * Default set of properties and methods to use for errors.
 *
 * @package Amp\Optimizer
 */
trait ErrorProperties
{

    /**
     * Instantiate an Error object.
     *
     * @param string $message Message for the error.
     */
    public function __construct($message)
    {
        $this->message = $message;
    }

    /**
     * Message of the error.
     *
     * @var string
     */
    protected $message;

    /**
     * Get the code of the error.
     *
     * @return string Code of the error.
     */
    public function getCode()
    {
        return basename(get_class($this));
    }

    /**
     * Get the message of the error.
     *
     * @return string Message of the error.
     */
    public function getMessage()
    {
        return $this->message;
    }
}

<?php

namespace Amp\Optimizer\Error;

/**
 * Default set of properties and methods to use for errors.
 *
 * @package Amp\Optimizer
 */
trait ErrorProperties
{

    /**
     * Instantiate an Error object.
     *
     * @param string $message Message for the error.
     */
    public function __construct($message)
    {
        $this->message = $message;
    }

    /**
     * Message of the error.
     *
     * @var string
     */
    protected $message;

    /**
     * Get the code of the error.
     *
     * @return string Code of the error.
     */
    public function getCode()
    {
        return preg_replace('/^.+\\\\/', '', get_class($this));
    }

    /**
     * Get the message of the error.
     *
     * @return string Message of the error.
     */
    public function getMessage()
    {
        return $this->message;
    }
}

Fix removal of namespace when deriving error code from class name


<?php namespace App;

use Illuminate\Database\Eloquent\Model;

class Msessions extends Model {

	/**
	 * The database table used by the model.
	 *
	 * @var string
	 */
	protected $table = 'msessions';

	/**
	 * The attributes that are mass assignable.
	 *
	 * @var array
	 */
	protected $fillable = ['session_time','cinema_id', 'movie_id'];

	/**
	 * The attributes excluded from the model's JSON form.
	 *
	 * @var array
	 */
	protected $hidden = ['created_at', 'updated_at'];

	/**
	 * The cinema associated with this session time
	 *
	 * @param
	 * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
	 */
	public function cinemas()
	{
	   return $this->belongsToMany(App\Cinemas)->withTimestamps();
	}

	/**
	 * The movie associated with this session time
	 *
	 * @param
	 * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
	 */
	public function movies()
	{
	   return $this->belongsToMany(App\Movies)->withTimestamps();
	}

}

<?php namespace App;

use Illuminate\Database\Eloquent\Model;

class Msessions extends Model {

	/**
	 * The database table used by the model.
	 *
	 * @var string
	 */
	protected $table = 'msessions';

	/**
	 * The attributes that are mass assignable.
	 *
	 * @var array
	 */
	protected $fillable = ['session_time','cinema_id', 'movie_id'];

	/**
	 * The attributes excluded from the model's JSON form.
	 *
	 * @var array
	 */
	protected $hidden = ['created_at', 'updated_at'];

	/**
	 * The cinema associated with this session time
	 *
	 * @param
	 * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
	 */
	public function cinemas()
	{
	   return $this->belongsToMany('App\Cinemas','cinema_msession')->withTimestamps();
	}

	/**
	 * The movie associated with this session time
	 *
	 * @param
	 * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
	 */
	public function movies()
	{
	   return $this->belongsToMany('App\Movies','movie_msession')->withTimestamps();
	}

}

Rectify Msession Model and specify pivot table name -bergynj


        <script src="{{ elixir('js/app.js') }}"></script>

    </body>
</html>

        <script src="{{ elixir('js/app.js') }}"></script>

        @yield("scripts")

    </body>
</html>

Add yield for scripts in footer

Add yield for scripts in footer


<?php
/*
 * SolusVM_AdminCustomButtonArray
 *
 * Define custom functions in your module for admin users. This can contain more functions than the client area equivalent.
 *
 * @package		SolusVM
 * @category	WHMCS Provisioning Modules
 * @author		Trajche Petrov
 * @link		https://qbit.solutions/
*/
	class SolusVM_AdminCustomButtonArray extends SolusVM
	{
		function _exec()
		{
			return array
			(
				// BUTTON LABEL     => BUTTON FUNCTION
				"TUN-TAP ON/OFF" 	=> "TUN",
				"PPP ON/OFF" 		=> "PPP",
				"Reset Bandwidth"	=> "resetBW",
				"Update Hostname" 	=> "change_hostname",
			);
		}
	}

<?php
/*
 * SolusVM_AdminCustomButtonArray
 *
 * Define custom functions in your module for admin users. This can contain more functions than the client area equivalent.
 *
 * @package		SolusVM
 * @category	WHMCS Provisioning Modules
 * @author		Trajche Petrov
 * @link		https://qbit.solutions/
*/
	class SolusVM_AdminCustomButtonArray extends SolusVM
	{
		function _exec()
		{
			return array
			(
				// BUTTON LABEL     => BUTTON FUNCTION
			);
		}
	}

Remove custom admin buttons, preparing for adding new Admin Service Tab fields


<?php
$env = getenv('APPLICATION_ENV') ?: 'development';

return array(
    'modules' => array(
        'Application',
		'ATPCore'
    ),

    'module_listener_options' => array(
        'module_paths' => array(
            './module',
            './vendor',
        ),

        'config_glob_paths' => array(
            "config/autoload/{,*.}{global,{$env},local}.php",
        ),

		'config_cache_enabled' => ($env == 'production'),
        'config_cache_key' => 'app_config',
        'module_map_cache_enabled' => ($env == 'production'),
        'module_map_cache_key' => 'module_map',
        'cache_dir' => 'data/config/',
        'check_dependencies' => ($env != 'production')
    ),
);

<?php

return \ATP\Application\Config::defaultOptions(array(
    'modules' => array(
        'Application',
		'ATPCore'
    )),
	getenv('APPLICATION_ENV') ?: 'development'
);

Move default app options into ATP

Move default app options into ATP


<?php

// Path to data folder from SimpleSignUp root
$data_path = '../../server_data/ssu/';

// Set timezone for timestamps (default = UTC)
date_default_timezone_set('UTC');

?>

<?php

// Path to data folder from SimpleSignUp root
$data_path = '../../server_data/ssu/';

// Set timezone for timestamps (default = UTC)
date_default_timezone_set('UTC');

function cleanInputVariables() {
  foreach ($_REQUEST as $key=>$value) {
    $_REQUEST[$key] = str_replace(array('"', ',' , '~', ';', '{', '}', '[', ']', '=', '&'), '', str_replace("'", '’', trim($value)));
  }
}

?>

Revert "Removed cleanInputVariables() for admin"

This reverts commit 9fe974adfbd16af4aa1c50870ce77d14921b5017.


<?php

class CM_Maintenance_Cli extends CM_Cli_Runnable_Abstract {

	/**
	 * @synchronized
	 */
	public function common() {
		CM_Model_User::offlineOld();
		CM_ModelAsset_User_Roles::deleteOld();
		CM_Paging_Useragent_Abstract::deleteOlder(100 * 86400);
		CM_File_UserContent_Temp::deleteOlder(86400);
		CM_SVM::deleteOldTrainings(3000);
		CM_SVM::trainChanged();
		CM_Paging_Ip_Blocked::deleteOlder(7 * 86400);
		CM_Captcha::deleteOlder(3600);
		CM_ModelAsset_User_Roles::deleteOld();
		CM_Session::deleteExpired();
		CM_Stream_Video::getInstance()->synchronize();
		CM_Stream_Video::getInstance()->checkStreams();
		CM_KissTracking::getInstance()->exportEvents();
		CM_Stream_Message::getInstance()->synchronize();
	}

	/**
	 * @synchronized
	 */
	public function heavy() {
		CM_Mail::processQueue(500);
		CM_Action_Abstract::aggregate();
	}

	public static function getPackageName() {
		return 'maintenance';
	}

}

<?php

class CM_Maintenance_Cli extends CM_Cli_Runnable_Abstract {

	/**
	 * @synchronized
	 */
	public function common() {
		CM_Model_User::offlineOld();
		CM_ModelAsset_User_Roles::deleteOld();
		CM_Paging_Useragent_Abstract::deleteOlder(100 * 86400);
		CM_File_UserContent_Temp::deleteOlder(86400);
		CM_SVM::deleteOldTrainings(3000);
		CM_SVM::trainChanged();
		CM_Paging_Ip_Blocked::deleteOlder(7 * 86400);
		CM_Captcha::deleteOlder(3600);
		CM_ModelAsset_User_Roles::deleteOld();
		CM_Session::deleteExpired();
		CM_Stream_Video::getInstance()->synchronize();
		CM_Stream_Video::getInstance()->checkStreams();
		CM_KissTracking::getInstance()->exportEvents();
//		CM_Stream_Message::getInstance()->synchronize();
	}

	/**
	 * @synchronized
	 */
	public function heavy() {
		CM_Mail::processQueue(500);
		CM_Action_Abstract::aggregate();
	}

	public static function getPackageName() {
		return 'maintenance';
	}

}

Disable stream synchronization task in Mainteance::common()


<?php

/**
 * @package     OVAC/Hubtel-Payment
 * @link        https://github.com/ovac/hubtel-payment
 *
 * @author      Ariama O. Victor (OVAC) <contact@ovac4u.com>
 * @link        http://ovac4u.com
 *
 * @license     https://github.com/ovac/hubtel-payment/blob/master/LICENSE
 * @copyright   (c) 2017, RescopeNet, Inc
 */

namespace OVAC\HubtelPayment\Exception;

/**
 * Class MissingParameterException
 * throws OVAC\HubtelPayment\Exception\MissingParameterException
 */
class MissingParameterException extends HubtelException
{
}

<?php

/**
 * @package     OVAC/Hubtel-Payment
 * @link        https://github.com/ovac/hubtel-payment
 *
 * @author      Ariama O. Victor (OVAC) <contact@ovac4u.com>
 * @link        http://ovac4u.com
 *
 * @license     https://github.com/ovac/hubtel-payment/blob/master/LICENSE
 * @copyright   (c) 2017, Rescope Inc
 */

namespace OVAC\HubtelPayment\Exception;

/**
 * Class MissingParameterException
 * throws OVAC\HubtelPayment\Exception\MissingParameterException
 */
class MissingParameterException extends HubtelException
{
    public function setMissingParameter($missingParameters)
    {
        $this->missingParameter = $missingParameters;
        $this->message = $this->getMessage() . ' ' . $this->getMissingParameter();
    }
}

Set missing paremeters on the error message


<?php

namespace Symfony\Cmf\Bundle\RoutingExtraBundle\Listener;

use Symfony\Cmf\Bundle\RoutingExtraBundle\Document\Route;
use Doctrine\ODM\PHPCR\Event\LifecycleEventArgs;

/**
 * Doctrine PHPCR-ODM listener to set the idPrefix on new routes
 *
 * @author david.buchmann@liip.ch
 */
class IdPrefix
{
    /**
     * The prefix to add to the url to create the repository path
     *
     * @var string
     */
    protected $idPrefix = '';

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

    public function postLoad(LifecycleEventArgs $args)
    {
        $this->updateId($args);
    }

    public function postPersist(LifecycleEventArgs $args)
    {
        $this->updateId($args);
    }

    protected function updateId(LifecycleEventArgs $args)
    {
        $doc = $args->getDocument();
        // only update route objects and only if the prefix can match, to allow
        // for more than one listener and more than one route root
        if ($doc instanceof Route
            && ! strncmp($this->idPrefix, $doc->getPath(), strlen($this->idPrefix))
        ) {
            $doc->setPrefix($this->idPrefix);
        }
    }
}

<?php

namespace Symfony\Cmf\Bundle\RoutingExtraBundle\Listener;

use Symfony\Cmf\Bundle\RoutingExtraBundle\Document\Route;
use Doctrine\ODM\PHPCR\Event\LifecycleEventArgs;

/**
 * Doctrine PHPCR-ODM listener to set the idPrefix on new routes
 *
 * @author david.buchmann@liip.ch
 */
class IdPrefix
{
    /**
     * The prefix to add to the url to create the repository path
     *
     * @var string
     */
    protected $idPrefix = '';

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

    /**
     * @param $prefix
     */
    public function setPrefix($prefix)
    {
        $this->idPrefix = $prefix;
    }

    public function postLoad(LifecycleEventArgs $args)
    {
        $this->updateId($args);
    }

    public function postPersist(LifecycleEventArgs $args)
    {
        $this->updateId($args);
    }

    protected function updateId(LifecycleEventArgs $args)
    {
        $doc = $args->getDocument();
        // only update route objects and only if the prefix can match, to allow
        // for more than one listener and more than one route root
        if ($doc instanceof Route
            && ! strncmp($this->idPrefix, $doc->getPath(), strlen($this->idPrefix))
        ) {
            $doc->setPrefix($this->idPrefix);
        }
    }
}

Add setter for prefix in listener to dynamically change it (for exemple by website)


<?php
/**
 *
 * This file is part of the Aura project for PHP.
 *
 * @package Aura.Marshal
 *
 * @license http://opensource.org/licenses/bsd-license.php BSD
 *
 */
namespace Aura\Marshal\Collection;

use Aura\Marshal\Type\GenericType;

/**
 *
 * Creates a new collection object for a type.
 *
 * @package Aura.Marshal
 *
 */
class Builder implements BuilderInterface
{
    /**
     *
     * Creates a new collection object.
     *
     * @param array $data Data to load into the collection.
     *
     * @return GenericCollection
     *
     */
    public function newInstance(array $data)
    {
        return new GenericCollection($data);
    }
}

<?php
/**
 *
 * This file is part of the Aura project for PHP.
 *
 * @package Aura.Marshal
 *
 * @license http://opensource.org/licenses/bsd-license.php BSD
 *
 */
namespace Aura\Marshal\Collection;

/**
 *
 * Creates a new collection object for a type.
 *
 * @package Aura.Marshal
 *
 */
class Builder implements BuilderInterface
{
    /**
     *
     * The class to use for new instances.
     *
     * @var string
     *
     */
    protected $class = 'Aura\Marshal\Collection\GenericCollection';

    /**
     *
     * Creates a new collection object.
     *
     * @param array $data Data to load into the collection.
     *
     * @return GenericCollection
     *
     */
    public function newInstance(array $data)
    {
        $class = $this->class;
        return new $class($data);
    }
}

Make collection generic class configurable (just like Entity already is).


<?php

namespace Flow\Expression;

use Flow\Expression;

abstract class UnaryExpression extends Expression
{
    private $node;

    public function __construct($node, $line)
    {
        parent::__construct($line);
        $this->node = $node;
    }

    abstract function operator() : string;

    public function compile($compiler, $indent = 0)
    {
        $compiler->raw('(', $indent);
        $compiler->raw($this->operator());
        $compiler->raw('(');
        $this->node->compile($compiler);
        $compiler->raw('))');
    }
}

<?php

namespace Flow\Expression;

use Flow\Expression;

abstract class UnaryExpression extends Expression
{
    private $node;

    public function __construct($node, $line)
    {
        parent::__construct($line);
        $this->node = $node;
    }

    abstract public function operator() : string;

    public function compile($compiler, $indent = 0)
    {
        $compiler->raw('(', $indent);
        $compiler->raw($this->operator());
        $compiler->raw('(');
        $this->node->compile($compiler);
        $compiler->raw('))');
    }
}

Make method access specifier explicit

Make method access specifier explicit


<?php

namespace Zizaco\FactoryMuff\Kind;

use Zizaco\FactoryMuff\Kind;

class Integer extends Kind
{
  public function generate()
  {
    $length = (int) $this->getOption(0, 5);
    $faker = \Faker\Factory::create();
    return $faker->randomNumber($length);
  }
}

<?php

namespace Zizaco\FactoryMuff\Kind;

use Zizaco\FactoryMuff\Kind;

class Integer extends Kind
{
  public function generate()
  {
    $length = (int) $this->getOption(0, 5);
    return $this->randomNumber($length);
  }

  private function randomNumber($length)
  {
    $integer = null;
    for($i = 0; $i < $length; $i++) {
      $integer .= mt_rand(1, 9);
    }

    return (int) $integer;
  }
}

Use mt_rand to generate random number. Faker broke when integers started with 0


<?php

namespace Flint\Controller;

use Symfony\Component\HttpFoundation\Request;

class ExceptionController extends Controller
{
    public function showAction(Request $request)
    {
        return 'I am an error';
    }
}

<?php

namespace Flint\Controller;

use Symfony\Component\HttpFoundation\Request;

/**
 * @package Flint
 */
class ExceptionController extends Controller
{
    /**
     * @param Request $request
     * @param string $format
     */
    public function showAction(Request $request, $format)
    {
        return $format;
    }
}

Return the format for the Exception

Return the format for the Exception


<?php

namespace Enzyme\Axiom\Factories;

use Enzyme\Axiom\Carriers\CarrierInterface;

/**
 * Makes instances from the given data.
 */
interface FactoryInterface
{
    /**
     * Make a new instance from the given data.
     *
     * @param CarrierInterface $data
     *
     * @return InstanceInterface
     */
    public function make(CarrierInterface $data);
}

<?php

namespace Enzyme\Axiom\Factories;

use Enzyme\Axiom\Carriers\CarrierInterface;

/**
 * Makes instances from the given data.
 */
interface FactoryInterface
{
    /**
     * Make a new instance from the given data.
     *
     * @param CarrierInterface $data
     *
     * @return Enzyme\Axiom\Instances\InstanceInterface
     */
    public function make(CarrierInterface $data);
}

Add namespace path to return type.

Add namespace path to return type.


<?php

namespace H4D\Leveret\Application;

use H4D\I18n\NullTranslator;
use H4D\I18n\TranslatorAwareTrait;
use H4D\Template\TemplateTrait;
use H4D\Leveret\Application\View\Partial;

class View
{

    use TemplateTrait;
    use TranslatorAwareTrait;

    public function __construct()
    {
        $this->translator = new NullTranslator();
    }

    /**
     * This function supports extra params for var substitution in $string.
     *
     * @param $string
     *
     * @return string
     */
    public function translate($string)
    {
        return call_user_func_array([$this->translator, 'translate'], func_get_args());
    }

    /**
     * @param string $route
     * @param array $vars
     *
     * @return Partial
     */
    public function partial($route, array $vars = [])
    {
        $partial = new Partial(['view' => $this]);
        $partial->setTemplateFile($route);
        // Add main view vars
        $partial->addVars($this->getVars());
        // Add local vars (can overide main view vars)
        if (count($vars) > 0)
        {
            $partial->addVars($vars);
        }

        return $partial;
    }
}

<?php

namespace H4D\Leveret\Application;

use H4D\I18n\NullTranslator;
use H4D\I18n\TranslatorAwareTrait;
use H4D\Template\TemplateTrait;
use H4D\Leveret\Application\View\Partial;

class View
{

    use TemplateTrait;
    use TranslatorAwareTrait;

    public function __construct()
    {
        $this->translator = new NullTranslator();
    }

    /**
     * This function supports extra params for var substitution in $string.
     *
     * @param $string
     *
     * @return string
     */
    public function translate($string)
    {
        return call_user_func_array([$this->translator, 'translate'], func_get_args());
    }

    /**
     * @param string $string
     *
     * @return string
     */
    public function escapeHtml($string)
    {
        return htmlspecialchars($string);
    }

    /**
     * @param string $route
     * @param array $vars
     *
     * @return Partial
     */
    public function partial($route, array $vars = [])
    {
        $partial = new Partial(['view' => $this]);
        $partial->setTemplateFile($route);
        // Add main view vars
        $partial->addVars($this->getVars());
        // Add local vars (can overide main view vars)
        if (count($vars) > 0)
        {
            $partial->addVars($vars);
        }

        return $partial;
    }
}

Add new method for html escaping.

Add new method for html escaping.


<!-- Javascript -->
<script src="/js/i18n.js"></script>
<script src="/js/jquery.min.js"></script>
<script src="/js/jsrapport/jquery-ui.min.js"></script>
<script src="/js/knockout-3.1.0.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/js/ie10-viewport-bug-workaround.js"></script>
<script src="/js/modals.js"></script>
<script src="/js/global.js"></script>
<script src="/js/<?php echo $location ?>ViewModel.js"></script>

<!-- Javascript -->
<script src="/js/i18n.js"></script>
<script src="/js/jquery.min.js"></script>
<script src="/js/jsrapport/jquery-ui.min.js"></script>
<script src="/js/knockout-3.3.0.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/js/ie10-viewport-bug-workaround.js"></script>
<script src="/js/modals.js"></script>
<script src="/js/global.js"></script>
<script src="/js/<?php echo $location ?>ViewModel.js"></script>

Update Knockout js version script src

Update Knockout js version script src


<?php
namespace DrestTests;

class ManagerTest extends DrestTestCase
{

    public function testExecutingOnANamedRoute()
    {
        $dm = $this->_getDrestManager();

        $dm->dispatch()

    }
}

<?php
namespace DrestTests\Functional;

use DrestTests\DrestFunctionalTestCase;

class ManagerTest extends DrestFunctionalTestCase
{

    public function testExecutingOnANamedRoute()
    {
        $dm = $this->_getDrestManager();

        $response = $dm->dispatch(null, null, 'DrestTests\Entities\Typical\User::get_user');

    }
}

Add a few more tests

Add a few more tests


<?php
namespace CodeDay\Clear\Http\Controllers\Manage\DayOf;

use \CodeDay\Clear\Models;
use \CodeDay\Clear\ModelContracts;
use \Carbon\Carbon;

class BreakController extends \CodeDay\Clear\Http\Controller {

    public function getIndex()
    {
        $onBreak = Models\Batch\Event\Registration::whereNotNull('break_started_at')->orderBy('break_started_at', 'ASC')->get();
        $offBreak = Models\Batch\Event\Registration::whereNull('break_started_at')->get();
        return \View::make('dayof/break', ['on_break' => $onBreak, 'off_break' => $offBreak]);
    }

    public function postStart()
    {
        $reg = Models\Batch\Event\Registration::where('id', '=', \Input::get('id'))->firstOrFail();
        $reg->phone = \Input::get('phone');
        $reg->break_started_at = Carbon::now();
        $reg->save();

        return \Redirect::to('/dayof/break');
    }

    public function postEnd()
    {
        $reg = Models\Batch\Event\Registration::where('id', '=', \Input::get('id'))->firstOrFail();
        $reg->break_started_at = null;
        $reg->save();

        return \Redirect::to('/dayof/break');
    }
}

<?php
namespace CodeDay\Clear\Http\Controllers\Manage\DayOf;

use \CodeDay\Clear\Models;
use \CodeDay\Clear\ModelContracts;
use \Carbon\Carbon;

class BreakController extends \CodeDay\Clear\Http\Controller {

    public function getIndex()
    {
        $event = getDayOfEvent();
        $onBreak = Models\Batch\Event\Registration::whereNotNull('break_started_at')->where('batches_event_id', '=', $event->id)->orderBy('break_started_at', 'ASC')->get();
        $offBreak = Models\Batch\Event\Registration::whereNull('break_started_at')->where('batches_event_id', '=', $event->id)->get();
        return \View::make('dayof/break', ['on_break' => $onBreak, 'off_break' => $offBreak]);
    }

    public function postStart()
    {
        $reg = Models\Batch\Event\Registration::where('id', '=', \Input::get('id'))->firstOrFail();
        $reg->phone = \Input::get('phone');
        $reg->break_started_at = Carbon::now();
        $reg->save();

        return \Redirect::to('/dayof/break');
    }

    public function postEnd()
    {
        $reg = Models\Batch\Event\Registration::where('id', '=', \Input::get('id'))->firstOrFail();
        $reg->break_started_at = null;
        $reg->save();

        return \Redirect::to('/dayof/break');
    }
}

Fix list of break attendees

Fix list of break attendees