Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Iteration 6-7] v4.0-beta #122

Merged
merged 22 commits into from
Sep 23, 2019
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
APP_CRYPT_SALT=eEAfR|_&G&f,+vU]:jFr!!A&+71w1Ms9~8_4L!<@[N@DyaIP_2My|:+.u>/6m,$D
APP_BASE_URI=/
APP_PUBLIC_URL=vokuro.phalcon.io
APP_PUBLIC_URL=dev.vokuro.phalcon.io

# Supported adapters are:
# - mysql
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@

composer.lock
vendor/
app/config/config.dev.php
.env
boxfile.yml
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,16 @@ before_script:

script:
- vendor/bin/codecept build --quiet
- vendor/bin/codecept run
- vendor/bin/codecept run --coverage --coverage-xml
- vendor/bin/psalm --show-info=false
- |
if [ "$TRAVIS_PHP_VERSION" = "7.2" ]; then
phpenv config-rm xdebug.ini || true
vendor/bin/phpcs
fi

#after_success:
# - bash <(curl -s https://codecov.io/bash)

notifications:
email: false
25 changes: 25 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Contributor Covenant Code of Conduct

## TL;DR

Common sense rules. Treat people the same way you want to be treated.

## Detail

This is an open source project. Everyone and anyone is welcome to contribute
to it as much or as little as they want to.

Personal views of contributors have no effect on the project and should be
kept in the personal realm not this project.

It is a requirement to treat other contributors as well as maintainers with
respect, when communicating in the realm of this project. It is OK to agree to
disagree.

## Conflict

If ever conflict arises, please bring it to the attention of the maintainers
privately. You can always find us on our [Discord](https://phalcon.link/discord)
server or you can send us an email at team@phalconphp.com

The core team maintains the final decision on any conflict that may arise.
29 changes: 29 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2013-2019, Phalcon PHP Framework
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 changes: 0 additions & 26 deletions LICENSE.txt

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ If you want something to be improved or you want a new feature please submit a P
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/phalcon#sponsor)]

<a href="https://opencollective.com/phalcon/#contributors">
<img src="https://opencollective.com/phalcon/tiers/sponsors.svg?avatarHeight=48&width=800">
<img src="https://opencollective.com/phalcon/tiers/sponsors.svg?avatarHeight=48&width=800" alt="sponsors">
</a>

## Backers

Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/phalcon#backer)]

<a href="https://opencollective.com/phalcon/#contributors">
<img src="https://opencollective.com/phalcon/tiers/backers.svg?avatarHeight=48&width=800&height=200">
<img src="https://opencollective.com/phalcon/tiers/backers.svg?avatarHeight=48&width=800&height=200" alt="backers">
</a>

## License
Expand Down
6 changes: 6 additions & 0 deletions codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,9 @@ params:
- tests/.env.test

error_level: "E_ALL"

#coverage:
# enabled: true
# remote: false
# include:
# - src/*
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@
},
"autoload": {
"psr-4": {
"Vokuro\\": "app/",
"Phalcon\\": "app/Phalcon"
"Vokuro\\": "src/",
"Phalcon\\": "src/Phalcon"
},
"files": [
"app/Helpers.php"
"src/Helpers.php"
]
}
}
4 changes: 2 additions & 2 deletions configs/acl.php → config/acl.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@

return [
'private' => [
'users' => [
'users' => [
'index',
'search',
'edit',
'create',
'delete',
'changePassword',
],
'profiles' => [
'profiles' => [
'index',
'search',
'edit',
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<exclude name="Generic.Files.LineLength.TooLong"/>
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols"/>
</rule>
<file>app</file>
<file>configs</file>
<file>src</file>
<file>config</file>
<file>db</file>
<file>public/index.php</file>
<file>tests/acceptance</file>
Expand Down
2 changes: 1 addition & 1 deletion psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
autoloader="vendor/autoload.php"
>
<projectFiles>
<directory name="app" />
<directory name="src" />
<file name="public/index.php" />
<ignoreFiles>
<directory name="vendor" />
Expand Down
1 change: 0 additions & 1 deletion resources/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ RUN export PHALCON_REPO="https://packagecloud.io/phalcon/$PHALCON_BRANCH" \
&& echo "extension=psr.so" > "$PHP_INI_DIR/conf.d/docker-php-ext-psr.ini" \
&& echo "extension=phalcon.so" > "$PHP_INI_DIR/conf.d/docker-php-ext-phalcon.ini" \
&& php -m | grep -i "opcache\|mysql\|phalcon\|psr\|pdo\|mbstring" \
&& unset PHALCON_REPO PHALCON_PKG \
&& mv /code/.env.example /code/.env \
&& apt-get autoremove -y \
&& apt-get autoclean -y \
Expand Down
2 changes: 1 addition & 1 deletion app/Application.php → src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ protected function createApplication(): AbstractApplication
*/
protected function initializeProviders(): void
{
$filename = $this->rootPath . '/configs/providers.php';
$filename = $this->rootPath . '/config/providers.php';
if (!file_exists($filename) || !is_readable($filename)) {
throw new Exception('File providers.php does not exist or is not readable.');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/**
* Display the "About" page.
*/
final class AboutController extends ControllerBase
class AboutController extends ControllerBase
{
/**
* Default action. Set the public layout (layouts/public.volt)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/**
* Display the default index page.
*/
final class IndexController extends ControllerBase
class IndexController extends ControllerBase
{
/**
* Default action. Set the public layout (layouts/public.volt)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* View and define permissions for the various profile levels.
*/
final class PermissionsController extends ControllerBase
class PermissionsController extends ControllerBase
{
/**
* View the permissions for a profile level, and change them if we have a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/**
* Display the privacy page.
*/
final class PrivacyController extends ControllerBase
class PrivacyController extends ControllerBase
{
/**
* Default action. Set the public layout (layouts/public.volt)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Vokuro\Controllers\ProfilesController
* CRUD to manage profiles
*/
final class ProfilesController extends ControllerBase
class ProfilesController extends ControllerBase
{
/**
* Default action. Set the private (authenticated) layout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Controller used handle non-authenticated session actions like login/logout,
* user signup, and forgotten passwords
*/
final class SessionController extends ControllerBase
class SessionController extends ControllerBase
{
/**
* Default action. Set the public layout (layouts/public.volt)
Expand All @@ -45,15 +45,13 @@ public function signupAction()
$form = new SignUpForm();

if ($this->request->isPost()) {
if ($form->isValid($this->request->getPost()) != false) {
$user = new Users(
[
'name' => $this->request->getPost('name', 'striptags'),
'email' => $this->request->getPost('email'),
'password' => $this->security->hash($this->request->getPost('password')),
'profilesId' => 2,
]
);
if ($form->isValid($this->request->getPost())) {
$user = new Users([
'name' => $this->request->getPost('name', 'striptags'),
'email' => $this->request->getPost('email'),
'password' => $this->security->hash($this->request->getPost('password')),
'profilesId' => 2,
]);

if ($user->save()) {
return $this->dispatcher->forward([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/**
* Display the terms and conditions page.
*/
final class TermsController extends ControllerBase
class TermsController extends ControllerBase
{
/**
* Default action. Set the public layout (layouts/public.volt)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@

use Vokuro\Models\EmailConfirmations;
use Vokuro\Models\ResetPasswords;
use Vokuro\Models\Users;

/**
* UserControlController
* Provides help to users to confirm their passwords or reset them
*/
final class UserControlController extends ControllerBase
class UserControlController extends ControllerBase
{
public function initialize(): void
{
Expand All @@ -28,10 +29,6 @@ public function initialize(): void
}
}

public function indexAction(): void
{
}

/**
* Confirms an e-mail, if the user must change their password then changes
* it
Expand All @@ -56,12 +53,26 @@ public function confirmEmailAction()
]);
}

$confirmation->confirmed = 'Y';
$confirmation->user->active = 'Y';
/**
* Activate user
*/
$user = Users::findFirst($confirmation->user->id);
$user->active = 'Y';
if (!$user->save()) {
foreach ($confirmation->user->getMessages() as $message) {
$this->flash->error((string) $message);
}

return $this->dispatcher->forward([
'controller' => 'index',
'action' => 'index',
]);
}

/**
* Change the confirmation to 'confirmed' and update the user to 'active'
*/
$confirmation->confirmed = 'Y';
if (!$confirmation->save()) {
foreach ($confirmation->getMessages() as $message) {
$this->flash->error((string) $message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Vokuro\Controllers\UsersController
* CRUD to manage users
*/
final class UsersController extends ControllerBase
class UsersController extends ControllerBase
{
public function initialize(): void
{
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 0 additions & 20 deletions app/Helpers.php → src/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,6 @@ function container()
return call_user_func_array([$default, 'get'], $args);
}

/**
* Get configuration value
*
* Also can access nested values.
* Example: config('config.db.name')
*
* @return mixed
*/
function config()
{
$args = func_get_args();
$config = Di::getDefault()->getShared('config');

if (empty($args)) {
return $config;
}

return call_user_func_array([$config, 'path'], $args);
}

/**
* Get projects relative root path
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* Stores the reset password codes and their evolution
*
* @method static EmailConfirmations findFirstByCode(string $code)
* @property Users $user
*/
class EmailConfirmations extends Model
{
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading