CHAT



Chat with users

This is a single-page-app example built to demonstrate my custom light php framework.
----------------------------------------------------------------------------
After many years of working with codeignitor, I grew dissatisfied with frameworks, feeling that they were too heavyweight for most situations. In some cases, the framework loads over 100 files just to say "Hello World".


The Framework

If a developer is disciplined enough to follow naming conventions, he can use this framework which is composed of only five main files: htaccess, front_controller.php, main.inc.php, config.inc.php, functions.inc.php
/htaccess [framework file] Rewrites the url into a route, and forwards to front_controller.
/front_controller.php [framework file] Decodes the route into a controller and method. Handles authentication, authorization, routing.
/cache A local no-sql cache, mimics memcached method signatures.
/controllers Your controllers go here. They should be named thus: something_controller.php, with methods named thus: do_something().
/data Database and DAO's are here. They are set up in SQLITE. You can change them to mySql or another if wanted.
/helpers A couple of helpers for email and cryptography.
/include Three important framework files are here.
/include/main.inc.php [framework file] Loads config.inc.php and functions.inc.php
/include/config.inc.php [framework file] You will have to change a couple lines in this.
/include/functions.inc.php [framework file] Some convenience functions available to every controller.
/logs A place you can write logfiles.
/models Your models go here. They should be named thus: something_class.php
/static The static folder, has some JS, CSS, Icons.
/views Your views go here. They should be named thus: something_view.php
note: htaccess.txt should be renamed to .htaccess

Routing
---------------
The rules in htaccess rewrite the request thus:
www.domain.com/geo/autocomplete
becomes:
front_controller.php?route=geo/autocomplete

The front-controller decodes this into a route to the appropriate controller
and method thus:
front_controller.php?route=geo/autocomplete
is forwarded to:
the controller: geo_controller.php, and invokes the method: do_autocomplete();

The end result is that a URL of www.domain.com/geo/autocomplete
is forwarded to:
the controller: geo_controller.php, and invokes the method: do_autocomplete();


Each controller should have a method named do_default(), plus any other methods desired.
All should be named "do_something()", such as "do_autocomplete()"


Naming
---------------
Controllers should be named thus: something_controller.php
Models should be named thus: something_class.php
Views should be named thus: something_view.php
Includes should be named thus: something.inc.php


Of note:
The cache is a facade pattern implementation to mimic memcached with either a database or flat-file, it works with SQLITE without any modifications. It can store anything that can be represented by a string or number. Data objects should be serialized or converted to JSON string before storing.


The Application

The application partially implements MVVM design pattern. It holds a model of the chat conversations in Javascript within the page, and updates its model from a RESTful XMLHTTP connection, then updates the view from that model.

The application performs image uploading, resizing, and cropping in order to process images for profiles, emails, and chat images.

The data is all stored in a SQLITE database, so a simple FTP will put this app into operation.

There are three users installed:
id: webmeister@mailinator.com | password: mypw
id: user@mailinator.com | password: mypw
id: guest@mailinator.com | password: mypw

You can easily check password reminders at mailinator

Download this Framework


PROFILE

Email Me
 
[Click on Text to Edit]
Name:

Description:

Age:

Sex:

Location:


Profile JSon

LOGIN



Email Address
Password
 
 
   
 
Users: webmeister@mailinator.com, user@mailinator.com, guest@mailinator.com.
Password is "mypw"


JOIN


Email Address

Modal Text