Giter Site home page Giter Site logo

koseven / koseven Goto Github PK

View Code? Open in Web Editor NEW
375.0 65.0 159.0 3.36 MB

Koseven a Kohana fork compatible with PHP7

Home Page: https://koseven.dev

License: Other

PHP 93.46% Shell 0.12% CSS 2.32% JavaScript 2.33% Hack 1.77%
kohana php-framework kohana-documentation mvc mvc-framework php7 kohana-modules koseven

koseven's Introduction

Koseven Logo

Latest Stable Version Build Status License Github Issues

Koseven is an elegant, open source, and object oriented HMVC framework built using PHP7, by a team of volunteers. It aims to be swift, secure, and small. It is based and nearly full compatible on defunct Kohana 3.3.X.

Released under a BSD license, Koseven can be used legally for any open source, commercial, or personal project.

Will work as dropin of Kohana?

If you were using 3.3.x version you may need to make some small changes. Please refer to upgrading from kohana section of the documentation.

I Need help!

You need Help, How-To's, Guides,...? Please consider to look into the GitHub Issues, maybe your answer is already there. If not feel free to open a topic and ask for it. If you want to you can also Join our Telegram Group, but keep in mind that this wan't guarantee you faster answer times, as we get also notified via Telegram if you open a Forum Topic.

History/Why a Kohana alternative?

Kohana 3.3.x is used by us in many live projects, and the original team (where @neo22s belonged too) stopped the development a while ago and on Feb 4, 2017 Shadowhand announced the final retirement Kohana is DEAD.

Before the final announcement everyone started to check if it was possible to migrate existing projects to other alternative PHP frameworks. As it turned out switching would be a complex and lengthy job. So it became clear that keeping the project alive and updated is a priority.

And so the Koseven repository was born and will keep this repository updated for future releases of PHP, giving the framework a clear perspective for the future.

Are modules of the original Kohana compatible?

Yes they are, just be sure that they are compatible with Kohana 3.3.X. An overview of Koseven's team own modules can be found on modules page. There's also a list online with a nice overview of existing kohana modules maintained (or abandoned) by others. You can consult this list at kohana-modules.com

Why all modules in 1 repo?

This was personal choice of @neo22s to keep the project as simple and easier to manage. The modules are commonly used and are not enabled by default. If not used they can be removed from the codebase.

What are the future plans for the project?

Our focus is to keep the framework compatible with new releases of PHP, fix bugs and try to improve the speed. New features can be added using modules.

Documentation

Koseven documentation can be found at koseven.dev which also contains an API browser.

The userguide module included in all Kohana/Koseven releases allows you to view the documentation locally. To use it you need to enable theuserguide module in the bootstrap.php file (found in the application directory). Next you should be able to read the documentation from your own site via /index.php/guide (or just /guide if you are rewriting your URLs).

Reporting Bugs / Security Issues

If you've stumbled across a bug or a security issue, please help us out by reporting what you have found. Simply log in or register and submit a new issue, leaving as much information as possible, e.g.

  • Steps to reproduce
  • Expected result
  • Actual result

This will help us to fix the issue as quickly as possible, and if you'd like to fix it yourself feel free to fork us on GitHub and submit a pull request!

Contributing

Any help is more than welcome! Please see Contributing for detailed Instructions.

Special Thanks

Special Thanks to all our Contibuters and our Community!

koseven's People

Contributors

adamcopley avatar ajuszczyk avatar arkagod avatar atainex avatar azuka avatar bkosun avatar bwdutton avatar casperbe avatar chipcius avatar duncan3dc avatar gazoo avatar hyaena avatar jstrobel avatar jtepe-sedna avatar juherr avatar kkugot avatar klunker avatar kotsios5 avatar leonar15 avatar neo22s avatar ole13 avatar piotrbaczek avatar saruman avatar satanch avatar stik avatar svenbw avatar theparanoik avatar timhj avatar toitzi avatar wintersilence avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

koseven's Issues

Insulation system files

I propose to move the files index.php, install.php, example.htaccess in a separate folder, (public), it will isolate other system files ( .gitignore, composer.json, .travis.yml, etc) that should not be accessible from the outside.

Also, it will allow you to manage public files more efficiently

What do you think of it?

ORM: filter columns in as_array and add as_object

I think it's a good idea to support the as_object function for ORM modules; it has the same behavior as the as_array function but outputs an object.
This object can be used in REST interfaces or for ajax requests.

Because some of the columns should remain private I think it's a good idea to allow the ORM model to mark some columns as private (using a ORM property), these will be excluded from the result when calling as_array (and as_object).
The interface should be backwards compatible so older code will not break.

A pull request can be found here.

Development flow

Should we commit everything into Master, and then just do a Tag per release? Is what I had in mind now.

I want to keep things as simple as possible so its easy to collaborate.

Problem with ErrorException

The Error was in my DB::select statement, but instead of showing normal informative Kohana Error I get this error message. It seems that we need to work more on Exception class compatibility with php 7.

ErrorException [ Fatal Error ]: Uncaught TypeError: Argument 1 passed to Kohana_Exception::handler() must be an instance of Exception, instance of Error given in /XXX/application/classes/Kohana/Exception.php:84 Stack trace: #0 [internal function]: Kohana_Exception::handler(Object(Error)) #1 {main} thrown

no build.xml file for phing test

$ ./vendor/bin/phing test
Buildfile: build.xml does not exist!

Is there a copy of this somewhere not in the repo, or are we currently not running tests on koseven?

23 errors fail on fresh new koseven:devel

I tried to write a unittest related to #63, but I can't get all unittests passed even on fresh out of the box koseven.
`phpunit --bootstrap=modules/unittest/bootstrap.php modules/unittest/tests.php
PHPUnit 5.4.6 by Sebastian Bergmann and contributors.

............................................................. 61 / 1277 ( 4%)
..........................W...WWWWWWW.WWWWWWWWW.............. 122 / 1277 ( 9%)
............................................................. 183 / 1277 ( 14%)
............................................................. 244 / 1277 ( 19%)
............................................................. 305 / 1277 ( 23%)
...............SS..................E..EEEE.EEEE.EEEEEEEEEEE.. 366 / 1277 ( 28%)
....E........................................................ 427 / 1277 ( 33%)
............................................................. 488 / 1277 ( 38%)
............................................................. 549 / 1277 ( 42%)
............................................................. 610 / 1277 ( 47%)
...................W..WWWW............W............WW........ 671 / 1277 ( 52%)
........................EE................................... 732 / 1277 ( 57%)
............................................................. 793 / 1277 ( 62%)
............................................................. 854 / 1277 ( 66%)
............................................................. 915 / 1277 ( 71%)
............................................................. 976 / 1277 ( 76%)
............................................................. 1037 / 1277 ( 81%)
............................................................. 1098 / 1277 ( 85%)
............................................................. 1159 / 1277 ( 90%)
............................................................. 1220 / 1277 ( 95%)
....................................................WWWWW 1277 / 1277 (100%)

Time: 390 ms, Memory: 10.00Mb

There were 23 errors:

  1. Kohana_FeedTest::test_create with data set #0 (array(123, array('http://kohanaframework.org/image.png', 'http://kohanaframework.org/', 'title')), array(array('bar', 123, 'foo')), array(array('localhost', 'xim', '/var/lib/lightdm-data/nzpetter', '/org/freedesktop/DisplayManag...ssion0', 'xterm-256color', '/bin/bash', 'gnome-', '4402', 'gnome-keyring', '1', '54525958', 'unix:abstract=/com/ubuntu/ups...0/2014', 'gail:atk-bridge:unity-gtk-module', 'nzpetter', 'rs=0:di=01;34:ln=01;36:mh=00:...00;36:', '1', '/org/freedesktop/DisplayManag...ssion0', '/org/freedesktop/DisplayManager/Seat0', '/run/user/1000/keyring/ssh', '/usr/share/gconf/ubuntu.default.path', '/etc/xdg/xdg-ubuntu:/usr/shar...tc/xdg', '/home/nzpetter/bin:/home/nzpe...ap/bin', 'ubuntu', 'ibus', 'qgnomeplatform', 'x11', '/var/www/html', '@im=ibus', 'pl_PL.UTF-8', 'pl', '/usr/share/gconf/ubuntu.mandatory.path', '1', 'ubuntu', 'ubuntu', 'overlay-scrollbar', '/home/nzpetter', '2', 'pl', 'this-is-deprecated', 'ubuntu', 'nzpetter', '/usr/bin/', '/usr/share/ubuntu:/usr/local/...esktop', 'xim', 'unix:path=/run/user/1000/bus', '| /usr/bin/lesspipe %s', '1910', '8:26029', '/run/user/1000', ':0', 'Unity', 'ibus', '/usr/bin/lesspipe %s %s', '/home/nzpetter/.Xauthority', 'truecolor', '/usr/bin/phpunit', '/var/www', '/usr/bin/phpunit', '/usr/bin/phpunit', '/usr/bin/phpunit', '/usr/bin/phpunit', '', 1489176007.411359, 1489176007, array('/usr/bin/phpunit', '--bootstrap=modules/unittest/...ap.php', 'modules/unittest/tests.php'), 3)), array('channel', array('item', array('foo', 'bar'))), array(array('channel', array('image', array('link', 'http://kohanaframework.org/image.png'))), array('channel', array('image', array('url', 'http://kohanaframework.org/'))), array('channel', array('image', array('title', 'title')))))
    Error: Call to undefined method PHPUnit_Util_XML::findNodes()

/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:167
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:119
/var/www/html/system/tests/kohana/FeedTest.php:133
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestSuite.php:51

  1. Kohana_FormTest::test_open with data set #0 (array('', null), array(''))
    Error: Call to undefined method PHPUnit_Util_XML::findNodes()

/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:167
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:119
/var/www/html/system/tests/kohana/FormTest.php:83
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestSuite.php:51

  1. Kohana_FormTest::test_open with data set #1 (array(null, null), array(''))
    Error: Call to undefined method PHPUnit_Util_XML::findNodes()

/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:167
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:119
/var/www/html/system/tests/kohana/FormTest.php:83
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestSuite.php:51

  1. Kohana_FormTest::test_open with data set #2 (array('foo', null), array('/foo'))
    Error: Call to undefined method PHPUnit_Util_XML::findNodes()

/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:167
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:119
/var/www/html/system/tests/kohana/FormTest.php:83
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestSuite.php:51

  1. Kohana_FormTest::test_open with data set #3 (array('foo', array('get')), array('/foo', 'get'))
    Error: Call to undefined method PHPUnit_Util_XML::findNodes()

/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:167
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:119
/var/www/html/system/tests/kohana/FormTest.php:83
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestSuite.php:51

  1. Kohana_FormTest::test_input with data set #0 ('input', 'foo', 'bar', null, 'input')
    Error: Call to undefined method PHPUnit_Util_XML::findNodes()

/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:167
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:119
/var/www/html/system/tests/kohana/FormTest.php:147
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestSuite.php:51

  1. Kohana_FormTest::test_input with data set #1 ('input', 'foo', null, null, 'input')
    Error: Call to undefined method PHPUnit_Util_XML::findNodes()

/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:167
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:119
/var/www/html/system/tests/kohana/FormTest.php:147
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestSuite.php:51

  1. Kohana_FormTest::test_input with data set #2 ('hidden', 'foo', 'bar', null, 'hidden')
    Error: Call to undefined method PHPUnit_Util_XML::findNodes()

/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:167
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:119
/var/www/html/system/tests/kohana/FormTest.php:147
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestSuite.php:51

  1. Kohana_FormTest::test_input with data set #3 ('password', 'foo', 'bar', null, 'password')
    Error: Call to undefined method PHPUnit_Util_XML::findNodes()

/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:167
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:119
/var/www/html/system/tests/kohana/FormTest.php:147
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestSuite.php:51

  1. Kohana_FormTest::test_check with data set #0 ('checkbox', 'foo', null, false, null)
    Error: Call to undefined method PHPUnit_Util_XML::findNodes()

/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:167
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:119
/var/www/html/system/tests/kohana/FormTest.php:223
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestSuite.php:51

  1. Kohana_FormTest::test_check with data set #1 ('checkbox', 'foo', null, true, null)
    Error: Call to undefined method PHPUnit_Util_XML::findNodes()

/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:167
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:119
/var/www/html/system/tests/kohana/FormTest.php:223
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestSuite.php:51

  1. Kohana_FormTest::test_check with data set #2 ('checkbox', 'foo', 'bar', true, null)
    Error: Call to undefined method PHPUnit_Util_XML::findNodes()

/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:167
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:119
/var/www/html/system/tests/kohana/FormTest.php:223
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestSuite.php:51

  1. Kohana_FormTest::test_check with data set #3 ('radio', 'foo', null, false, null)
    Error: Call to undefined method PHPUnit_Util_XML::findNodes()

/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:167
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:119
/var/www/html/system/tests/kohana/FormTest.php:223
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestSuite.php:51

  1. Kohana_FormTest::test_check with data set #4 ('radio', 'foo', null, true, null)
    Error: Call to undefined method PHPUnit_Util_XML::findNodes()

/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:167
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:119
/var/www/html/system/tests/kohana/FormTest.php:223
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestSuite.php:51

  1. Kohana_FormTest::test_check with data set #5 ('radio', 'foo', 'bar', true, null)
    Error: Call to undefined method PHPUnit_Util_XML::findNodes()

/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:167
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:119
/var/www/html/system/tests/kohana/FormTest.php:223
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestSuite.php:51

  1. Kohana_FormTest::test_text with data set #0 ('textarea', 'foo', 'bar', null)
    Error: Call to undefined method PHPUnit_Util_XML::findNodes()

/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:167
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:119
/var/www/html/system/tests/kohana/FormTest.php:276
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestSuite.php:51

  1. Kohana_FormTest::test_text with data set #1 ('textarea', 'foo', 'bar', array(20, 20))
    Error: Call to undefined method PHPUnit_Util_XML::findNodes()

/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:167
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:119
/var/www/html/system/tests/kohana/FormTest.php:276
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestSuite.php:51

  1. Kohana_FormTest::test_text with data set #2 ('button', 'foo', 'bar', null)
    Error: Call to undefined method PHPUnit_Util_XML::findNodes()

/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:167
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:119
/var/www/html/system/tests/kohana/FormTest.php:276
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestSuite.php:51

  1. Kohana_FormTest::test_text with data set #3 ('label', 'foo', 'bar', null)
    Error: Call to undefined method PHPUnit_Util_XML::findNodes()

/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:167
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:119
/var/www/html/system/tests/kohana/FormTest.php:276
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestSuite.php:51

  1. Kohana_FormTest::test_text with data set #4 ('label', 'foo', null, null)
    Error: Call to undefined method PHPUnit_Util_XML::findNodes()

/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:167
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:119
/var/www/html/system/tests/kohana/FormTest.php:276
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestSuite.php:51

  1. Kohana_FormTest::test_submit with data set #0 ('foo', 'Foobar!', '')
    Error: Call to undefined method PHPUnit_Util_XML::findNodes()

/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:167
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:119
/var/www/html/system/tests/kohana/FormTest.php:341
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestSuite.php:51

  1. Kohana_TextTest::test_auto_para_does_not_enclose_html_tags_in_paragraphs with data set #0 (array('div'), '
    Pick a plum of peppers
    ')
    Error: Call to undefined method PHPUnit_Util_XML::findNodes()

/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:167
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:147
/var/www/html/system/tests/kohana/TextTest.php:73
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestSuite.php:51

  1. Kohana_TextTest::test_auto_para_does_not_enclose_html_tags_in_paragraphs with data set #1 (array('div'), '
    Tangas
    ')
    Error: Call to undefined method PHPUnit_Util_XML::findNodes()

/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:167
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestCase.php:147
/var/www/html/system/tests/kohana/TextTest.php:73
/var/www/html/modules/unittest/classes/Kohana/Unittest/TestSuite.php:51

--
`

What am I doing wrong?

Subdomains

During last almost 3 years of using Kohana i got into some issues with subdomains.
I can without problems create a multi-application system, where I have different "application" folder for frontend, api, user, backend

by using .htaccess
`#API
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} (www.)?api.*
RewriteRule .* api.php/$0 [PT,L]

#FRONTEND
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]`

however there is no easy way to inject subdomains into URL::site(). This could be useful for example if being on my api.* subdomain I would like to refer to docs.*/issue/324 problem for the api.

Update file headers

  • Update (copyright) dates in the header files
  • Update links to koseven.ga (license)
  • Optionally add a reference to Koseven
  • ! Leave Kohana references in !

Kohana::cache issues

Kohana::cache https://github.com/koseven/koseven/blob/master/system/classes/Kohana/Core.php#L856

Always uses file text to store the cache.... even if you have set another cache....

Did you know? queries on the Database are stored using kohana::cache!! (file)

https://github.com/koseven/koseven/blob/master/modules/database/classes/Kohana/Database/Query.php#L242

We can not directly modify it because if you use caching for kohana internal the module of cache is not loaded yet in the init()
https://github.com/koseven/koseven/blob/master/system/classes/Kohana/Core.php#L294

I have overwritten the function in my own kohana.php file....

public static function cache($name, $data = NULL, $lifetime = NULL)
{
    //in case the Kohana_Cache is not yet loaded we need to use the normal cache...sucks but happens onload
    if (class_exists('Kohana_Cache'))
    {
        //deletes the cache
        if ($lifetime===0)
            return Cache::instance()->delete($name);

        //in development we do not store or read we always return null
        if (Kohana::$environment == Kohana::DEVELOPMENT)
            return NULL;

        //no data provided we read
        if ($data===NULL)
            return Cache::instance()->get($name);
        //saves data
        else
            return Cache::instance()->set($name,$data, $lifetime);
    }
    else
        return parent::cache($name, $data, $lifetime);
}

Suggestions? how should we handle this?

Documentation

Use something like https://readthedocs.org/ or jekyll?

We should change the module guide and API to generate static content that we can upload?

Or leave it dynamic, any ideas welcome.

What's happening?

Hi neo22s.
I posted a question for you on Kohana's Discourse three weeks ago.
Your "Telegram group" links don't work.

Please let me know where you are in the correspondence with Shadowhand.
Thanks.

Create migration instructions

How to migrate from KO 3.3.X to Koseven 3.3.7

In the readme? also in the site as a single page?

  • exception.php
  • url.php function site new parameter
  • module encrypt
  • mysql driver removed

Password validation with min_length rule

In my controller I have valid_profile function where was
$valid->rule('password','max_length', array(':value', 50));
$valid->rule('password','min_length', array(':value', 6));
$valid->rule('password_confirm','matches',array(':validation', 'password', 'password_confirm'));

If in view form I try to send 5 chars, my validate work, and tell me to write min. 6 chars, but if I write 7 chars, my project output error
image

Then I try to write 8 or more chars, and POST is work great.
Next I see KO module User and find get_password_validation() functions where min_length set 8.

My question is: If I set min_length = 6, why I have error...?

Multiple language: howto doc(?)

Introduction

Unfortunately there is more than one one language in the world. And it’s a challenge to support this in a framework. For my first project that required language selection I had to read into the details. More recently I bumped again into an issue so I thought it might be a good thing to write it out.
Should we add this to the documentation?

Which language?

First it should be detected (so one can serve the correct language when the visitor visits a page), the visitor should be able to switch the language trough a link or by the selection in his profile.
The language preference of a visitor is specified in the browser and is sent to the server in the accept-language header entry of the request.
Kohana can retrieve the preferred language using the HTTP::request_headers()->preferred_language($supported_languages) where $supported_languages is a list of languages supported by the application.

Language selection by routing

(Thanks to @neo22s for pointing this out)
To handle the language in the framework it is possible to specify a language parameter in the Route sets:

  Route::set('page', '(<language>/)pages(/<seotitle>).html', array('language' => $allowed_languages))
    ->defaults(
      'controller' => 'pages',
      'action' => 'index',
      'language' => 'en'
    );

The language can then be easily retrieved using the language param from the request.

Language selection trough a module

There are modules (e.g. kohana-multilang) that overload the request and routing system of Kohana. There the language is stripped from the request (by the subclass) before it is passed to the base request class. Language support can then be applied (or removed) without changing the bootstrap.php routing rules.
Typically the current language can then be retrieved using a specific call on the request object.

Language to use

How to store the language for the visitor?
When the visitor visits the site for the first time one needs to determinate preferred language using the browser preference. This selection will probably by the most suitable language selection.
If the language in not available one can use the default.
If the visitors switches the language he’s preferred language is probably different than the one configured in his browser so one needs to store this on the browser by using a cookie (this assures that when the visitor returns he will get the website in the language he prefers).
In both configurations (by routing or module) the first thing to do is to redirect the visitor to the proper url (for Dutch visiting www.example.com would redirect to www.example.com/nl. www.example.com would return the English version).
So not that if the language was switched (using a menu option) the next time the visitor visits the root of the domain (www.example.com) the cookie will overrule the browser preference.

Language switch menu

(Thanks to @knbv for pointing this out)
On most sites switching can be done by a pulldown menu. Switching the language should leave the visitor at the same page as before.

// Get the name of the active route
$route = Route::name(Request::current()->route());

// Get the applied route parameters
$params['controller'] = Request::current()->controller();
$params['action'] = Request::current()->action();
$params = array_merge($params, Request::current()->param());

// Create the translated URL for the current route (route setup)
$params['language'] = $language_name;
Route::url($route_name, $params);

// OR: Create the translated URL for the current route (module setup)
Route::url($route_name, $params, NULL, $language_name)

Removed "defined SYSPATH" line

Hey @adamcopley, why did you remove this line from all the files? I think that this is one step in kohana security, that should stay. Was it really slowing down one of the fastest frameworks so much?
28079de

Image module - WebP support

Hi,
can someone improve Image module and add webp support for images manipulation?
Support in PHP7 for webp si very good.

Kohana Minion not compatible with PHP 7.0 Exception class change

After trying to use minion on fresh out-of-box koseven, got this error:
<h1><span class="type">ErrorException [ Warning ]:</span> <span class="message">Declaration of Kohana_Minion_E xception::handler(Exception $e) should be compatible with Kohana_Kohana_Exception::handler($e)</span></h1> <div id="error58850d0d06654" class="content"> <p><span class="file">MODPATH\minion\classes\Kohana\Minion\Exception.php [ 65 ]</span></p>

Hence handler(Exception $e) -> handler($e)

Pagination module - Unix friendly names

Please correct the first letters in this case:

Current state:

modules/pagination/classes/kohana/pagination.php

Correct one:

modules/pagination/classes/Kohana/Pagination.php

PHP 5 Compatibility

Should we maintain the software compatible? PHP 5.6 will have support until 31 December 2018. Support, so only bug fixing.

Not sure what you all think, your input is important.

What I am sure: I will not test on PHP 5 at all. xD Someone wants to take care of it?

Pagination - Required route parameter not passed: action

Hi there,

I use the Pagination module, which is now included in this repo.

Right now I'm getting this error:

EMERGENCY: Kohana_Exception [ 0 ]: Required route parameter not passed: action ~ SYSPATH/classes/Kohana/Route.php [ 580 ]

I tried to debug that and the details are:

In the pagination/classes/Kohana/Pagination.php there is url() method... and inside there is this part of code:

case 'query_string':

	return URL::site($this->_route->uri($this->_route_params).
		$this->query(array($this->config['current_page']['key'] => $page)));

The $this->_route->uri expects the array as a parametr... and one of the keys of this array should be "action" key.

But it isn't.

The "action" key is unset in the Request class on purpos (because there is public $request->action() method), so I beleive there is some bug in the Pagination module.

If I hotfix the Pagination contructor like this:

// Assign default route params
$this->_route_params = $request->param();
$this->_route_params['action'] = $request->action();  // <-- this is my hotfix

it works just fine without any error.

Could you please verify my statement?

Kohana DB builder, MariaDB and PHP7

UNION is behaving differently with newer MariaDB and PHP7.

Kohana's DB builder is using brackets
(SELECT ...) UNION ALL (SELECT ...) ORDER BY id DESC
With brackets result won't be ordered / sorted correctly. Brackets will break ORDER BY.

Here's fix:
SELECT ... UNION ALL SELECT ... ORDER BY id DESC

/modules/database/classes/Kohana/Database/Query/Builder/Select.php

	if ( ! empty($this->_union))
	{
		$query = ''.$query.'';
		foreach ($this->_union as $u) {
			$query .= ' UNION ';
			if ($u['all'] === TRUE)
			{
				$query .= 'ALL ';
			}
			$query .= ''.$u['select']->compile($db).'';
		}
	}

Basic secure settings

There are some settings in every php application that should be turned on, or if not user should be aware that those exist.

During working on some applications based on Kohana I figured those out, but someday maybe someone else will need them (most likely), so I will share those with the community.

Can we name and add this to Packagist?

I'm currently using the Kohana 3.4 packages from composer on a site I hope to upgrade to PHP 7 to take advantage of the performance improvements.

Would it make sense to get this added to packagist, at least for easy updates? Although it's a full framework, it should be relatively trivial to continue to use an existing Kohana site with modules and the system directory pointing to the appropriate locations in vendor. koseven/koseven or koseven/framework would be a good name (pending the decision to split into separate modules and core).

I can put in a pull request for a change to the composer.json file if everyone thinks it's a good idea.

Thoughts?

Cache _sanitize_id improve to avoid duplicated entries

Scenario:

You have 2 installations of KO7 in the same server with APCu active or memcached or redis... Both store a cache entry named "test". This will overwrite the one the other... We should make the _sanitize_id unique per installation? maybe adding an option cache prefix? in the config?

Possible solution, NOT TESTED

https://github.com/koseven/koseven/blob/devel/modules/cache/config/cache.php

	'apcu'      => array(
		'driver'             => 'apcu',
		'default_expire'     => 3600,
                'prefix'     => 'cache1_',//or NULL
	),

https://github.com/koseven/koseven/blob/devel/modules/cache/classes/Kohana/Cache.php#L298

protected function _sanitize_id($id)
	{
                //cache prefix
                if (isset($this->_config['prefix']) AND $this->_config['prefix']!=NULL)
                     $id = $this->_config['prefix'].$id;

		// Change slashes and spaces to underscores
		return str_replace(array('/', '\\', ' '), '_', $id);
	}

ORM count_all reset query

By default count_all will reset your query.

See line https://github.com/koseven/koseven/blob/master/modules/orm/classes/Kohana/ORM.php#L1823

This is for me super annoying specially when you want to do pagination.

My proposal:

/**
     * Count the number of records in the table. Modified does not reset!
     * @param bool $reset optional to reset the query
     * @return integer
     */
    public function count_all($reset = FALSE)
    {
        $selects = array();

        foreach ($this->_db_pending as $key => $method)
        {
            if ($method['name'] == 'select')
            {
                // Ignore any selected columns for now
                $selects[] = $method;
                unset($this->_db_pending[$key]);
            }
        }

        if ( ! empty($this->_load_with))
        {
            foreach ($this->_load_with as $alias)
            {
                // Bind relationship
                $this->with($alias);
            }
        }

        $this->_build(Database::SELECT);

        $records = $this->_db_builder->from(array($this->_table_name, $this->_object_name))
            ->select(array(DB::expr('COUNT('.$this->_db->quote_column($this->_object_name.'.'.$this->_primary_key).')'), 'records_found'))
            ->execute($this->_db)
            ->get('records_found');

        // Add back in selected columns
        $this->_db_pending += $selects;

        //Edited!
        if ($reset === TRUE)
            $this->reset();

        // Return the total number of records in a table
        return (int) $records;
    }

Changes the behaviour by not resetting the query by default.... I like it more. But if we do not want to change the behavior we only need to do it like:

/**
     * Count the number of records in the table. Modified does not reset!
     * @param bool $reset optional to reset the query
     * @return integer
     */
    public function count_all($reset = TRUE)
    {
        $selects = array();

        foreach ($this->_db_pending as $key => $method)
        {
            if ($method['name'] == 'select')
            {
                // Ignore any selected columns for now
                $selects[] = $method;
                unset($this->_db_pending[$key]);
            }
        }

        if ( ! empty($this->_load_with))
        {
            foreach ($this->_load_with as $alias)
            {
                // Bind relationship
                $this->with($alias);
            }
        }

        $this->_build(Database::SELECT);

        $records = $this->_db_builder->from(array($this->_table_name, $this->_object_name))
            ->select(array(DB::expr('COUNT('.$this->_db->quote_column($this->_object_name.'.'.$this->_primary_key).')'), 'records_found'))
            ->execute($this->_db)
            ->get('records_found');

        // Add back in selected columns
        $this->_db_pending += $selects;

        //Edited!
        if ($reset === TRUE)
            $this->reset();

        // Return the total number of records in a table
        return (int) $records;
    }

What do you think? ;)

Deprecated ini values

Both safe_mode and register_globals are deprecated as of PHP 5.3.0. And are removed from PHP 5.4.0.
Should we check for the PHP version?

if ((PHP_VERSION_ID < 50300) AND ini_get('register_globals'))

and

Kohana::$safe_mode = (PHP_VERSION_ID > 50300) OR ((bool) ini_get('safe_mode'));

Insulation system files: Breaks Kohana on some hosting providers

By moving the system files to a separate directory it will be impossible to use Kohana on some hosting providers (the ones who only allow FTP access to the root directory).

Shouldn't we support both options? Trough install.php, configuration option, ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.