Code Monkey home page Code Monkey logo

swiftlet's People

Contributors

aliasio avatar joechilds avatar tomasliubinas 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

swiftlet's Issues

Controllers in subfolder

Hi,

Firstly thanks for creating this, look like it's exactly what I'm looking for!

Though I have an issue that I have fixed with a bit of a hack. But i'm not sure if I was just doing something wrong in the first place.

I have my file structure like this:

Controllers
--Index.php
--Admin
---- Login.php
---- Index.php

Now I thought I should have been able to just call /admin_login/ to call the login controller. if I went to admin_index it would work fine. But not admin_login.. I had named the login and index classes Admin_Login, Admin_Index... Not sure if i was supposed to do that but it make Admin_Index work.

The error thrown was a on the autoloader it couldn't find the file.. It's not caught as a 404 because at :

!is_file('Swiftlet/Controllers/' . $controllerName . '.php') << This point

$controllerName = 'Swiftlet\Controllers' . basename($controllerName); <<< This hasn't yet happened

at that point you lose the /admin/ from the file location..

$controllerName = 'Swiftlet\Controllers' . str_replace("/",'',$controllerName);

I changed it to the above as a bit of a hack... Then renamed the classes from Admin_Index, Admin_Login to just Login and Index.

I'm not sure if I'm just doing something wrong so any input would be appreciated

error on clean install beta

MESSAGE:

Undefined index: children

FILE: C:\wamp\www\koten\swiftlet\admin\pages\index.php
LINE: 330
NO: 8

.htaccess missing

.htaccess is missing in download, this makes an error when using TRUE on URL rewrite in _config.php

Installer dead ?

Hi.

When I try to install a plugin I have this error :
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '{versions} ( id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, plugin VARCHAR(255' at line 1

CREATE TABLE {versions} ( id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, plugin VARCHAR(255) NOT NULL, version VARCHAR(10) NOT NULL, PRIMARY KEY (id), UNIQUE plugin (plugin) ) ENGINE = INNODB;

Cheers.

$this danger.

I'm currently having some issues with the viewing model, when adding a simple in the template/view files, one could access all dataflow. Including admin password & mysql data.

I know nobody should access these files, but isn't that leaving a door open wide ?

Including libraries

I have a question on how to include or require a certain library. I don't have problems including a library directly into the index.php file around where the App.php is loaded but I don't want to always include all the libraries if they are not required. So I would like to include a library in the Controller but all I get is a 500 error and no exception description. How can I fix this?

creating user fails (alfa)

when creating a new user, from admin panel, swiftlet returns an error, saying the "edit-pasword" has not been filled, while the field is not given.

getController()

Big changes last days, have to get used to it :) Where should be the lib folder, probably in the root.
Anyways, I have one idea. At the moment you can get either from View or Application the name of
the view in string. This is useful if you want to know which View you are in for example. But there
is no function to get the name of a controller like getName() in Controller or getController() in
the Application. Would be great to also get the name of the Controller somehow in string.

$_rootPath

In the App::run() function the $_rootPath doesn't get set if the FILE an $_SERVER['DOCUMENT_ROOT'] are not the same which can be a case of a virtual directory.

details

So I see there's some extra stuff in the code...

In \Swiftlet\App.php every model is instantiated with 3 arguments.

public function getModel($modelName)
{
  $modelName = 'Swiftlet\Models\\' . ucfirst($modelName);

  // Instantiate the model
  return new $modelName($this, $this->view, $this->controller);
}

But the \Swiftlet\Model.php has only one argument in definition. Comment is written for three.

/**
     * Constructor
     * @param object $app
     * @param object $view
     * @param object $controller
     */
    public function __construct(Interfaces\App $app)
    {
        $this->app = $app;
    }

\Swiftlet\Interfaces\Model.php has also just one argument defined.

Controller's title

I think at the moment it is impossible to get the Controller's title either from $this->app or directly from the Controller.

error 404

In the Controller of Error 404 there is in the default action the following:

header("Status: 404 Not Found");

On php.net it's written that "For FastCGI you must use the code above for a 404 response".
However not every server runs FastCGI so I suggest adding both variations:

header("HTTP/1.0 404 Not Found");
header("Status: 404 Not Found");

Otherwise the server doesn't respond with error header so that's not really good.

View->set() is limited to strings

View Swiftlet\View->set(string $variable [, string $value ])

Would be great if you could by default also set objects or arrays.
I think using htmlEncode() by default is not really necessary and
could be like a parameter wish.

case sensitive routing

Just a notice that the app is case-sensitive for routing. Views /test and /Test are not the same. Controllers will be the same but not views so this should be discussed.

InnoDB max bytes limitation

I noticed that the 'plugin' field length is 256 as stated here, which raised an error on my local MySQL server (and maybe for others too??). I've fixed this by changing 'plugin' field length to 255.

Specified key was too long; max key length is 767 bytes

PS : I love Swiftlet's simplicity anyway :)

passing variables

I think it would be great to have some kind of mechanism to also set variables for the Controller.
For example I have plugins or hooks made for session start and for authorization purposes and I would need to pass the authorization status to a Controller. I can pass now to View and read from it in a Controller but that's not so nice. Would be great to also have Controller->set() and Controller->get().

Object & string encoding in the view

If you pass an object from the controller to the view, the string properties of the object are html encoded over and over again each time you access the object in the view.

In controller:
$o->string1 = "&";
$this->view->o = $o;

In view:
echo $this->o->string1; // &
echo $this->o->string1; // &amp;
echo $this->o->string1; // &amp;amp;
....

throw new Exception

In the App.php all the lines with:
throw new Exception
should be corrected to:
throw new \Exception

Maybe in some other files too, didn't check.

svn "bugs"

unit tests :
FAILED: Uploading a file in /admin/files/.

in index there is $new_plugins, this should be $newPlugins ;)

if ( count($newPlugins) )
{
$view->notices[] = $model->t(
'%1$s Plug-in(s) require installation (go to %2$s).',
array(
count($newPlugins),
'/installer/'
)
);
}

pre-install checks

Its small, but here is already a db connection check even before entering the plugin install, while at that point, you still don't know if i'm going to use that database. :)

Make proper use of namespaces

Hi, just stumbled upon your framework and am quite interested in using it for some smaller projects, the tiny footprint is very neat especially considering that it still manages to fulfil the basic needs of a framework.

One thing I don't like about it though is that you're not actually utilising namespaces, the only use you get out of them right now is that you will be able to easily embed your framework with other libraries or even other frameworks, but that's not a very feasible scenario to begin with.

You're still forcing users to use class names like "IndexController" whilst namespaces would allow you to just name it Index within the namespace Swiftlet\Controllers. Personally I would much favour this approach as I've never been a fan of mixing the namespace inside the class name, sure it works.. and it's easy with legacy IDE's.. but then what's the point of using namespaces to begin with.

Anyway, would love to hear what your thoughts are on this, looking forward to seeing where this framework might go.

Clean install error

Hi.

I just downloaded Swiftlet that I didn't know and when I tried to install I had this error :
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in C:\wamp\www\swiftlet_controllers\Installer.php on line 179

A comma is missing at the end of the line 178 : ':version' => $this->outdatedPlugins[$plugin]->version

Cheers.

wrong comment

/*

  • debugMode should be set to FALSE when running in a production environment
    */
    $config['debugMode'] = $config['testing']; // TRUE | FALSE

i know the var is made +/- 10 lines above it but still true|false seems misplaced here.

feature wish

As I'm using Swiftlet for some time now I would sure wish that the view files get splitted into actions. Having one view file for the whole controller can get quite messy if there are plenty of actions. Instead it would be maybe better if view files get splitted into {controller}_{action}.html.php

Warning: Invalid callback Swiftlet\App::error, cannot access private method Swiftlet\App::error()

Hey,

First of all great tiny little useful framework. Am working on it at the moment.

But if I put a variable $_POST['bla'] in a controller and with no error reporting I get nothing.
But if I use error reporting then I get this error:

Warning: Invalid callback Swiftlet\App::error, cannot access private method Swiftlet\App::error() in controllers/IndexController.php on line 16

Apparently you can't reach error() function that is in App from a Controller.

It's a warning and it can be dismissed but I don't like just ignoring warnings.

can't login....

i have installed framework on my system but when i try to login in it username n password (sysPassword) it doesnt login in......plz help me..... im new to this framework want to learn more on this framework....

error on clean install (alfa)

Warning: require(../../_model/init.php) [function.require]: failed to open stream: No such file or directory in C:\wamp\www\swift\installer\index.php on line 13
Fatal error: require() [function.require]: Failed opening required '../../_model/init.php' (include_path='.;C:\php5\pear') in C:\wamp\www\swift\installer\index.php on line 13

changing (installer/index.php)
$contrSetup = array(
'rootPath' => '../../',
'pageTitle' => 'Plug-in installer'
);
to
$contrSetup = array(
'rootPath' => '../',
'pageTitle' => 'Plug-in installer'
);

fixes this issue

url parsing in pages.

Don't really know if this issue is made by me or by swiftlet, but when i enter a link in page plugin, it returns in html as : localpath/url instead of url. In the database its normal url, ...
latest alfa version of swiflet

  • svenn

ORM integration with namespace

I would really like to start off by saying this is one of the best lightweight MVC frameworks out there. I am certainly using this on all my projects and this will give them the structure and standards they need right out of the box. I have looked at hundreds and none follow any good standard.

As you highlight in your Readme it does not include an ORM which is a shame as most if not all projects this will be used on will included some sort of database. Of course anyone can add one but I feel that it will always be more of a hack job and an after thought the part of the core.

There are many great ORM's out there and I have integrated PHP ActiveRecord. But I am not the most advanced php programmer so I know the way I have integrated it will probably break all the good standards in the framework.

The main issue I was having was with the namespaces. For example in my controller it would access the model and find records by User::find('all'). However I would get and error that class could not be found because the namespaces would get appended. So it would look for the module class Swiftlet\Controllers\User. Obviously getting the Swiftlet\Controller\ from the controller it is in.

I can work around it by using \User::find('all') instead but I feel that again breaks the standards and the spirit of the framework.

Thanks again.

Route method

Thank you for this framework, I really like it, and fit my requirements for my new project
I have quick question, how to handle different route method such as get, post, etc in controller?

upload plugin at svn

files get renamed from **.mp3 or **.txt to strings like "28b95f28ce2ee40ff93aa0dab7814d2b713592b7" and bcous of that, they don't link right :)

unable to call node/0

using the menu there is a default node/0 tho the script doesn't use it in the href so its impossible to use node/0

Allowing for multiple autoloaders

I'm working on a new project and I'm trying out Swiftlet - I like it very much so far. One problem I encountered, however, is the autoloader.

/Swiftlet/App.php has an autoload function which is registered using spl_autoload_register. But it seems the autoload function makes no attempt to check if the file exists. So if I run some code using class_exists, the autoload function will attempt to load the file, resulting in an error.

Another problem related to this is being able to register multiple autoloaders. In another issue - #40 - you suggest copying and modifying the autoload function from /Swiftlet/App.php and updating the call to spl_autoload_register to use the new function. But considering the documentation for spl_autoload_register states:

If there must be multiple autoload functions, spl_autoload_register() allows for this. It effectively creates a queue of autoload functions, and runs through each of them in the order they are defined.

I think it might be better to allow users to register their own autoloaders to run in combination with Swiftlet's. And for that to work properly, it seems there needs to be a check for the existence of the file before requireing it. I've done this myself by extending Swiftlet/App and overriding the autoload function to add: if (file_exists($file)) require $file;

bug ID

Oops! An error occured.

[ DEBUG MODE ]

MESSAGE:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"0", 25' at line 1

SELECT id, username FROM sw_users ORDER BY username LIMIT "0", 25;

FILE: /var/www/sw/_app/plugins/Db.php
LINE: 346
NO: 1064
CWD: /var/www/sw

[ BACKTRACE ]

problems overriding public function __construct in a model

public function __construct(Swiftlet\Interfaces\App $app)
{

    parent::__construct ($app);

}

Declaration of Swiftlet\Model\Article::__construct() must be compatible with Swiftlet\Interfaces\Model::__construct(Swiftlet\Interfaces\App $app) in /Applications/MAMP/htdocs/api2/Swiftlet/Models/Article.php on line 9

Action name with dashes

Hey,

me again. There could be a problem with the action name if the URL is like domain.com/flats/two-bedroom. Then the action would be 'two-bedroom' which is SEO friendly but there cannot be dashes in a Controller's method name. So there can't be two-bedroom() method. I would just suggest to correct App.php and use maybe: $this->action = str_replace('-', '_', $action);

database : INT vs TINTYINT

I don't know if this is a real "issue" but I wondered why the field owner in user plugin, is actually a INT(1) while a tintyInt seems more then enough for the bool function it has. Now, I am a really noob at designing database so sorry if I mis a point here.

View file structure

I think it would be also great to sort View file structure to Controller and View. At the moment you get from IndexController and indexAction just index.html.php. It's a bit hard and too much work to separate each View by the action inside a file, would be just better to separate the view into index_action.html.php or something since you can't call two actions at same time anyway.

Setting up

Main index file is missing, no .htaccess file provided either.
After cloning to local server and running composer i can only access /public/ though the url.
The rewrites of url in App class are done server-side and due to no htaccess my server cannot recognize the path layout. Anything other than /public throws 404.

I can call function from controller by get: ?q=index/other. But still i can`t access any other controller than the one hardcoded as in public/index.php

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.