[Owncloud] Re: suggestions for improvement

François K. daitheflu at free.fr
Fri Nov 5 15:17:28 UTC 2010


Me again :)
Just a word to say that I fully agree with s8inac.

1/ Regarding files organization, I personnaly do the following for every projects I manage :

 + apps
    + application_1
       + classes
       + config
       + controllers
       + misc
       + views
       - index.php
    - index.php
 + www
    + application_1
       + css
       + images
       + js
       - index.php
    - index.php

Let me explain the thing :
I always separate the "public" folder (here it's called 'www', but yours might be 'public_html' or whatever) from the rest for security purpose. Everything in 'www' should be considered as public. When the webserver works as expected, it's OK to have everything in it (included .php files), but when it doesn't, it can suck a lot. Facebook got hacked because of that : the webserver was serving .php files as plain text !
So, in my 'www' folder, I have only :
- a 'css' folder that contains stylesheets,
- a 'js' folder that contains javascripts,
- an 'images' folder with all images,
- an index.php file that "redirects" (require_once) to "../../apps/application_1/index.php".

See ? Nothing important in it. So, if the webserver fails and starts to serve files as plain text, hackers would only see the path to the app index page (which isn't important since it's not public).

In the apps folder, I have a folder for each hosted app/site ('application_1' in my example). Each one contains :
- a 'classes' folder where I store all my classes,
- a 'config' folder to store config files (app preferences or DB connexion stuff),
- a 'controllers' folder to store the PHP programs that do stuff such as querying the DB, getting stuff from files, etc.,
- a 'misc' folder to store helpers PHP functions, libraries, and stuff like that,
- a 'views' folder to store HTML files that can be filled with data gathered by controllers, thanks to the PHP alternative syntax (see http://php.net/manual/en/control-structures.alternative-syntax.php).

As you can see, I also have index.php files everywhere to redirect where I want.

Allright, this is just an example. I'm not saying we have to make things this way. But I think it would be a good practice to define a well-structured tree. Examples of files organizations can be found in every PHP framework.

2/ What about defining our own namespace ?

3/ Also, wouldn't it be better for devs to have their own branch rather than their own git clone ?

As always, any comment is welcome !
And I promise to stop bothering you with my emails until tomorrow ;)



----- Mail Original -----
De: info at s8inac.org
À: info at s8inac.org
Cc: owncloud at kde.org
Envoyé: Jeudi 4 Novembre 2010 18h24:41 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne
Objet: [Owncloud] Re: suggestions for improvement


i hadn't much time the last weeks for programming but i had some new  
thoughts about this project.

- we should define a codingstyle, e.g. for each class a file; use folders!
- drop php 4 compatibility for better oop design

and some more but yet not ready

kinds regards
- simon

> Zitat von info at s8inac.org:
> Zitat von Robin Appelman <icewind1991 at gmail.com>:
>> On Tue, Oct 5, 2010 at 23:02,  <info at s8inac.org> wrote:
>>> Dear developers,
>>> since i had read something about this project i was interested in it.
>>> i like kde for many years and wanted always take part in kde but i couldn't
>>> imagine how.
>>> with this project i will contributing kde but as i reviewed the code
>>> it was very
>>> confusing for me. i am developing many years with php that's not   
>>> the reason.
>>> it's the mixed code (php, html and css together) and a bit of smelling
>>> code (it's not personally).
>>> so i have some suggestions for improvement:
>>> - split this mixed code in application and presentation
>>>         - application is e.g. managing files and users
>>>         - presentation is e.g.  a web interface, webdav
>>> - move 3rd party software to lib folder instead of inc
>>> i already started a clone of oc. it is called s8inacs-owncloud on   
>>> gitorious.
>>> wait for your opinion
>>> kind regards
>>> Simon
>> First, sorry about the late reply, I've been pretty occupied with
>> various things lately.
>> I've not taken a good look at your changes yet but the ideas that you
>> propose seem valid enough to me.
>> With 1.1 planned for release somewhere soon, it's probably a little
>> late to put the changes in 1.1,
>> but for the next version I think we can push some, or all of your
>> ideas and changes into the main repo.
>>  - Robin Appelman
> i'm not ready with my changes. may it takes some more weeks or months,
> not including testing. it's would be inteteresting for 2.0 or 3.0.
> but it's would be great if somebody could help me.
> - simon
> _______________________________________________
> Owncloud mailing list
> Owncloud at kde.org
> https://mail.kde.org/mailman/listinfo/owncloud

Owncloud mailing list
Owncloud at kde.org

More information about the Owncloud mailing list