<?php

namespace FullyBaked\Pslackr\Messages;

use PHPUnit_Framework_TestCase;
use Exception;

class CustomMessageTest extends PHPUnit_Framework_TestCase
{

    public function testConstructorSetsTextProperty()
    {
        $text = 'This is a test message';

        $relection = new \ReflectionClass('FullyBaked\Pslackr\Messages\CustomMessage');
        $property = $relection->getProperty('text');
        $property->setAccessible(true);

        $message = $this->getMockBuilder('FullyBaked\Pslackr\Messages\CustomMessage')
            ->setConstructorArgs([$text])
            ->getMock();

        $this->assertEquals($text, $property->getValue($message));
    }

}

<?php

namespace FullyBaked\Pslackr\Messages;

use PHPUnit_Framework_TestCase;
use Exception;

class CustomMessageTest extends PHPUnit_Framework_TestCase
{

    public function testConstructorSetsTextProperty()
    {
        $text = 'This is a test message';

        $relection = new \ReflectionClass('FullyBaked\Pslackr\Messages\CustomMessage');
        $property = $relection->getProperty('text');
        $property->setAccessible(true);

        $message = $this->getMockBuilder('FullyBaked\Pslackr\Messages\CustomMessage')
            ->setConstructorArgs([$text])
            ->getMock();

        $this->assertEquals($text, $property->getValue($message));
    }

    public function testAsJsonReturnsMinimumJsonRequired()
    {
        $text = 'This is a test message';
        $message = new CustomMessage($text);

        $expected = '{"text":"This is a test message"}';
        $result = $message->asJson();

        $this->assertEquals($result, $expected);
    }

}

Test that asJson returns minimum viable json for slack


<?php namespace Plugins\October\User\Controllers;

use BackendMenu;
use BackendAuth;
use Modules\Backend\Classes\BackendController;

class Users extends BackendController
{
    public $implement = [
        'Modules.Backend.Behaviors.FormController',
        'Modules.Backend.Behaviors.ListController'
    ];

    public $formConfig = 'form_config.yaml';
    public $listConfig = 'list_config.yaml';

    public $requiredPermissions = ['october.manage_users'];

    public function __construct()
    {
        parent::__construct();

        BackendMenu::setContext('October.User', 'user');
    }
}

<?php namespace Plugins\October\User\Controllers;

use BackendMenu;
use BackendAuth;
use Modules\Backend\Classes\BackendController;

class Users extends BackendController
{
    public $implement = [
        'Modules.Backend.Behaviors.FormController',
        'Modules.Backend.Behaviors.ListController'
    ];

    public $formConfig = 'form_config.yaml';
    public $listConfig = 'list_config.yaml';

    public $requiredPermissions = ['october.manage_users'];

    public function __construct()
    {
        parent::__construct();

        BackendMenu::setContext('October.User', 'user', 'users');
    }
}

Add selected state to side menu.

Add selected state to side menu.


<?php

ini_set('default_charset', 'UTF-8');

// TODO: It can be calculated
define("BASE_URL", "http://www.vibrobox.local:8888/");
define("LANG", "ru");

require("translations.php");

function HTML_HEAD() {
  return require("head.php");
}

function HTML_HEADER() {
  return require("header.php");
}

function HTML_FOOTER() {
  return require("footer.php");
}

function MenuLink($uri) {
  // TODO: take into an account absolute/relative urls?
  return BASE_URL . $uri;
}

function MainMenu() {
  return array(
    MenuLink("technology") => Translate("menuTechnologyPage"),
    MenuLink("team") => Translate("menuTeamPage"),
    MenuLink("contact") => Translate("menuContactPage")
  );
}

<?php

ini_set('default_charset', 'UTF-8');

// TODO: It can be calculated
define("BASE_URL", "https://deathbaba.github.io/landing-php/");
define("LANG", "ru");

require("translations.php");

function HTML_HEAD() {
  return require("head.php");
}

function HTML_HEADER() {
  return require("header.php");
}

function HTML_FOOTER() {
  return require("footer.php");
}

function MenuLink($uri) {
  // TODO: take into an account absolute/relative urls?
  return BASE_URL . $uri;
}

function MainMenu() {
  return array(
    MenuLink("technology") => Translate("menuTechnologyPage"),
    MenuLink("team") => Translate("menuTeamPage"),
    MenuLink("contact") => Translate("menuContactPage")
  );
}

Change base url to github repo.

Change base url to github repo.


<?php
/**
 * @copyright 2019
 * @author Stefan "eFrane" Graupner <stefan.graupner@gmail.com>
 */

namespace EFrane\ConsoleAdditions\Batch;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputInterface;

class InstanceCommandAction extends CommandAction
{
    public function __construct(Command $command, InputInterface $input = null)
    {
        $this->command = $command;

        $this->input = $input;
        if (is_null($input)) {
            $this->input = new ArrayInput([]);
        }
    }

    public function __toString(): string
    {
        $this->abortIfNoApplication();

        return trim(
            sprintf(
                '%s %s %s',
                $this->application->getName(),
                $this->command->getName(),
                $this->input
            )
        );
    }
}

<?php
/**
 * @copyright 2019
 * @author Stefan "eFrane" Graupner <stefan.graupner@gmail.com>
 */

namespace EFrane\ConsoleAdditions\Batch;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputInterface;

class InstanceCommandAction extends CommandAction
{
    public function __construct(Command $command, InputInterface $input = null)
    {
        $this->command = $command;

        $this->input = $input;
        if (is_null($input)) {
            $this->input = new ArrayInput([]);
        }
    }

    public function __toString(): string
    {
        $this->abortIfNoApplication();

        $inputString = '';
        if (method_exists($this->input, '__toString')) {
            $inputString = $this->input->__toString();
        }

        return trim(
            sprintf(
                '%s %s %s',
                $this->application->getName(),
                $this->command->getName(),
                $inputString
            )
        );
    }
}

Fix possibly breaking input args stringify (PHPStan Level 5)


<?php

namespace Page;

/**
 * Class TasksPage
 * @package Page
 */
class ApiPage
{
    const URL = 'http://localhost:8000/task';
    /**
     *
     * @param \AcceptanceTester $I Codeception variable
     */
    public function __construct(\AcceptanceTester $I)
    {
        $this->tester = $I;
    }

    /**
     * Function used to create new task
     *
     * @param string $task task description
     * @return array
     */
    public function newTask($task)
    {

        $I=$this->tester;
        $I->sendPOST(static::URL, ['name' => $task]);
    }
}

<?php

namespace Page;

/**
 * Class TasksPage
 * @package Page
 */
class ApiPage
{
    const URL = 'http://localhost:8080/task';
    /**
     *
     * @param \AcceptanceTester $I Codeception variable
     */
    public function __construct(\AcceptanceTester $I)
    {
        $this->tester = $I;
    }

    /**
     * Function used to create new task
     *
     * @param string $task task description
     * @return array
     */
    public function newTask($task)
    {

        $I=$this->tester;
        $I->sendPOST(static::URL, ['name' => $task]);
    }
}

Add Test case with delete Feature

Add Test case with delete Feature


<?php

namespace Noback\PHPUnitTestServiceContainer\PHPUnit;

use Noback\PHPUnitTestServiceContainer\ServiceContainer;
use Noback\PHPUnitTestServiceContainer\ServiceContainerInterface;
use Noback\PHPUnitTestServiceContainer\ServiceProviderInterface;

/**
 * Extend from this test case to make use of a service container in your tests
 */
abstract class AbstractTestCaseWithServiceContainer extends \PHPUnit_Framework_TestCase
{
    /**
     * @var ServiceContainerInterface
     */
    protected $container;

    /**
     * Return an array of ServiceProviderInterface instances you want to use in this test case
     *
     * @return ServiceProviderInterface[]
     */
    abstract protected function getServiceProviders();

    /**
     * When overriding this method, make sure you call parent::setUp()
     */
    protected function setUp()
    {
        $this->container = new ServiceContainer();

        foreach ($this->getServiceProviders() as $serviceProvider) {
            $this->container->register($serviceProvider);
        }
    }

    /**
     * When overriding this method, make sure you call parent::tearDown()
     */
    protected function tearDown()
    {
        $this->container->tearDown();
        $this->container = null;
    }
}

<?php

namespace Noback\PHPUnitTestServiceContainer\PHPUnit;

use Noback\PHPUnitTestServiceContainer\ServiceContainer;
use Noback\PHPUnitTestServiceContainer\ServiceContainerInterface;
use Noback\PHPUnitTestServiceContainer\ServiceProviderInterface;

/**
 * Extend from this test case to make use of a service container in your tests
 */
abstract class AbstractTestCaseWithServiceContainer extends \PHPUnit_Framework_TestCase
{
    /**
     * @var ServiceContainerInterface
     */
    protected $container;

    /**
     * Return an array of ServiceProviderInterface instances you want to use in this test case
     *
     * @return ServiceProviderInterface[]
     */
    abstract protected function getServiceProviders();

    /**
     * When overriding this method, make sure you call parent::setUp()
     */
    protected function setUp()
    {
        $this->container = $this->createServiceContainer();

        $this->container->setUp();
    }

    protected function createServiceContainer()
    {
        $container = new ServiceContainer();

        foreach ($this->getServiceProviders() as $serviceProvider) {
            $container->register($serviceProvider);
        }

        return $container;
    }

    /**
     * When overriding this method, make sure you call parent::tearDown()
     */
    protected function tearDown()
    {
        $this->container->tearDown();
        $this->container = null;
    }
}

Add factory method for creating the service container


<?php

	class AppController extends Controller
	{
		function __construct()
		{
			parent::__construct();
		}

		function __destruct()
		{
			parent::__destruct();
		}
	}

?>

<?php

	class AppController extends Controller
	{
		protected $postVars = false;

		function __construct()
		{
			parent::__construct();

			$post = new stdClass();
			foreach($_POST as $postKey => $postValue) {
				$this->postVars->$postKey = $postValue;
			}
		}

		function __destruct()
		{
			parent::__destruct();
		}
	}

?>

Add a very simple, less ugly and less cumbersome method of obtaining POST values.


<?php

namespace Laracasts\Utilities\JavaScript;

use Illuminate\Events\Dispatcher;

class LaravelViewBinder implements ViewBinder
{

    /**
     * The event dispatcher implementation.
     *
     * @var Dispatcher
     */
    private $event;

    /**
     * The name of the view to bind any
     * generated JS variables to.
     *
     * @var string
     */
    private $views;

    /**
     * Create a new Laravel view binder instance.
     *
     * @param Dispatcher   $event
     * @param string|array $views
     */
    function __construct(Dispatcher $event, $views)
    {
        $this->event = $event;
        $this->views = str_replace('/', '.', (array) $views);
    }

    /**
     * Bind the given JavaScript to the view.
     *
     * @param string $js
     */
    public function bind($js)
    {
        foreach ($this->views as $view) {
            $this->event->listen("composing: {$view}", function () use ($js) {
                echo "<script>{$js}</script>";
            });
        }
    }

}

<?php

namespace Laracasts\Utilities\JavaScript;

use Illuminate\Contracts\Events\Dispatcher;

class LaravelViewBinder implements ViewBinder
{

    /**
     * The event dispatcher implementation.
     *
     * @var Dispatcher
     */
    private $event;

    /**
     * The name of the view to bind any
     * generated JS variables to.
     *
     * @var string
     */
    private $views;

    /**
     * Create a new Laravel view binder instance.
     *
     * @param Dispatcher   $event
     * @param string|array $views
     */
    function __construct(Dispatcher $event, $views)
    {
        $this->event = $event;
        $this->views = str_replace('/', '.', (array) $views);
    }

    /**
     * Bind the given JavaScript to the view.
     *
     * @param string $js
     */
    public function bind($js)
    {
        foreach ($this->views as $view) {
            $this->event->listen("composing: {$view}", function () use ($js) {
                echo "<script>{$js}</script>";
            });
        }
    }

}

Use Dispatcher contract instead of concrete implementation


    @if (!$hideTitle && !empty($post_title))

{!! apply_filters('the_title', $post_title) !!}

    @endif

    {{ $embed }}

    @if (!$hideTitle && !empty($post_title))

{!! apply_filters('the_title', $post_title) !!}

    @endif

    {!! $embed !!}

Allow HTML to be outputted in scripts module.


	<?php foreach ($assets as $asset): ?>
		<div style="height: 160px; width: <?= floor(160 * $asset->getAspectRatio()) ?>px" data-aspect-ratio="<?= $asset->getAspectRatio() ?>">
			<a href="#" class="thumb" data-asset="<?= $asset->getId() ?>">

<?= $asset->getTitle() ?>

                        <?= Lang::get('boomcms::asset.type.'.strtolower($asset->getType())) ?>

	<?php endforeach ?>

	<?php foreach ($assets as $asset): ?>
		<div style="height: 160px; width: <?= floor(160 * $asset->getAspectRatio()) ?>px" data-aspect-ratio="<?= $asset->getAspectRatio() ?>">
			<a href="#" class="thumb" data-asset="<?= $asset->getId() ?>">

<?= $asset->getTitle() ?>

                        <?= Lang::get('boomcms::asset.type.'.strtolower($asset->getType())) ?>

                        <?php if ($asset->isImage()): ?>
                            <?= $asset->getWidth() ?> x <?= $asset->getHeight() ?>
                        <?php else: ?>
                            <?= $asset->getHumanFilesize() ?>
                        <?php endif ?>

	<?php endforeach ?>

Put asset dimensions / filesize back into asset thumb view


<?php
    class DbconfigController extends ControllerBase {
        protected function dbInit() {}

        public function create( $user, $pass, $dbname ) {
            $entries = compact( 'user', 'pass', 'dbname' );
            $entries = [ 'db' => $entries ];
            try {
                updateConfig( $entries, $this->environment );
                go();
            }
            catch ( FileNotWritableException $e ) {
                $content = $e->content;
                require_once 'views/database/notwritable.php';
            }
        }
        public function createView( $error, $dbSaid ) {
            global $config;
            $oldConfig = [
                'db' => [
                    'user'   => '',
                    'pass'   => '',
                    'dbname' => ''
                ]
            ];
            $oldConfig = array_replace_recursive( $oldConfig, $config );

            require_once 'views/database/create.php';
        }

    }
?>

<?php
    class DbconfigController extends ControllerBase {
        protected function dbInit() {}

        public function create( $user, $pass, $dbname ) {
            $entries = compact( 'user', 'pass', 'dbname' );
            $entries = [ 'db' => $entries ];
            try {
                updateConfig( $entries, $this->environment );
                go();
            }
            catch ( FileNotWritableException $e ) {
                $content = $e->content;
                require 'views/database/notwritable.php';
            }
        }
        public function createView( $error, $dbSaid ) {
            global $config;
            $oldConfig = [
                'db' => [
                    'user'   => '',
                    'pass'   => '',
                    'dbname' => ''
                ]
            ];
            $oldConfig = array_replace_recursive( $oldConfig, $config );

            require 'views/database/create.php';
        }

    }
?>

Use require for views instead of require_once


<?php
namespace Rbs\Theme\Documents;

use Change\Presentation\Layout\Layout;

/**
 * @name \Rbs\Theme\Documents\PageTemplate
 */
class PageTemplate extends \Compilation\Rbs\Theme\Documents\PageTemplate implements \Change\Presentation\Interfaces\PageTemplate
{
	/**
	 * @return Layout
	 */
	public function getContentLayout()
	{
		return new Layout($this->getEditableContent());
	}

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

<?php
namespace Rbs\Theme\Documents;

use Change\Presentation\Layout\Layout;

/**
 * @name \Rbs\Theme\Documents\PageTemplate
 */
class PageTemplate extends \Compilation\Rbs\Theme\Documents\PageTemplate implements \Change\Presentation\Interfaces\PageTemplate
{
	/**
	 * @return Layout
	 */
	public function getContentLayout()
	{
		return new Layout($this->getEditableContent());
	}

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

	/**
	 * @param \Change\Documents\Events\Event $event
	 */
	public function onDefaultUpdateRestResult(\Change\Documents\Events\Event $event)
	{
		parent::onDefaultUpdateRestResult($event);
		$restResult = $event->getParam('restResult');
		if ($restResult instanceof \Change\Http\Rest\Result\DocumentLink)
		{
			$documentLink = $restResult;
			/* @var $pageTemplate \Rbs\Theme\Documents\PageTemplate */
			$pageTemplate = $documentLink->getDocument();
			$documentLink->setProperty('label', $pageTemplate->getTheme()->getLabel() . ' > ' . $pageTemplate->getLabel());
		}
	}
}

[NEW] Add theme name before page template name in lists.


<?php
require_once 'Generics/Client/HttpClient.php';
require_once 'Generics/Socket/Endpoint.php';

use Generics\Client\HttpClient;
use Generics\Socket\Endpoint;

class HttpClientTest extends PHPUnit_Framework_TestCase
{
  public function testSimpleRequest()
  {
    $http = new HttpClient ( new Endpoint ( 'localhost', 80 ) );
    $http->request ( 'GET' );

    $this->assertEquals(200, $http->getResponseCode());

    $response = "";

    while ( $http->getPayload ()->ready () )
    {
      $response = $http->getPayload ()->read ( $http->getPayload ()->count () );
    }

    $this->assertNotEmpty($response);
  }
}

<?php
require_once 'Generics/Client/HttpClient.php';
require_once 'Generics/Socket/Endpoint.php';

use Generics\Client\HttpClient;
use Generics\Socket\Endpoint;

class HttpClientTest extends PHPUnit_Framework_TestCase
{
  public function testSimpleRequest()
  {
    $http = new HttpClient ( new Endpoint ( 'httpbin.org', 80 ) );
    $http->request ( 'GET' );

    $this->assertEquals(200, $http->getResponseCode());

    $response = "";

    while ( $http->getPayload ()->ready () )
    {
      $response = $http->getPayload ()->read ( $http->getPayload ()->count () );
    }

    $this->assertNotEmpty($response);
  }
}

Use an official address for unit test

Use an official address for unit test


        Associazione Portico delle Parole

        Via del Pratello 9, 40122 Bologna, Italia

        Tel: +39 327 6617027

        info@porticodelleparole.it
        www.porticodelleparole.it

        C.F.: 91361610370

        Informativa sui Cookie
         |
        Privacy Policy

Add link to Privacy page

Add link to Privacy page


		{!! Form::open(['url' => '/admin/' . $repository->getHandle() . '/search']) !!}

				{!! Form::text('search', session('admin.' . $repository->getHandle() . '.search'), ['autofocus']) !!}

				<button class="button postfix">
					Search
				</button>

		{!! Form::close() !!}

		{!! Form::open(['url' => '/admin/' . $repository->getHandle() . '/search']) !!}

				{!! Form::text('search', session('admin.' . $repository->getHandle() . '.search'), ['autofocus', 'class' => 'input-group-field']) !!}

					<input type="submit" class="button" value="Search" />

		{!! Form::close() !!}

Fix search bar for crud indexes

Fix search bar for crud indexes


<?php
session_start();
foreach (array_keys($_SESSION) as $key) {
    unset($_SESSION[$key]);
}
echo 'Session variables unset. Home'
?>

Fix relative link back to home page.

Fix relative link back to home page.


<?php
/**
 * CLIResponse
 */

namespace Orpheus\InputController\CLIController;

use Orpheus\InputController\OutputResponse;

/**
 * The CLIResponse class
 *
 * @author Florent Hazard <contact@sowapps.com>
 *
 */
class CLIResponse extends OutputResponse {

	/**
	 * The HTML body of the response
	 *
	 * @var string
	 */
	protected $body;

	/**
	 * Constructor
	 *
	 * @param string $body
	 */
	public function __construct($body=null) {
		$this->setBody($body);
	}

	/**
	 * Process the response
	 */
	public function process() {
		if( isset($this->body) ) {
			echo $this->getBody();
		}
	}

	/**
	 * Collect response data from parameters
	 *
	 * @param string $layout
	 * @param array $values
	 * @return NULL
	 */
	public function collectFrom($layout, $values=array()) {
		return null;
	}

	/**
	 * Generate HTMLResponse from Exception
	 *
	 * @param Exception $exception
	 * @param string $action
	 * @return \Orpheus\InputController\HTTPController\HTMLHTTPResponse
	 */
	public static function generateFromException(\Exception $exception, $action='Handling the request') {
		$response = new static(convertExceptionAsText($exception, $action));
		return $response;
	}
}

<?php
/**
 * CLIResponse
 */

namespace Orpheus\InputController\CLIController;

use Orpheus\InputController\OutputResponse;

/**
 * The CLIResponse class
 *
 * @author Florent Hazard <contact@sowapps.com>
 *
 */
class CLIResponse extends OutputResponse {

	/**
	 * The HTML body of the response
	 *
	 * @var string
	 */
	protected $body;

	/**
	 * Constructor
	 *
	 * @param string $body
	 */
	public function __construct($body=null) {
		$this->setBody($body);
	}

	/**
	 * Process the response
	 */
	public function process() {
		if( isset($this->body) ) {
			echo $this->getBody();
		}
	}

	/**
	 * Collect response data from parameters
	 *
	 * @param string $layout
	 * @param array $values
	 * @return NULL
	 */
	public function collectFrom($layout, $values=array()) {
		return null;
	}

	/**
	 * Generate HTMLResponse from Exception
	 *
	 * @param Exception $exception
	 * @param string $action
	 * @return \Orpheus\InputController\HTTPController\HTMLHTTPResponse
	 */
	public static function generateFromException(\Exception $exception, $action='Handling the request') {
		$response = new static(convertExceptionAsText($exception, 0, $action));
		return $response;
	}
}

Implement CLI classes for MVC (unstable)


<?php

namespace Tests\AppBundle\Command;

use AppBundle\Command\ListUserCommand;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Console\Tester\CommandTester;

class ListUserCommandTest extends KernelTestCase
{
    public function testExecute()
    {
        self::bootKernel();
        $application = new Application(self::$kernel);

        $application->add(new ListUserCommand());

        $command = $application->find('app:list-user');
        $commandTester = new CommandTester($command);
        $commandTester->execute(array(
            'command'  => $command->getName(),
        ));

        // the output of the command in the console
        $output = $commandTester->getDisplay();
        $this->assertContains('iucn_redlist_api', $output);
    }
}

<?php

namespace Tests\AppBundle\Command;

use AppBundle\Command\ListUserCommand;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Console\Tester\CommandTester;

class ListUserCommandTest extends KernelTestCase
{
    public function testExecute()
    {
        self::bootKernel();
        $application = new Application(self::$kernel);

        $application->add(new ListUserCommand());

        $command = $application->find('app:list-user');
        $commandTester = new CommandTester($command);
        $commandTester->execute(array(
            'command'  => $command->getName(),
        ));

        // the output of the command in the console
        $output = $commandTester->getDisplay();
        $this->assertContains('firstName', $output);
    }
}

Fix assertion for new db structure

Fix assertion for new db structure


<?php
/**
 * Hendle every http errors.
 *
 * @author	Iskandar Soesman <k4ndar@yahoo.com>
 * @link	http://panadaframework.com/
 * @license	http://www.opensource.org/licenses/bsd-license.php
 * @since	version 1.0.0
 * @package	Resources
 */
namespace Resources;

class HttpException extends \Exception
{
    public function __construct($message = null, $code = 0, Exception $previous = null)
    {
        set_exception_handler( array($this, 'main') );
        parent::__construct($message, $code, $previous);
    }

    public function __toString()
    {
        return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
    }

    public function main($exception)
    {
        self::outputError($exception->getMessage());
    }

    public static function outputError($message = null)
    {
        // Write the error to log file
	@error_log('Error 404 Page Not Found: '.$_SERVER['REQUEST_URI']);

        header('HTTP/1.1 404 Not Found', true, 500);
        \Resources\Controller::outputError('errors/404', array('message' => $message) );
    }
}

<?php
/**
 * Hendle every http errors.
 *
 * @author	Iskandar Soesman <k4ndar@yahoo.com>
 * @link	http://panadaframework.com/
 * @license	http://www.opensource.org/licenses/bsd-license.php
 * @since	version 1.0.0
 * @package	Resources
 */
namespace Resources;

class HttpException extends \Exception
{
    public function __construct($message = null, $code = 0, Exception $previous = null)
    {
        set_exception_handler( array($this, 'main') );
        parent::__construct($message, $code, $previous);
    }

    public function __toString()
    {
        return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
    }

    public function main($exception)
    {
        self::outputError($exception->getMessage());
    }

    public static function outputError($message = null)
    {
	if(PHP_SAPI == 'cli')
	    exit($message."\n");

        // Write the error to log file
	@error_log('Error 404 Page Not Found: '.$_SERVER['REQUEST_URI']);

        header('HTTP/1.1 404 Not Found', true, 500);
        \Resources\Controller::outputError('errors/404', array('message' => $message) );
    }
}

Fix error message in CLI mode

Fix error message in CLI mode


<?php

namespace ValueObjects\Internet;

use ValueObjects\ValueObject;

class IpAddress extends ValueObject
{
    /**
     * IpAddress constructor.
     * @param string $ipAddress The ip address.
     */
    public function __construct(string $ipAddress)
    {
        $this->validate($ipAddress);
        parent::__construct($ipAddress);
    }

    private function validate($ipAddress): void
    {
        if (filter_var($ipAddress, FILTER_VALIDATE_IP) === false) {
            throw new \InvalidArgumentException("$ipAddress is not a valid ip address.");
        }
    }
}

<?php

namespace ValueObjects\Internet;

use ValueObjects\ValueObject;

class IpAddress extends ValueObject
{
    /**
     * IpAddress constructor.
     * @param string $ipAddress The ip address.
     */
    public function __construct(string $ipAddress)
    {
        $this->validate($ipAddress);
        parent::__construct($ipAddress);
    }

    private function validate($ipAddress)
    {
        if (filter_var($ipAddress, FILTER_VALIDATE_IP) === false) {
            throw new \InvalidArgumentException("$ipAddress is not a valid ip address.");
        }
    }
}

Fix to be compatible with Php 7.0

Fix to be compatible with Php 7.0


<?php
include_once('bootstrap.php');
include_once('commonfunction.php');

include_once(GLPI_ROOT . "/config/based_config.php");
include_once(GLPI_ROOT . "/inc/dbmysql.class.php");
include_once(GLPI_CONFIG_DIR . "/config_db.php");

/*
 * Helper class to restore database from some SQL restore point file
 */

abstract class RestoreDatabaseTestCase extends CommonTestCase
{

    public static function setUpBeforeClass()
    {
        restore_database();
    }
}
?>

<?php
include_once('bootstrap.php');
include_once('commonfunction.php');

include_once(GLPI_ROOT . "/config/based_config.php");
include_once(GLPI_ROOT . "/inc/dbmysql.class.php");
include_once(GLPI_CONFIG_DIR . "/config_db.php");

/*
 * Helper class to restore database from some SQL restore point file
 */

abstract class RestoreDatabaseTestCase extends CommonTestCase
{

    public static function setUpBeforeClass()
    {
        self::restore_database();
    }
}
?>

Fix restore_database function not found

Fix restore_database function not found


<?php

/**
 * Inherited Methods
 * @method void wantToTest($text)
 * @method void wantTo($text)
 * @method void execute($callable)
 * @method void expectTo($prediction)
 * @method void expect($prediction)
 * @method void amGoingTo($argumentation)
 * @method void am($role)
 * @method void lookForwardTo($achieveValue)
 * @method void comment($description)
 * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
 *
 * @SuppressWarnings(PHPMD)
*/
class AcceptanceTester extends \Codeception\Actor
{
    use _generated\AcceptanceTesterActions;
   /**
    * Define custom actions here
    */

    /**
     * @param string $username
     * @param string $password
     */
    public function login($username, $password)
    {
        $I = $this;

        // if snapshot exists - skipping login
        if ($I->loadSessionSnapshot('login')) {
            return;
        }

        // Loggin In
        $I->seeElement('#loginform');
        $I->fillField('#user_name', $username);
        $I->fillField('#user_password', $password);
        $I->click('Log In');
        $I->dontSeeElement('#loginform');

        // Saving snapshot
        $I->saveSessionSnapshot('login');
    }
}

<?php

/**
 * Inherited Methods
 * @method void wantToTest($text)
 * @method void wantTo($text)
 * @method void execute($callable)
 * @method void expectTo($prediction)
 * @method void expect($prediction)
 * @method void amGoingTo($argumentation)
 * @method void am($role)
 * @method void lookForwardTo($achieveValue)
 * @method void comment($description)
 * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
 *
 * @SuppressWarnings(PHPMD)
*/
class AcceptanceTester extends \Codeception\Actor
{
    use _generated\AcceptanceTesterActions;
   /**
    * Define custom actions here
    */

    /**
     * @param string $username
     * @param string $password
     */
    public function login($username, $password)
    {
        $I = $this;

        // Log In
        $I->seeElement('#loginform');
        $I->fillField('#user_name', $username);
        $I->fillField('#user_password', $password);
        $I->click('Log In');
        $I->dontSeeElement('#loginform');
    }

    /**
     * Clicks the logout link in the users menu
     */
    public function logout()
    {
        $tabletNavigationBar = new NavigationBar($this);
        $tabletNavigationBar->clickUserMenuItem('#logout_link');
    }
}

Add logout feature for acceptance testing


<?php

    class ValidatorUtility {

        public static function isInteger($value) {
            return filter_var($value, FILTER_VALIDATE_INT) !== false;
        }

        public static function doesFieldExist($field) {
            return ($field != null && $field != '');
        }

    }

<?php

    class ValidatorUtility {

        public static function isInteger($value) {
            return filter_var($value, FILTER_VALIDATE_INT) !== false;
        }

        public static function doesFieldExist($field) {
            if (is_null($field)) {
                return false;
            }

            if (gettype($field) == 'string' && $field === '') {
                return false;
            }

            return true;
        }

    }

Add more nuanced doesFieldExist checks

Add more nuanced doesFieldExist checks

Accounts for fields that, when filled, aren't strings.


<?php

$router->controller('template', 'Api\TemplateController');

<?php

$router->group(array('middleware' => 'auth'), function() use($router)
{
    $router->group(array('middleware' => 'permission'), function() use($router)
    {
        $router->controller('template', 'Api\TemplateController');
    });
});

Add check auth on route

Add check auth on route


<?php
class Kwc_Directories_Item_Directory_Trl_Component extends Kwc_Directories_List_Trl_Component
{
    public static function getSettings($masterComponentClass)
    {
        $ret = parent::getSettings($masterComponentClass);
        $ret['generators']['detail']['class'] = 'Kwc_Directories_Item_Directory_Trl_Generator';
        $ret['extConfig'] = 'Kwc_Directories_Item_Directory_Trl_ExtConfigEditButtons';
        return $ret;
    }

    public static function getItemDirectoryClasses($directoryClass)
    {
        return array($directoryClass);
    }
}

<?php
class Kwc_Directories_Item_Directory_Trl_Component extends Kwc_Directories_List_Trl_Component
{
    public static function getSettings($masterComponentClass)
    {
        $ret = parent::getSettings($masterComponentClass);
        $ret['generators']['detail']['class'] = 'Kwc_Directories_Item_Directory_Trl_Generator';
        $ret['extConfig'] = 'Kwc_Directories_Item_Directory_Trl_ExtConfigEditButtons';
        $ret['multiFileUpload'] = false;
        return $ret;
    }

    public static function getItemDirectoryClasses($directoryClass)
    {
        return array($directoryClass);
    }
}

Set multiupload to false for trl-component


<?php

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

namespace Sylius\Component\Product\Repository;

use Doctrine\ORM\QueryBuilder;
use Sylius\Component\Product\Model\ProductVariantInterface;
use Sylius\Component\Resource\Repository\RepositoryInterface;

/**
 * @author Łukasz Chruściel <lukasz.chrusciel@lakion.com>
 */
interface ProductVariantRepositoryInterface extends RepositoryInterface
{
    /**
     * @param mixed $productId
     *
     * @return QueryBuilder
     */
    public function createQueryBuilderByProductId($productId);
}

<?php

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

namespace Sylius\Component\Product\Repository;

use Doctrine\ORM\QueryBuilder;
use Sylius\Component\Product\Model\ProductInterface;
use Sylius\Component\Product\Model\ProductVariantInterface;
use Sylius\Component\Resource\Repository\RepositoryInterface;

/**
 * @author Łukasz Chruściel <lukasz.chrusciel@lakion.com>
 */
interface ProductVariantRepositoryInterface extends RepositoryInterface
{
    /**
     * @param mixed $productId
     *
     * @return QueryBuilder
     */
    public function createQueryBuilderByProductId($productId);

    /**
     * @param string $name
     * @param string $locale
     *
     * @return ProductVariantInterface[]
     */
    public function findByName($name, $locale);

    /**
     * @param string $name
     * @param string $locale
     * @param ProductInterface $product
     *
     * @return ProductVariantInterface[]
     */
    public function findByNameAndProduct($name, $locale, ProductInterface $product);
}

Fix failing build + adjust fixtures and variant behat setup + UPGRADE improvements


<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Support\Facades\Input;
use App\Http\Controllers\Controller;

class NewsCategoryController extends Controller
{
    public function index()
    {
        $newscategories = \App\NewsCategory::All();
        return view('admin/newscategory/index')->with('newscategories', $newscategories);
    }

    public function create()
    {
        $newscategory_cr = \App\NewsCategory::pluck('name', 'id');
        return view('admin/newscategory/create')->with('newscategory_cr', $newscategory_cr);
    }

    public function edit()
    {
        $newscategory = \App\NewsCategory::find($id);
        return view('admin/newscategory/create')->with('newscategory', $newscategory);
    }

    public function update()
    {
        $newscategory = \App\NewsCategory::find($id);
        $newscategory->update(Input::all());
        return redirect('/admin/newscategory')
        ->withSuccess('Cat has been updated.');
    }

    public function post()
    {
        \App\NewsCategory::create(Input::all());
        return redirect('/admin/newscategory')->withSuccess('Cat has been created.');
    }

    public function delete()
    {
        $newcategory = \App\NewsCategory::find($id);
        $newcategory->delete();
        return redirect('/admin/newscategory')
        ->withSuccess('News Category has been deleted.');
    }
}

<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Support\Facades\Input;
use App\Http\Controllers\Controller;

class NewsCategoryController extends Controller
{
    public function index()
    {
        $newscategories = \App\NewsCategory::All();
        return view('admin/newscategory/index')->with('newscategories', $newscategories);
    }

    public function create()
    {
        $newscategory_cr = \App\NewsCategory::pluck('name', 'id');
        return view('admin/newscategory/create')->with('newscategory_cr', $newscategory_cr);
    }

    public function edit($id)
    {
        $newscategory = \App\NewsCategory::find($id);
        return view('admin/newscategory/create')->with('newscategory', $newscategory);
    }

    public function update($id)
    {
        $newscategory = \App\NewsCategory::find($id);
        $newscategory->update(Input::all());
        return redirect('/admin/newscategory')
        ->withSuccess('Cat has been updated.');
    }

    public function post()
    {
        \App\NewsCategory::create(Input::all());
        return redirect('/admin/newscategory')->withSuccess('Cat has been created.');
    }

    public function delete($id)
    {
        $newcategory = \App\NewsCategory::find($id);
        $newcategory->delete();
        return redirect('/admin/newscategory')
        ->withSuccess('News Category has been deleted.');
    }
}

Fix feate manage news category

Fix feate manage news category


<?php

namespace Phamda\Builder;

use PhpParser\Node\Expr;

class SimpleMethodBuilder extends AbstractMethodBuilder
{
    const COMMENT_ROW_PREFIX = '     *';

    public function build()
    {
        return parent::build()->makeStatic();
    }

    protected function createComment()
    {
        $rows = explode("\n", $this->source->getDocComment());

        return implode("\n", array_merge(
            array_slice($rows, 0, 1),
            array_map(function ($row) {
                return self::COMMENT_ROW_PREFIX . ' ' . $row;
            }, (new CommentExampleBuilder($this->source))->getRows()),
            [self::COMMENT_ROW_PREFIX],
            array_slice($rows, 1)
        ));
    }
}

<?php

namespace Phamda\Builder;

use Phamda\Phamda;
use PhpParser\Node\Expr;

class SimpleMethodBuilder extends AbstractMethodBuilder
{
    const COMMENT_ROW_PREFIX = '     *';

    public function build()
    {
        return parent::build()->makeStatic();
    }

    protected function createComment()
    {
        $rows         = explode("\n", $this->source->getDocComment());
        $exampleStart = Phamda::findIndex(function ($row) { return strpos($row, '@') !== false; }, $rows);

        return implode("\n", array_merge(
            array_slice($rows, 0, $exampleStart),
            array_map(function ($row) {
                return self::COMMENT_ROW_PREFIX . ' ' . $row;
            }, (new CommentExampleBuilder($this->source))->getRows()),
            [self::COMMENT_ROW_PREFIX],
            array_slice($rows, $exampleStart)
        ));
    }
}

Add logic to handle function summaries

Add logic to handle function summaries


<?php

namespace Bolt\Storage\Field\Type;

use Bolt\Storage\QuerySet;

/**
 * This is one of a suite of basic Bolt field transformers that handles
 * the lifecycle of a field from pre-query to persist.
 *
 * @author Ross Riley <riley.ross@gmail.com>
 */
class TextType extends FieldTypeBase
{
    /**
     * {@inheritdoc}
     */
    public function persist(QuerySet $queries, $entity)
    {
        $key = $this->mapping['fieldname'];
        $value = $entity->get($key);

        // Note: The following section is commented out, because it was
        // sanitising fields when not desired. See #5789, for details.

        // Only sanitize when type is string, and not when the name is one of the Bolt-system ones.
        // Finally, we skip this if the value is empty-ish, e.g. '' or `null`.
        // if ($this->mapping['type'] === 'string' && !in_array($key, ['username', 'status']) && !empty($value)) {
        //     $entity->set($key, $this->getSanitiser()->sanitise($value));
        // }

        parent::persist($queries, $entity);
    }

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

<?php

namespace Bolt\Storage\Field\Type;

use Bolt\Storage\QuerySet;

/**
 * This is one of a suite of basic Bolt field transformers that handles
 * the lifecycle of a field from pre-query to persist.
 *
 * Note: The persist() override was removed, because it was sanitising fields
 * when not desired. See https://github.com/bolt/bolt/issues/5789 for details.
 *
 * @author Ross Riley <riley.ross@gmail.com>
 */
class TextType extends FieldTypeBase
{
    /**
     * {@inheritdoc}
     */
    public function getName()
    {
        return 'text';
    }
}

Remove unused function override and move commentary to class docblock


<?php

namespace Oro\Bundle\ActionBundle\Helper;

trait ApplicationsHelperTrait
{
    /** @var string|null */
    protected $currentApplication = false;

    /**
     * @param array $applications
     *
     * @return bool
     */
    public function isApplicationsValid(array $applications)
    {
        if (empty($applications)) {
            return true;
        }

        if ($this->currentApplication === false) {
            $this->currentApplication = $this->getCurrentApplication();
        }

        return in_array($this->currentApplication, $applications, true);
    }
}

<?php

namespace Oro\Bundle\ActionBundle\Helper;

trait ApplicationsHelperTrait
{
    /** @var string|bool|null */
    protected $currentApplication = false;

    /**
     * @param array $applications
     *
     * @return bool
     */
    public function isApplicationsValid(array $applications)
    {
        if (empty($applications)) {
            return true;
        }

        if ($this->currentApplication === false) {
            $this->currentApplication = $this->getCurrentApplication();
        }

        return in_array($this->currentApplication, $applications, true);
    }
}

BAP-12468: Update ApplicationsHelper and ActionApplicationsHelper
- CS Fixed


<?php

/**
 * Database configuration.
 *
 * @license http://opensource.org/licenses/MIT The MIT License (MIT)
 */

$db = parse_url(getenv('DATABASE_URL'));

var_dump($db);

$db_config = array(
    'driver'   => 'pdo_pgsql',
    'charset'  => 'utf8',
    'host'     => $db['host'],
    'port'     => $db['port'],
    'user'     => $db['user'],
    'password' => $db['pass'],
    'dbname'   => substr($db['path'], 1)
);

var_dump($db_config);

return $db_config;

<?php

/**
 * Database configuration.
 *
 * @license http://opensource.org/licenses/MIT The MIT License (MIT)
 */

$db = parse_url(getenv('DATABASE_URL'));

return array(
    'driver'   => 'pdo_pgsql',
    'charset'  => 'utf8',
    'host'     => $db['host'],
    'port'     => $db['port'],
    'user'     => $db['user'],
    'password' => $db['pass'],
    'dbname'   => substr($db['path'], 1)
);

Revert "Trying to debug parsing of DATABASE_URL"

This reverts commit b3b04c704f0624659cb8a444db43fa55a700ea36.


<?php
/**
 * phpDocumentor
 *
 * @category   phpDocumentor
 * @package    Tests
 * @copyright  Copyright (c) 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
 */

// add the project and its lib path to the include path
set_include_path(
  get_include_path()
  . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/../..')
  . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/../../src')
);

require_once('PHPUnit/Extensions/OutputTestCase.php');
require_once('PEAR/RunTest.php');

// include and initialize the autoloader
require_once dirname(__FILE__) . '/../../src/phpDocumentor/Bootstrap.php';
phpDocumentor_Bootstrap::createInstance()->registerAutoloader();

<?php
/**
 * phpDocumentor
 *
 * @category   phpDocumentor
 * @package    Tests
 * @copyright  Copyright (c) 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
 */

// add the project and its lib path to the include path
set_include_path(
  get_include_path()
  . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/../..')
  . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/../../src')
);

require_once('PHPUnit/Extensions/OutputTestCase.php');

// include and initialize the autoloader
require_once dirname(__FILE__) . '/../../src/phpDocumentor/Bootstrap.php';
phpDocumentor_Bootstrap::createInstance()->registerAutoloader();

Revert 1d12f38 as travis doesn't seem to have the class


<?php

namespace Surfnet\StepupMiddleware\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

/**
 * Auto-generated Migration: Please modify to your needs!
 */
class Version20180330094402 extends AbstractMigration
{
    /**
     * @param Schema $schema
     */
    public function up(Schema $schema)
    {
        // this up() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('ALTER TABLE institution_configuration_options CHANGE verify_email_option verify_email_option TINYINT(1) DEFAULT \'1\' NOT NULL');
        $this->addSql('UPDATE institution_configuration_options SET verify_email_option = 1');
    }

    /**
     * @param Schema $schema
     */
    public function down(Schema $schema)
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('ALTER TABLE institution_configuration_options CHANGE verify_email_option verify_email_option TINYINT(1) NOT NULL');
    }
}

<?php

namespace Surfnet\StepupMiddleware\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

/**
 * Auto-generated Migration: Please modify to your needs!
 */
class Version20180330094402 extends AbstractMigration
{
    /**
     * @param Schema $schema
     */
    public function up(Schema $schema)
    {
        // this up() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('ALTER TABLE institution_configuration_options CHANGE verify_email_option verify_email_option TINYINT(1) DEFAULT \'1\' NOT NULL');
    }

    /**
     * @param Schema $schema
     */
    public function down(Schema $schema)
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('ALTER TABLE institution_configuration_options CHANGE verify_email_option verify_email_option TINYINT(1) NOT NULL');
    }
}

Remove possibly risky update query

Remove possibly risky update query

While fixing a default value bug[1] for the email verification
configuration option, the additional UPDATE query in the migration
(Version20180330094402) was not removed. This is risky and not necessary
as the default value is set in the ALTER TABLE and the column is not
nullable.

This issue was identified during review of the changes described in the
associated PR. The fix for this migration was boyscouted.

See:
1. https://github.com/OpenConext/Stepup-Middleware/pull/215


<?php

require_once 'Swat/SwatException.php';

/**
 * Container for package wide static methods
 *
 * @package   Swat
 * @copyright 2005 silverorange
 * @license   http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
 */
class Swat
{
	const GETTEXT_DOMAIN = 'swat';

	function _($message)
	{
		return Swat::gettext($message);
	}

	function gettext($message)
	{
		return dgettext(Swat::GETTEXT_DOMAIN, $message);
	}

	function ngettext($singular_message, $plural_message, $number)
	{
		return dngettext(Swat::GETTEXT_DOMAIN, $singular_message, $plural_message, $number);
	}

}

?>

<?php

require_once 'Swat/SwatException.php';

/**
 * Container for package wide static methods
 *
 * @package   Swat
 * @copyright 2005 silverorange
 * @license   http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
 */
class Swat
{
	/**
	 * The gettext domain for Swat
	 *
	 * This is used to support multiple locales.
	 */
	const GETTEXT_DOMAIN = 'swat';

	/**
	 * Translates a phrase
	 *
	 * This is an alias for {@link Swat::gettext()}.
	 *
	 * @param string $message the phrase to be translated.
	 *
	 * @return string the translated phrase.
	 */
	public static function _($message)
	{
		return Swat::gettext($message);
	}

	/**
	 * Translates a phrase
	 *
	 * This method relies on the php gettext extension and uses dgettext()
	 * internally.
	 *
	 * @param string $message the phrase to be translated.
	 *
	 * @return string the translated phrase.
	 */
	public static function gettext($message)
	{
		return dgettext(Swat::GETTEXT_DOMAIN, $message);
	}

	/**
	 * Translates a plural phrase
	 *
	 * This method should be used when a phrase depends on a number. For
	 * example, use ngettext when translating a dynamic phrase like:
	 *
	 * - "There is 1 new item" for 1 item and
	 * - "There are 2 new items" for 2 or more items.
	 *
	 * This method relies on the php gettext extension and uses dngettext()
	 * internally.
	 *
	 * @param string $singular_message the message to use when the number the
	 *                                  phrase depends on is one.
	 * @param string $plural_message the message to use when the number the
	 *                                phrase depends on is more than one.
	 * @param integer $number the number the phrase depends on.
	 *
	 * @return string the translated phrase.
	 */
	public static function ngettext($singular_message, $plural_message, $number)
	{
		return dngettext(Swat::GETTEXT_DOMAIN,
			$singular_message, $plural_message, $number);
	}
}

?>

Clean up and document this class.
- Added scope and static modifiers to method definitions.
- Added documentation
- Wrapped lines at 80 chars.

svn commit r1717


<fieldset class="personalblock">
	<legend><?php p($l->t('Mozilla Sync')); ?></legend>

        <?php p($l->t('Email'));?>
        <?php p($_['email']);?>

        <?php p($l->t('Password'));?>
        <?php p($l->t('Use your ownCloud account password'));?>

        <?php p($l->t('Server address'));?>
        <?php p($_['syncaddress']);?>

    <?php p($l->t("Once set up, additional devices can be added via Mozilla's device pairing service or manually."));?>
</fieldset>

Remove bold from table and add nbsp for table spacing


<?php
list($entity, $name) = Chalk\traverse_name($entity, $name);
?>
<?php if (isset($entity->{"{$name}Date"})) { ?>
    <?= $entity->{"{$name}Date"}->diffForHumans() ?>
<?php } else { ?>
    —
<?php } ?>

<?php
list($entity, $name) = Chalk\traverse_name($entity, $name);
?>
<?php if (isset($entity->{"{$name}Date"})) { ?>
    <? if (isset($format)) { ?>
        <?= $entity->{"{$name}Date"}->format($format) ?>
    <? } else { ?>
        <?= $entity->{"{$name}Date"}->diffForHumans() ?>
    <? } ?>
<?php } else { ?>
    —
<?php } ?>

Allow custom date formatting in list table date


<?php

namespace AppBundle\Repository;

use AppBundle\Entity\FennecUser;
use Doctrine\ORM\EntityRepository;

/**
 * WebuserDataRepository
 *
 * This class was generated by the PhpStorm "Php Annotations" Plugin. Add your own custom
 * repository methods below.
 */
class WebuserDataRepository extends EntityRepository
{
    public function getNumberOfProjects(FennecUser $user = null): int{
        if ($user === null) {
            return 0;
        }

        return $this->findBy(['webuser' => $user])->count();
    }
}

<?php

namespace AppBundle\Repository;

use AppBundle\Entity\FennecUser;
use Doctrine\ORM\EntityRepository;

/**
 * WebuserDataRepository
 *
 * This class was generated by the PhpStorm "Php Annotations" Plugin. Add your own custom
 * repository methods below.
 */
class WebuserDataRepository extends EntityRepository
{
    public function getNumberOfProjects(FennecUser $user = null): int{
        if ($user === null) {
            return 0;
        }

        return count($this->findBy(['webuser' => $user]));
    }
}

Fix wrong call of count method

Fix wrong call of count method


<?php namespace Omnipay\Elavon\Message;

use Omnipay\Tests\TestCase;

class ConvergeGenerateTokenRequestTest extends TestCase
{
    public function setUp()
    {
        $this->request = new ConvergeGenerateTokenRequest($this->getHttpClient(), $this->getHttpRequest());
        $this->request->initialize(
            array(
                'card' => $this->getValidCard(),
                'ssl_show_form' => 'false',
                'ssl_result_format' => 'ASCII',
            )
        );
    }

    public function testCreateCardSuccess()
    {
        $this->setMockHttpResponse('ConvergeCreateCardResponse.txt');
        $response = $this->request->send();
        $this->assertTrue($response->isSuccessful());
        $this->assertSame('7595301425001111', $response->getCardToken());
    }

}

<?php namespace Omnipay\Elavon\Message;

use Omnipay\Tests\TestCase;

class ConvergeGenerateTokenRequestTest extends TestCase
{
    public function setUp()
    {
        $this->request = new ConvergeGenerateTokenRequest($this->getHttpClient(), $this->getHttpRequest());
        $this->request->initialize(
            array(
                'card' => $this->getValidCard(),
                'ssl_show_form' => 'false',
                'ssl_result_format' => 'ASCII',
            )
        );
    }

    public function testCreateCardSuccess()
    {
        $this->setMockHttpResponse('ConvergeCreateCardResponse.txt');
        $response = $this->request->send();
        $this->assertTrue($response->isSuccessful());
        $this->assertSame('7595301425001111', $response->getCardReference());
    }

}

Test coverage on added function

Test coverage on added function


<?php namespace Orchestra\Resources;

use Illuminate\Support\ServiceProvider;
use Illuminate\Foundation\AliasLoader;

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

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->app->bindShared('orchestra.resources', function ($app) {
            $dispatcher = new Dispatcher($app, $app['router'], $app['request']);
            $response   = new Response($app);

            return new Environment($app, $dispatcher, $response);
        });

        $this->app->booting(function () {
            $loader = AliasLoader::getInstance();
            $loader->alias('Orchestra\Resources', 'Orchestra\Support\Facades\Resources');
        });
    }

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

<?php namespace Orchestra\Resources;

use Illuminate\Support\ServiceProvider;
use Illuminate\Foundation\AliasLoader;

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

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->app->bindShared('orchestra.resources', function ($app) {
            $dispatcher = new Dispatcher($app, $app['router'], $app['request']);
            $response   = new Response($app);

            return new Environment($app, $dispatcher, $response);
        });
    }

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

Remove alias from service provider.

Remove alias from service provider.

Signed-off-by: Mior Muhammad Zaki <e1a543840a942eb68427510a8a483282a7bfeddf@gmail.com>


<?php

namespace MeadSteve\Console;

use MeadSteve\Console\Exceptions\ExecutionError;
use MeadSteve\Console\Exceptions\CommandNotFoundError;

class Executor
{
    const RESULT_CODE_COMMAND_NOT_FOUND = 127;

    /**
     * Calls command using exec(). On less than zero response code an
     * exception will be thrown.
     *
     * @param $command
     * @return array output of command.
     * @throws Exceptions\ExecutionError|Exceptions\CommandNotFoundError
     */
    function execute($command) {
        $output = array();
        $result = null;

        // Redirect standard error to stdout so we can do something with
        // it.
        $command .= " 2>&1";

        exec($command, $output, $result);

        if ($result !== 0) {
            if ($result === self::RESULT_CODE_COMMAND_NOT_FOUND) {
                throw new CommandNotFoundError(implode("\t", $output));
            }
            else {
                throw new ExecutionError(implode("\t", $output));
            }
        }
        return $output;
    }
}

<?php

namespace MeadSteve\Console;

use MeadSteve\Console\Exceptions\ExecutionError;
use MeadSteve\Console\Exceptions\CommandNotFoundError;

class Executor
{
    const RESULT_CODE_COMMAND_NOT_FOUND = 127;

    /**
     * Calls command using exec(). On less than zero response code an
     * exception will be thrown.
     *
     * @param $command
     * @return array output of command.
     * @throws Exceptions\ExecutionError|Exceptions\CommandNotFoundError
     */
    function execute($command) {
        $output = array();
        $result = null;

        // Redirect standard error to stdout so we can do something with
        // it.
        $command .= " 2>&1";

        exec($command, $output, $result);

        if ($result !== 0) {
            if ($result === self::RESULT_CODE_COMMAND_NOT_FOUND) {
                throw new CommandNotFoundError(implode("\t", $output), $result);
            }
            else {
                throw new ExecutionError(implode("\t", $output), $result);
            }
        }
        return $output;
    }
}

Add response codes to exceptions.

Add response codes to exceptions.


<?php

use Heystack\Subsystem\Core\ServiceStore;

class PricingDecorator extends DataObjectDecorator
{

    public function extraStatics()
    {

        $db = array();

        $currencyService = ServiceStore::getService(\Heystack\Subsystem\Ecommerce\Services::CURRENCY_SERVICE);

        foreach ($currencyService->getCurrencies() as $currency) {

            $db[$currency->getCurrencyCode()."Price"] = 'Decimal(10, 2)';

        }

        return array(
            'db' => $db
        );

    }

    public function updateCMSFields(\FieldSet &$fields)
    {

        $currencyService = ServiceStore::getService(\Heystack\Subsystem\Ecommerce\Services::CURRENCY_SERVICE);

        foreach ($currencyService->getCurrencies() as $currency) {

            $currencyCode = $currency->getCurrencyCode();

            $fields->removeByName($currencyCode . "Price");

            $fields->addFieldToTab('Root.Prices', new NumericField($currencyCode."Price", $currencyCode . " Price"));

        }

        return $fields;
    }

}

<?php

use Heystack\Subsystem\Core\ServiceStore;
use Heystack\Subsystem\Ecommerce\Currency\CurrencyService;

class PricingDecorator extends DataObjectDecorator
{

    public function extraStatics()
    {

        $db = array();

        $currencyService = ServiceStore::getService(\Heystack\Subsystem\Ecommerce\Services::CURRENCY_SERVICE);

        if ($currencyService instanceof CurrencyService) {

            foreach ($currencyService->getCurrencies() as $currency) {

                $db[$currency->getCurrencyCode()."Price"] = 'Decimal(10, 2)';

            }

        }

        return array(
            'db' => $db
        );

    }

    public function updateCMSFields(\FieldSet &$fields)
    {

        $currencyService = ServiceStore::getService(\Heystack\Subsystem\Ecommerce\Services::CURRENCY_SERVICE);

        foreach ($currencyService->getCurrencies() as $currency) {

            $currencyCode = $currency->getCurrencyCode();

            $fields->removeByName($currencyCode . "Price");

            $fields->addFieldToTab('Root.Prices', new NumericField($currencyCode."Price", $currencyCode . " Price"));

        }

        return $fields;
    }

}

UPDATE: Fix issue where currency service isn't on the container


<?php namespace Modules\Media\Image;

use Illuminate\Contracts\Config\Repository;

class ThumbnailsManager
{
    /**
     * @var Module
     */
    private $module;
    /**
     * @var Repository
     */
    private $config;

    /**
     * @param Repository $config
     */
    public function __construct(Repository $config)
    {
        $this->module = app('modules');
        $this->config = $config;
    }

    /**
     * Return all thumbnails for all modules
     * @return array
     */
    public function all()
    {
        $thumbnails = [];
        foreach ($this->module->enabled() as $enabledModule) {
            $configuration = $this->config->get(strtolower('asgard.' . $enabledModule->getName()) . '.thumbnails');
            if (!is_null($configuration)) {
                $thumbnails = array_merge($thumbnails, $configuration);
            }
        }

        return $thumbnails;
    }

    /**
     * Find the filters for the given thumbnail
     * @param $thumbnail
     */
    public function find($thumbnail)
    {
        foreach ($this->all() as $thumbName => $filters) {
            if ($thumbName == $thumbnail) {
                return $filters;
            }
        }
    }
}

<?php namespace Modules\Media\Image;

use Illuminate\Contracts\Config\Repository;

class ThumbnailsManager
{
    /**
     * @var Module
     */
    private $module;
    /**
     * @var Repository
     */
    private $config;

    /**
     * @param Repository $config
     */
    public function __construct(Repository $config)
    {
        $this->module = app('modules');
        $this->config = $config;
    }

    /**
     * Return all thumbnails for all modules
     * @return array
     */
    public function all()
    {
        $thumbnails = [];
        foreach ($this->module->enabled() as $enabledModule) {
            $configuration = $this->config->get(strtolower('asgard.' . $enabledModule->getName()) . '.thumbnails');
            if (!is_null($configuration)) {
                $thumbnails = array_merge($thumbnails, $configuration);
            }
        }

        return $thumbnails;
    }

    /**
     * Find the filters for the given thumbnail
     * @param $thumbnail
     * @return array
     */
    public function find($thumbnail)
    {
        foreach ($this->all() as $thumbName => $filters) {
            if ($thumbName == $thumbnail) {
                return $filters;
            }
        }

        return [];
    }
}

Return empty array if none found

Return empty array if none found


<?php

namespace CultuurNet\UDB3\Event;

use Broadway\CommandHandling\Testing\CommandHandlerScenarioTestCase;
use Broadway\EventStore\EventStoreInterface;
use Broadway\EventHandling\EventBusInterface;

class EventTaggerTest extends CommandHandlerScenarioTestCase
{
    protected function createCommandHandler(
        EventStoreInterface $eventStore,
        EventBusInterface $eventBus
    ) {
        $repository = new EventRepository($eventStore, $eventBus);

        return new EventCommandHandler($repository);
    }

    /**
     * @test
     */
    public function it_can_tag_a_list_of_events_with_a_keyword()
    {
        $ids = ['eventId1', 'eventId2'];
        $keyword = 'awesome';

        $this->scenario
            ->withAggregateId($ids[0])
            ->given(
                [
                    new EventCreated($ids[0])
                ]
            )
            ->withAggregateId($ids[1])
            ->given(
                [
                    new EventCreated($ids[1])
                ]
            )
            ->when(new TagEvents($ids, $keyword))
            ->then(
                [
                    new EventWasTagged($ids[0], $keyword),
                    new EventWasTagged($ids[1], $keyword)
                ]
            );
    }
}

<?php

namespace CultuurNet\UDB3\Event;

use Broadway\CommandHandling\Testing\CommandHandlerScenarioTestCase;
use Broadway\EventStore\EventStoreInterface;
use Broadway\EventHandling\EventBusInterface;

class EventTaggerTest extends CommandHandlerScenarioTestCase
{
    protected function createCommandHandler(
        EventStoreInterface $eventStore,
        EventBusInterface $eventBus
    ) {
        $repository = new EventRepository(
            $eventStore,
            $eventBus,
            $this->getMock('\\CultuurNet\\UDB3\\SearchAPI2\\SearchServiceInterface')
        );

        return new EventCommandHandler($repository);
    }

    /**
     * @test
     */
    public function it_can_tag_a_list_of_events_with_a_keyword()
    {
        $ids = ['eventId1', 'eventId2'];
        $keyword = 'awesome';

        $this->scenario
            ->withAggregateId($ids[0])
            ->given(
                [
                    new EventCreated($ids[0])
                ]
            )
            ->withAggregateId($ids[1])
            ->given(
                [
                    new EventCreated($ids[1])
                ]
            )
            ->when(new TagEvents($ids, $keyword))
            ->then(
                [
                    new EventWasTagged($ids[0], $keyword),
                    new EventWasTagged($ids[1], $keyword)
                ]
            );
    }
}

Fix missing new dependency in event tagger test


		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta name="description" content="">
		<meta name="author" content="">
		<link rel="shortcut icon" href="/favicon.ico">

		<title>R/a/dio</title>

		<!-- Bootstrap Core CSS
			==================== -->
		<link href="{{ $base }}/css/bootstrap.css" rel="stylesheet">
		<link href="{{ $base }}/css/fonts.css" rel="stylesheet">

		<link href="{{ $base }}/css/base.css" rel="stylesheet">

		<!-- DJ Theme -->
		<link href="{{ $base }}/css/{{ $theme }}.css" rel="stylesheet">

		<!-- IE7-9 are not supported in any way by this site.
			They can all die in a fire. (IE10 + 11, however, live)
			======================================================= -->

		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta name="description" content="">
		<meta name="author" content="">
		<link rel="shortcut icon" href="{{ $base }}/favicon.ico">

		<title>R/a/dio</title>

		<!-- Bootstrap Core CSS
			==================== -->
		<link href="{{ $base }}/css/bootstrap.min.css" rel="stylesheet">

		<!-- Source Sans Pro -->
		<link href="{{ $base }}/css/fonts.css" rel="stylesheet">

		<!-- FontAwesome -->
		<link href="{{ $base }}/css/font-awesome.min.css" rel="stylesheet">

		<!-- Base CSS -->
		<link href="{{ $base }}/css/base.css" rel="stylesheet">

		<!-- DJ Theme -->
		<link href="{{ $base }}/css/{{ $theme }}.css" rel="stylesheet">

		<!-- IE7-9 are not supported in any way by this site.
			They can all die in a fire. (IE10 + 11, however, live)
			======================================================= -->

Add font-awesome links to <head>

Add font-awesome links to <head>


<?php

namespace Bundle\GravatarBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle as BaseBundle;

class GravatarBundle extends BaseBundle
{
}

<?php

namespace Bundle\GravatarBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle as BaseBundle;

class GravatarBundle extends BaseBundle
{
    public function getNamespace()
    {
        return __NAMESPACE__;
    }

    public function getPath()
    {
        return __DIR__;
    }
}

Implement two new bundle interface methods


<?php

namespace fennecweb\ajax\details;

use \PDO as PDO;

/**
 * Web Service.
 * Returns a project according to the project ID.
 */
class Projects extends \fennecweb\WebService
{
    /**
    * @param $querydata[]
    * @returns Array $result
    * <code>
    * array('project_id': {biomfile});
    * </code>
    */
    public function execute($querydata)
    {
        $db = $this->openDbConnection($querydata);
        $result = array('projects' => array());
        $ids = $querydata['ids'];
        $placeholders = implode(',', array_fill(0, count($ids), '?'));
        if (!isset($_SESSION)) {
            session_start();
        }
        $query_get_project_details = <<<EOF
SELECT webuser_data_id, project FROM full_webuser_data
    WHERE provider = ? AND oauth_id = ? AND webuser_data_id IN ($placeholders)
EOF;
        $stm_get_project_details = $db->prepare($query_get_project_details);
        $stm_get_project_details->execute(
            array_merge(array($_SESSION['user']['provider'], $_SESSION['user']['id']), $ids)
        );

        while ($row = $stm_get_project_details->fetch(PDO::FETCH_ASSOC)) {
            $result['projects'][$row['webuser_data_id']] = $row['project'];
        }
        return $result;
    }
}

<?php

namespace fennecweb\ajax\details;

use \PDO as PDO;

/**
 * Web Service.
 * Returns a project according to the project ID.
 */
class Projects extends \fennecweb\WebService
{
    /**
    * @param $querydata[]
    * @returns Array $result
    * <code>
    * array('project_id': {biomfile});
    * </code>
    */
    public function execute($querydata)
    {
        $db = $this->openDbConnection($querydata);
        $result = array('projects' => array());
        $ids = $querydata['ids'];
        $placeholders = implode(',', array_fill(0, count($ids), '?'));
        if (!isset($_SESSION)) {
            session_start();
        }
        if (!isset($_SESSION['user'])) {
            $result['error'] = \fennecweb\ajax\listing\Projects::ERROR_NOT_LOGGED_IN;
        } else {
            $query_get_project_details = <<<EOF
SELECT webuser_data_id, project FROM full_webuser_data
    WHERE provider = ? AND oauth_id = ? AND webuser_data_id IN ($placeholders)
EOF;
            $stm_get_project_details = $db->prepare($query_get_project_details);
            $stm_get_project_details->execute(
                array_merge(array($_SESSION['user']['provider'], $_SESSION['user']['id']), $ids)
            );

            while ($row = $stm_get_project_details->fetch(PDO::FETCH_ASSOC)) {
                $result['projects'][$row['webuser_data_id']] = $row['project'];
            }
        }
        return $result;
    }
}

Return error if user is not logged in

Return error if user is not logged in


<?php
/**
 * The configuration file for RG2.
 *
 * This file should be modified to set up the details for a specific Routegadget installation.
 *
 */
  // Location of directory where Routegadget is installed.
  // This should have /cgi-bin, /kartat and /rg2 sub-directories.
  // Example define('RG_BASE_DIRECTORY', 'http://www.happyherts.routegadget.co.uk');
  //define('RG_BASE_DIRECTORY', 'C:/xampp/htdocs/HHRoutegadget');
  define('RG_BASE_DIRECTORY', 'http://www.happyherts.routegadget.co.uk');

  //
  // Set encoding for data
  define('RG_INPUT_ENCODING', 'ISO-8859-1');
  define('RG_OUTPUT_ENCODING', 'UTF-8');

  // User interface colour theme: see gallery at http://jqueryui.com/themeroller/
  // Example define('UI_THEME', 'excite-bike');
  define('UI_THEME', 'excite-bike');

  // text to display in footer. Use '' to leave blank.
	define('FOOTER_TEXT', '© Maprunner 2013. Maps published on this web site that contain OS data by permission of Ordnance Survey® Licence Number 100046745.');

?>

<?php
/**
 * The configuration file for RG2.
 *
 * This file should be modified to set up the details for a specific Routegadget installation.
 *
 */
  // Location of directory where Routegadget is installed.
  // This should have /cgi-bin, /kartat and /rg2 sub-directories.
  // Example define('RG_BASE_DIRECTORY', 'http://www.happyherts.routegadget.co.uk');
  //define('RG_BASE_DIRECTORY', 'C:/xampp/htdocs/HHRoutegadget');
  define('RG_BASE_DIRECTORY', 'http://www.happyherts.routegadget.co.uk');

  //
  // Set encoding for input data default UTF-8
  define('RG_INPUT_ENCODING', 'UTF-8');
  //
  // Set encoding for output data returned throug API
  define('RG_OUTPUT_ENCODING', 'UTF-8');

  // User interface colour theme: see gallery at http://jqueryui.com/themeroller/
  // Example define('UI_THEME', 'excite-bike');
  define('UI_THEME', 'excite-bike');

  // text to display in footer. Use '' to leave blank.
	define('FOOTER_TEXT', '© Maprunner 2013. Maps published on this web site that contain OS data by permission of Ordnance Survey® Licence Number 100046745.');

?>

Set default input to UTF-8 to prevent breaking the working installations.


<?php
namespace inklabs\kommerce\Entity;

class UserTokenTest extends \PHPUnit_Framework_TestCase
{
    public function setUp()
    {
        $this->userToken = new UserToken;
        $this->userToken->setUserAgent('XXX');
        $this->userToken->setToken('XXX');
        $this->userToken->setType('XXX');
        $this->userToken->setExpires(null);
    }

    public function testGetter()
    {
        $this->assertEquals(null, $this->userToken->getId());
        $this->assertEquals('XXX', $this->userToken->getUserAgent());
        $this->assertEquals('XXX', $this->userToken->getToken());
        $this->assertEquals('XXX', $this->userToken->getType());
        $this->assertEquals(null, $this->userToken->getExpires());
    }
}

<?php
namespace inklabs\kommerce\Entity;

class UserTokenTest extends \PHPUnit_Framework_TestCase
{
    public function testCreate()
    {
        $userToken = new UserToken;
        $userToken->setUserAgent('UserAgent');
        $userToken->setToken('token');
        $userToken->setType('type');
        $userToken->setExpires(null);

        $this->assertEquals(null, $userToken->getId());
        $this->assertEquals('UserAgent', $userToken->getUserAgent());
        $this->assertEquals('token', $userToken->getToken());
        $this->assertEquals('type', $userToken->getType());
        $this->assertEquals(null, $userToken->getExpires());
    }
}

Reorganize for 100% for UserToken.

Reorganize for 100% for UserToken.


<a class="url summary" href="<?php echo $frontend->getEventURL($context->getRawObject()) ?>">
    <?php echo $savvy->dbStringtoHtml($context->event->title) ?>

Use heading for event summary line

Use heading for event summary line


<?= t('Add group member to "%s"', $group['name']) ?>

<?php if (empty($users)): ?>

<?= t('There is no user available.') ?>

<?php else: ?>
    <form method="post" action="<?= $this->url->href('GroupListController', 'addUser', array('group_id' => $group['id'])) ?>" autocomplete="off">
        <?= $this->form->csrf() ?>
        <?= $this->form->hidden('group_id', $values) ?>

        <?= $this->form->label(t('User'), 'user_id') ?>
        <?= $this->app->component('select-dropdown-autocomplete', array(
            'name' => 'user_id',
            'items' => $users,
            'defaultValue' => isset($values['user_id']) ? $values['user_id'] : null,
        )) ?>

        <?= $this->modal->submitButtons() ?>
    </form>
<?php endif ?>

<?= t('Add group member to "%s"', $group['name']) ?>

<?php if (empty($users)): ?>

<?= t('There is no user available.') ?>

        <?= $this->url->link(t('Close this window'), 'GroupListController', 'index', array(), false, 'btn js-modal-close') ?>

<?php else: ?>
    <form method="post" action="<?= $this->url->href('GroupListController', 'addUser', array('group_id' => $group['id'])) ?>" autocomplete="off">
        <?= $this->form->csrf() ?>
        <?= $this->form->hidden('group_id', $values) ?>

        <?= $this->form->label(t('User'), 'user_id') ?>
        <?= $this->app->component('select-dropdown-autocomplete', array(
            'name' => 'user_id',
            'items' => $users,
            'defaultValue' => isset($values['user_id']) ? $values['user_id'] : key($users),
        )) ?>

        <?= $this->modal->submitButtons() ?>
    </form>
<?php endif ?>

Fix wrong default value for add group member modal


<?php declare(strict_types = 1);

assert(
    (int)phpversion()[0] >= 7,
    'Phan requires PHP version 7 or greater. See https://github.com/phan/phan#getting-it-running for more details.'
);

assert(
    file_exists(__DIR__ . '/../vendor/autoload.php') || file_exists(__DIR__ . '/../../../autoload.php'),
    'Autoloader not found. Make sure you run `composer install` before running Phan. See https://github.com/phan/phan#getting-it-running for more details.'
);

// Automatically restart if xdebug is loaded
if (extension_loaded('xdebug')) {
    require_once __DIR__ . '/Phan/Library/Composer/XdebugHandler.php';
    require_once __DIR__ . '/Phan/Library/Composer/IniHelper.php';
    // This code is taken from composer's automatic restart without xdebug.
    // Restart if xdebug is loading, unless the environment variable PHAN_ALLOW_XDEBUG is set.
    (new \Phan\Library\Composer\XdebugHandler())->check();
}

// Fix turkish locales(tr_TR) - strtolower('I') is not 'i', so phan lookup might fail.
// (But continue formatting times, etc. in the user's locale)
setlocale(LC_CTYPE, 'C');

Add a fix for strtolower() being different in tr_TR locale


<?php
use Illuminate\Database\Seeder;
use App\Models\CustomField;

class CustomFieldSeeder extends Seeder
{
  public function run()
  {
      CustomField::truncate();

  }
}

<?php
use Illuminate\Database\Seeder;
use App\Models\CustomField;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;

class CustomFieldSeeder extends Seeder
{
  public function run()
  {
      $columns = DB::getSchemaBuilder()->getColumnListing('assets');

          foreach ($columns as $column) {
              if(strpos($column, '_snipeit_') !== FALSE) {

                  Schema::table('assets', function (Blueprint $table) use ($column) {
                      $table->dropColumn($column);
                  });
              }
          }
      CustomField::truncate();
      factory(CustomField::class, 4)->create();

  }
}

Fix custom field seeder to drop old columns


<?php

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

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

session_start();

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

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

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

?>

<?php

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

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

session_start();

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

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

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

?>

Make login the default view

Make login the default view

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


<?php

$path = 'sample-dir';

function getPathType($path) {
    if ( is_file($path)) {
        return 'file';
    } else if (is_link($path)) {
        return 'link';
    } else if (is_dir($path)) {
        return 'dir';
    }

    return "Unknown";
}

function directoryToArray( $path, $fullPath, &$parentArray ) {

    $parentArray[$path] = [];

    $parentArray[$path]['-type'] = getPathType($fullPath);
    $parentArray[$path]['-path'] = $fullPath;

    // If it was a file, put the contents
    if (is_file($fullPath)) {
        $parentArray[$path]['content'] = file_get_contents($fullPath);
    }

    $handle = opendir($fullPath);

    while($content = readdir($handle)) {

        if ( $content == '.' || $content == '..') {
            continue;
        }

        directoryToArray($content, $fullPath . '/' .$content, $parentArray[$path]);
    };
}

$array = [];
directoryToArray($path, $path, $array);
echo "<pre>";
print_r($array);

<?php

$path = 'sample-dir';

function getPathType($path) {
    if ( is_file($path)) {
        return 'file';
    } else if (is_link($path)) {
        return 'link';
    } else if (is_dir($path)) {
        return 'dir';
    }

    return "Unknown";
}

function directoryToArray( $path, $fullPath, &$parentArray ) {

    $parentArray[$path] = [];

    $parentArray[$path]['-name'] = $path;
    $parentArray[$path]['-type'] = getPathType($fullPath);
    $parentArray[$path]['-path'] = $fullPath;
    $parentArray[$path]['-filesize'] = filesize($fullPath);
    $parentArray[$path]['-mode'] = substr(sprintf('%o', fileperms($fullPath)), -4);
    $parentArray[$path]['-owner'] = posix_getpwuid(fileowner($fullPath));
    $parentArray[$path]['-last_modified'] = date('Y-m-d H:i:s', filemtime($fullPath));
    $parentArray[$path]['-group'] = posix_getgrgid(filegroup($fullPath));

    // If it was a file, put the contents
    if (is_file($fullPath)) {
        $parentArray[$path]['content'] = file_get_contents($fullPath);
    }

    $handle = opendir($fullPath);

    while($content = readdir($handle)) {

        if ( $content == '.' || $content == '..') {
            continue;
        }

        directoryToArray($content, $fullPath . '/' .$content, $parentArray[$path]);
    };
}

$array = [];
directoryToArray($path, $path, $array);
echo "<pre>";
print_r($array);

Add more details to the directory

Add more details to the directory


{{--
    $breadcrumbs => array // ['display_name', 'relative_url']
--}}

        @foreach($breadcrumbs as $key=>$crumb)
            @if($key == 0)

                    @svg('home', 'w-4 h-4 inline align-baseline')

            @elseif($key == (count($breadcrumbs) - 1))

                    {{ $crumb['display_name'] }}
            @else

                {{ $crumb['display_name'] }}

            @endif

        @endforeach

Change the case to match the actual ID value


<?php

/*
 * This file is part of the build-tools-lib package.
 *
 * (c) Javi H. Gil <https://github.com/javihgil>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Task;

/**
 * Interface ActionTaskInterface
 *
 * @package  Task
 * @author   Javi H. Gil <https://github.com/javihgil>
 */
interface ActionTaskInterface
{
    /**
     * @return string
     */
    public function getAction();

    /**
     * @param string $action
     * @return $this
     */
    public function setAction($action);
}

<?php

/*
 * This file is part of the build-tools-lib package.
 *
 * (c) Javi H. Gil <https://github.com/javihgil>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Task;

/**
 * Interface ActionTaskInterface
 *
 * @package  Task
 * @author   Javi H. Gil <https://github.com/javihgil>
 */
interface ActionTaskInterface
{
    /**
     * @return string
     */
    public function getAction();

    /**
     * @param string $action
     */
    public function setAction($action);
}

Fix action task interface docblock

Fix action task interface docblock


<?php if(isset($_SESSION['user'])) { ?>

			Logout

<?php } else { ?>

			Log in

			Register

<?php } ?>

<?php if(isset($_SESSION['user'])) { ?>
	<?php
		$url = $_SERVER['REQUEST_URI'];
		if(!strpos($url, 'options.php')) {
	?>

				Options

	<?php
		} else {
	?>

				Home

	<?php } ?>

		|

			Logout

<?php } else { ?>

			Register

		|

			Log in

<?php } ?>

Change the singin to change the options depending on the page.


<?php
    require_once __DIR__ . "/../class/autoload.php";

    use \html\Page as Page;
    use \html\AdministratorMenu as AdministratorMenu;
    use \html\Forms as Forms;
    use \configuration\Globals as Globals;
    use \utilities\Session as Session;

    Page::startHeader("Editar Página");
    Page::styleSheet("user");
    Page::styleSheet("form");
    echo "";
    Page::closeHeader();

    $session = new Session();
    $session->verifyIfSessionIsStarted();

    $menu = new AdministratorMenu();
    $menu->construct();
?>

Edição de Página

      <form action="<?php echo PROJECT_ROOT;?>controller/updatePage.php" method="POST">
        <fieldset>
            <?php Forms::updatePageForm($_GET['pages']); ?>
        </fieldset>
        <input type="hidden" value="<?php echo $_GET['pages']?>" id="page_code">
        <input type="submit" value="Atualizar">
      </form>

<?php
    Page::footer();
    Page::closeBody();
?>

<?php
    require_once __DIR__ . "/../class/autoload.php";

    use \html\Page as Page;
    use \html\AdministratorMenu as AdministratorMenu;
    use \html\Forms as Forms;
    use \configuration\Globals as Globals;
    use \utilities\Session as Session;

    Page::startHeader("Editar Página");
    Page::styleSheet("user");
    Page::styleSheet("form");
    echo "";
    Page::closeHeader();

    $session = new Session();
    $session->verifyIfSessionIsStarted();

    $menu = new AdministratorMenu();
    $menu->construct();
?>

Edição de Página

      <form action="<?php echo PROJECT_ROOT;?>controller/updatePage.php" method="POST" enctype="multipart/form-data">
        <fieldset>
            <?php Forms::updatePageForm($_GET['pages']); ?>
        </fieldset>
        <input type="hidden" value="<?php echo $_GET['pages']?>" id="page_code">
        <input type="submit" value="Atualizar">
      </form>

<?php
    Page::footer();
    Page::closeBody();
?>

Fix problems to update image of publication


<?php

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

class AlterUserTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        if (Schema::hasTable('users')) {
            if (!Schema::hasColumn('users', 'username')) {
                Schema::table('users', function (Blueprint $table) {
                    $table->string('username')->after('email');
                    $table->unique('username');
                });
            }
        }
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        //
    }
}

<?php

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

class AlterUserTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        if (Schema::hasTable('users')) {
            if (!Schema::hasColumn('users', 'username')) {
                Schema::table('users', function (Blueprint $table) {
                    $table->string('username');

                    $table->unique('username');
                });
            }
        }
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        //
    }
}

Remove after column for SQL lite compatibility


<?php

namespace Frontend\Modules\Profiles\Actions;

/*
 * This file is part of Fork CMS.
 *
 * For the full copyright and license information, please view the license
 * file that was distributed with this source code.
 */

use Frontend\Core\Engine\Base\Block as FrontendBaseBlock;
use Frontend\Modules\Profiles\Engine\Authentication as FrontendProfilesAuthentication;

/**
 * This is the logout-action.
 */
class Logout extends FrontendBaseBlock
{
    public function execute(): void
    {
        // logout
        if (FrontendProfilesAuthentication::isLoggedIn()) {
            FrontendProfilesAuthentication::logout();
        }

        // redirect
        $this->redirect(SITE_URL);
    }
}

<?php

namespace Frontend\Modules\Profiles\Actions;

/*
 * This file is part of Fork CMS.
 *
 * For the full copyright and license information, please view the license
 * file that was distributed with this source code.
 */

use Frontend\Core\Engine\Base\Block as FrontendBaseBlock;
use Frontend\Modules\Profiles\Engine\Authentication as FrontendProfilesAuthentication;

class Logout extends FrontendBaseBlock
{
    public function execute(): void
    {
        if (FrontendProfilesAuthentication::isLoggedIn()) {
            FrontendProfilesAuthentication::logout();
        }

        $this->redirect(SITE_URL);
    }
}

Clean up the logout action

Clean up the logout action


<?php

namespace OpenDominion;

use Illuminate\Foundation\Application as LaravelApplication;

class Application extends LaravelApplication
{
    protected $appPath;

    public function __construct($basePath)
    {
        parent::__construct($basePath);

        $this->appPath = ($this->basePath() . DIRECTORY_SEPARATOR . 'app');
        $this->bindPathsInContainer();

        define('ARTISAN_BINARY', 'bin/artisan');
    }

    public function path($path = '')
    {
        return ($this->basePath . DIRECTORY_SEPARATOR . 'src');
    }

    public function bootstrapPath($path = '')
    {
        return ($this->appPath . DIRECTORY_SEPARATOR . 'bootstrap');
    }

    public function configPath($path = '')
    {
        return ($this->appPath . DIRECTORY_SEPARATOR . 'config');
    }

    public function databasePath($path = '')
    {
        return ($this->appPath . DIRECTORY_SEPARATOR . 'database');
    }

    public function langPath()
    {
        return ($this->appPath . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'lang');
    }

    public function storagePath()
    {
        return ($this->appPath . DIRECTORY_SEPARATOR . 'storage');
    }
}

<?php

namespace OpenDominion;

use Illuminate\Foundation\Application as LaravelApplication;

class Application extends LaravelApplication
{
    protected $appPath;

    public function __construct($basePath)
    {
        parent::__construct($basePath);

        $this->appPath = ($this->basePath() . DIRECTORY_SEPARATOR . 'app');
        $this->bindPathsInContainer();

        if (!defined('ARTISAN_BINARY')) {
            define('ARTISAN_BINARY', 'bin/artisan');
        }
    }

    public function path($path = '')
    {
        return ($this->basePath . DIRECTORY_SEPARATOR . 'src');
    }

    public function bootstrapPath($path = '')
    {
        return ($this->appPath . DIRECTORY_SEPARATOR . 'bootstrap');
    }

    public function configPath($path = '')
    {
        return ($this->appPath . DIRECTORY_SEPARATOR . 'config');
    }

    public function databasePath($path = '')
    {
        return ($this->appPath . DIRECTORY_SEPARATOR . 'database');
    }

    public function langPath()
    {
        return ($this->appPath . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'lang');
    }

    public function storagePath()
    {
        return ($this->appPath . DIRECTORY_SEPARATOR . 'storage');
    }
}

Add defined() guard around define(ARTISAN_BINARY)


<?php

namespace Opifer\CmsBundle\Composer;

use Composer\Script\Event;

class ScriptHandler
{
    public static function installAssets(Event $event)
    {
        $event->getIO()->write('<info>Installing CmsBundle assets</info>');

        $currentDirectory = getcwd();

        $cmdDirectory = __DIR__.'/..';

        chdir($cmdDirectory);

        exec('bower update --allow-root', $output, $return_var);
        $event->getIO()->write('<info>'.implode("\n", $output).'</info>');
        if ($return_var) {
            throw new \RuntimeException("Running bower install failed with $return_var\n");
        }

        exec('npm install', $output, $return_var);
        $event->getIO()->write('<info>'.implode("\n", $output).'</info>');
        if ($return_var) {
            throw new \RuntimeException("Running npm failed with $return_var\n");
        }

        exec('gulp default', $output, $return_var);
        $event->getIO()->write('<info>'.implode("\n", $output).'</info>');
        if ($return_var) {
            throw new \RuntimeException("Running gulp failed with $return_var\n");
        }

        exec('npm run build', $output, $return_var);
        $event->getIO()->write('<info>'.implode("\n", $output).'</info>');
        if ($return_var) {
            throw new \RuntimeException("Running npm build failed with $return_var\n");
        }

        chdir($currentDirectory);
    }
}

<?php

namespace Opifer\CmsBundle\Composer;

use Composer\Script\Event;

class ScriptHandler
{
    public static function installAssets(Event $event)
    {
        $event->getIO()->write('<info>Installing CmsBundle assets</info>');

        $currentDirectory = getcwd();

        $cmdDirectory = __DIR__.'/..';

        chdir($cmdDirectory);

        exec('bower update --allow-root', $output, $return_var);
        $event->getIO()->write('<info>'.implode("\n", $output).'</info>');
        if ($return_var) {
            throw new \RuntimeException("Running bower install failed with $return_var\n");
        }

        exec('npm install --unsafe-perm', $output, $return_var);
        $event->getIO()->write('<info>'.implode("\n", $output).'</info>');
        if ($return_var) {
            throw new \RuntimeException("Running npm failed with $return_var\n");
        }

        exec('gulp default', $output, $return_var);
        $event->getIO()->write('<info>'.implode("\n", $output).'</info>');
        if ($return_var) {
            throw new \RuntimeException("Running gulp failed with $return_var\n");
        }

        exec('npm run build', $output, $return_var);
        $event->getIO()->write('<info>'.implode("\n", $output).'</info>');
        if ($return_var) {
            throw new \RuntimeException("Running npm build failed with $return_var\n");
        }

        chdir($currentDirectory);
    }
}

Install npm packages with unsafe permissions


<?php

namespace Orchestra\Foundation\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel
{
    /**
     * The bootstrap classes for the application.
     *
     * @return void
     */
    protected $bootstrappers = [
        \Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables::class,
        \Orchestra\Config\Bootstrap\LoadConfiguration::class,
        \Illuminate\Foundation\Bootstrap\HandleExceptions::class,
        \Illuminate\Foundation\Bootstrap\RegisterFacades::class,
        \Illuminate\Foundation\Bootstrap\RegisterProviders::class,
        \Illuminate\Foundation\Bootstrap\BootProviders::class,

        \Orchestra\Foundation\Bootstrap\LoadFoundation::class,
        \Orchestra\Foundation\Bootstrap\UserAccessPolicy::class,
        \Orchestra\Extension\Bootstrap\LoadExtension::class,
        \Orchestra\Foundation\Bootstrap\LoadUserMetaData::class,
        \Orchestra\Foundation\Bootstrap\NotifyIfSafeMode::class,
        \Orchestra\View\Bootstrap\LoadCurrentTheme::class,
        \Orchestra\Foundation\Bootstrap\LoadExpresso::class,
    ];
}

<?php

namespace Orchestra\Foundation\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel
{
    /**
     * The bootstrap classes for the application.
     *
     * @return void
     */
    protected $bootstrappers = [
        \Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables::class,
        \Orchestra\Config\Bootstrap\LoadConfiguration::class,
        \Illuminate\Foundation\Bootstrap\HandleExceptions::class,
        \Illuminate\Foundation\Bootstrap\RegisterFacades::class,
        \Illuminate\Foundation\Bootstrap\RegisterProviders::class,
        \Illuminate\Foundation\Bootstrap\BootProviders::class,

        \Orchestra\Foundation\Bootstrap\LoadFoundation::class,
        \Orchestra\Foundation\Bootstrap\UserAccessPolicy::class,
        \Orchestra\Extension\Bootstrap\LoadExtension::class,
        \Orchestra\Foundation\Bootstrap\NotifyIfSafeMode::class,
        \Orchestra\View\Bootstrap\LoadCurrentTheme::class,
        \Orchestra\Foundation\Bootstrap\LoadExpresso::class,
    ];
}

Remove loading user meta data.

Remove loading user meta data.

Signed-off-by: Mior Muhammad Zaki <e1a543840a942eb68427510a8a483282a7bfeddf@gmail.com>


<?php

define('MYSQL_HOST', 'localhost');
define('MYSQL_USER', 'user');
define('MYSQL_PASSWORD', 'password');
define('MYSQL_DATABASE', 'database');
define('TWITTER_USERNAME', 'mathias');
define('GOOGLE_PLUS_ID', '116553353277057965424');
define('SHORT_URL', 'http://mths.be/'); // include the trailing slash!
define('DEFAULT_URL', 'http://mathiasbynens.be'); // omit the trailing slash!

?>

<?php

define('MYSQL_HOST', 'localhost');
define('MYSQL_USER', 'user');
define('MYSQL_PASSWORD', 'password');
define('MYSQL_DATABASE', 'database');
define('TWITTER_USERNAME', 'mathias');
define('GOOGLE_PLUS_ID', '106697091536876736486');
define('SHORT_URL', 'http://mths.be/'); // include the trailing slash!
define('DEFAULT_URL', 'http://mathiasbynens.be'); // omit the trailing slash!

?>

Update example `GOOGLE_PLUS_ID` to match my new G+ account.


<?php
$pdo = new PDO('mysql:host=mysql.hostinger.co.uk;dbname=u914861886_immo', 'u914861886_abdo', 'ImmoERP2015DB');

<?php
$pdo = new PDO('mysql:host=localhost;dbname=annahda', 'root', '');

Add Contrats Desistes To Project - Date : 22/11/2016