-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
David Kobia
committed
Sep 24, 2013
0 parents
commit de4a18c
Showing
74 changed files
with
21,440 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.*swp | ||
*~ | ||
*.DS_Store | ||
composer.lock | ||
application/logs/* | ||
application/cache/* | ||
application/config/*.php | ||
.htaccess |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[submodule "system"] | ||
path = system | ||
url = git://github.com/kohana/core.git | ||
[submodule "modules/minion"] | ||
path = modules/minion | ||
url = git://github.com/kohana/minion.git | ||
[submodule "modules/migrations"] | ||
path = modules/migrations | ||
url = git://github.com/kohana-minion/tasks-migrations.git | ||
[submodule "modules/auth"] | ||
path = modules/auth | ||
url = git://github.com/kohana/auth.git | ||
[submodule "modules/database"] | ||
path = modules/database | ||
url = git://github.com/kohana/database.git | ||
[submodule "modules/orm"] | ||
path = modules/orm | ||
url = git://github.com/kohana/orm.git | ||
[submodule "modules/image"] | ||
path = modules/image | ||
url = git://github.com/kohana/image.git | ||
[submodule "modules/cache"] | ||
path = modules/cache | ||
url = git://github.com/kohana/cache.git | ||
[submodule "modules/unittest"] | ||
path = modules/unittest | ||
url = git://github.com/kohana/unittest.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
language: php | ||
|
||
php: | ||
- 5.3 | ||
|
||
before_install: | ||
- "git submodule update --init --recursive" | ||
|
||
before_script: | ||
- "pear channel-discover pear.phing.info" | ||
- "pear install phing/phing" | ||
- "phpenv rehash" | ||
- "composer install" | ||
|
||
script: "phing test" | ||
|
||
notifications: | ||
irc: | ||
channels: | ||
- "irc.freenode.org#kohana" | ||
template: | ||
- "%{repository}/%{branch} (%{commit}) - %{author}: %{message}" | ||
- "Build details: %{build_url}" | ||
email: false |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
PingApp | ||
============ | ||
|
||
### What is PingApp? | ||
|
||
### System Requirements | ||
|
||
To install the platform on your computer/server, the target system must meet the following requirements: | ||
|
||
* PHP version 5.3.0 or greater | ||
* Database Server | ||
- MySQL version 5.5 or greater | ||
- PostgreSQL support is coming | ||
* An HTTP Server. PingApp is known to work with the following web servers: | ||
- Apache 2.2+ | ||
- nginx | ||
* Unicode support in the operating system | ||
|
||
### Installing | ||
|
||
1. Create a database | ||
2. Copy ```application/config/database.template``` to ```application/config/database.php``` | ||
3. Edit ```application/config/environments/development/database.php``` and set database, username and password params | ||
|
||
``` | ||
return array | ||
( | ||
'default' => array | ||
( | ||
'type' => 'mysql', | ||
'connection' => array( | ||
'hostname' => 'localhost', | ||
'database' => 'lamu', | ||
'username' => 'lamu', | ||
'password' => 'lamu', | ||
'persistent' => FALSE, | ||
), | ||
'table_prefix' => '', | ||
'charset' => 'utf8', | ||
'caching' => TRUE, | ||
'profiling' => TRUE, | ||
) | ||
); | ||
``` | ||
|
||
4. Install the database schema using migrations | ||
|
||
```./minion --task=migrations:run --up``` | ||
|
||
5. Copy ```application/config/init.template``` to ```application/config/init.php``` | ||
6. Edit ```application/config/init.php``` and change base_url to point the the httpdocs directory in your deployment | ||
7. Copy ```application/config/auth.template``` to ```application/config/auth.php``` | ||
8. Copy ```application/config/modules.template``` to ```application/config/modules.php``` | ||
9. Copy ```httpdocs/template.htaccess``` to ```httpdocs/.htaccess``` | ||
10. Edit ```httpdocs/.htaccess``` and change the RewriteBase value to match your deployment url | ||
|
||
### Configuration | ||
|
||
Base config files are in ```application/config/```. | ||
|
||
### Default Login | ||
|
||
The default login credentials are admin / westgate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
<?php defined('SYSPATH') or die('No direct script access.'); | ||
|
||
// -- Environment setup -------------------------------------------------------- | ||
|
||
// Load the core Kohana class | ||
require SYSPATH.'classes/Kohana/Core'.EXT; | ||
|
||
if (is_file(APPPATH.'classes/Kohana'.EXT)) | ||
{ | ||
// Application extends the core | ||
require APPPATH.'classes/Kohana'.EXT; | ||
} | ||
else | ||
{ | ||
// Load empty core extension | ||
require SYSPATH.'classes/Kohana'.EXT; | ||
} | ||
|
||
/** | ||
* Set the default time zone. | ||
* | ||
* @link http://kohanaframework.org/guide/using.configuration | ||
* @link http://www.php.net/manual/timezones | ||
*/ | ||
date_default_timezone_set('America/New_York'); | ||
|
||
/** | ||
* Set the default locale. | ||
* | ||
* @link http://kohanaframework.org/guide/using.configuration | ||
* @link http://www.php.net/manual/function.setlocale | ||
*/ | ||
setlocale(LC_ALL, 'en_US.utf-8'); | ||
|
||
/** | ||
* Enable the Kohana auto-loader. | ||
* | ||
* @link http://kohanaframework.org/guide/using.autoloading | ||
* @link http://www.php.net/manual/function.spl-autoload-register | ||
*/ | ||
spl_autoload_register(array('Kohana', 'auto_load')); | ||
|
||
/** | ||
* Optionally, you can enable a compatibility auto-loader for use with | ||
* older modules that have not been updated for PSR-0. | ||
* | ||
* It is recommended to not enable this unless absolutely necessary. | ||
*/ | ||
//spl_autoload_register(array('Kohana', 'auto_load_lowercase')); | ||
|
||
/** | ||
* Enable the Kohana auto-loader for unserialization. | ||
* | ||
* @link http://www.php.net/manual/function.spl-autoload-call | ||
* @link http://www.php.net/manual/var.configuration#unserialize-callback-func | ||
*/ | ||
ini_set('unserialize_callback_func', 'spl_autoload_call'); | ||
|
||
/** | ||
* Set the mb_substitute_character to "none" | ||
* | ||
* @link http://www.php.net/manual/function.mb-substitute-character.php | ||
*/ | ||
mb_substitute_character('none'); | ||
|
||
// -- Configuration and initialization ----------------------------------------- | ||
|
||
/** | ||
* Set the default language | ||
*/ | ||
I18n::lang('en-us'); | ||
|
||
if (isset($_SERVER['SERVER_PROTOCOL'])) | ||
{ | ||
// Replace the default protocol. | ||
HTTP::$protocol = $_SERVER['SERVER_PROTOCOL']; | ||
} | ||
|
||
/** | ||
* Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied. | ||
* | ||
* Note: If you supply an invalid environment name, a PHP warning will be thrown | ||
* saying "Couldn't find constant Kohana::<INVALID_ENV_NAME>" | ||
*/ | ||
if (isset($_SERVER['KOHANA_ENV'])) | ||
{ | ||
Kohana::$environment = constant('Kohana::'.strtoupper($_SERVER['KOHANA_ENV'])); | ||
} | ||
|
||
/** | ||
* Attach a file reader to config. Multiple readers are supported. | ||
*/ | ||
Kohana::$config = new Config; | ||
Kohana::$config->attach(new Config_File); | ||
|
||
/** | ||
* Initialize Kohana, setting the default options. | ||
*/ | ||
Kohana::init(Kohana::$config->load('init')->as_array()); | ||
|
||
/** | ||
* Attach the file write to logging. Multiple writers are supported. | ||
*/ | ||
Kohana::$log->attach(new Log_File(APPPATH.'logs')); | ||
|
||
/** | ||
* Enable modules. Modules are referenced by a relative or absolute path. | ||
*/ | ||
Kohana::modules(Kohana::$config->load('modules')->as_array()); | ||
|
||
/** | ||
* Set cookie salt | ||
* @TODO change this for your project | ||
*/ | ||
Cookie::$salt = 'pingapp-insecure-please-change-me'; | ||
|
||
/** | ||
* Logout Route | ||
*/ | ||
Route::set('logout', 'logout') | ||
->defaults(array( | ||
'controller' => 'login', | ||
'action' => 'logout', | ||
)); | ||
|
||
/** | ||
* Default Route | ||
*/ | ||
Route::set('default', '(<controller>(/<action>(/<id>)))') | ||
->defaults(array( | ||
'controller' => 'dashboard', | ||
'action' => 'index', | ||
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php defined('SYSPATH') OR die('No direct access allowed.'); | ||
|
||
/** | ||
* Dashboard Controller | ||
* | ||
* @author Ushahidi Team <[email protected]> | ||
* @package Ushahidi\Application\Controllers | ||
* @copyright Ushahidi - http://www.ushahidi.com | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License Version 3 (GPLv3) | ||
*/ | ||
class Controller_Dashboard extends Controller_PingApp { | ||
|
||
/** | ||
* Dashboard | ||
* | ||
* @return void | ||
*/ | ||
public function action_index() | ||
{ | ||
$this->template->content = View::factory('pages/dashboard'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php defined('SYSPATH') OR die('No direct access allowed.'); | ||
|
||
/** | ||
* Login Controller | ||
* | ||
* @author Ushahidi Team <[email protected]> | ||
* @package Ushahidi\Application\Controllers | ||
* @copyright Ushahidi - http://www.ushahidi.com | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License Version 3 (GPLv3) | ||
*/ | ||
class Controller_Login extends Controller_Template { | ||
|
||
/** | ||
* @var bool auto render | ||
*/ | ||
public $auto_render = TRUE; | ||
|
||
/** | ||
* @var string page template | ||
*/ | ||
public $template = 'pages/login'; | ||
|
||
public function before() | ||
{ | ||
// Execute parent::before first | ||
parent::before(); | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
public function action_index() | ||
{ | ||
// check, has the form been submitted, if so, setup validation | ||
if ($_POST AND | ||
isset($_POST['username'], $_POST['password'])) | ||
{ | ||
// Get errors for display in view | ||
$validation = Validation::factory($_POST) | ||
->rule('username', 'not_empty') | ||
->rule('password', 'not_empty') | ||
->rule('token', 'not_empty') | ||
->rule('token', 'Security::check'); | ||
|
||
// Check Auth if the post data validates using the rules setup in the user model | ||
if ( $validation->check() AND Auth::instance()->login( | ||
$_POST['username'], | ||
$_POST['password']) ) | ||
{ | ||
HTTP::redirect('dashboard'); | ||
} | ||
else | ||
{ | ||
$this->template->set('username', $_POST['username']); | ||
if ($validation->check()) | ||
{ | ||
$validation->error('password', 'invalid'); | ||
} | ||
$this->template->set('errors', $validation->errors('login')); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Logut action | ||
* @return void | ||
*/ | ||
public function action_logout() | ||
{ | ||
// Sign out the user | ||
Auth::instance()->logout(); | ||
|
||
HTTP::redirect('/'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php defined('SYSPATH') OR die('No direct access allowed.'); | ||
|
||
/** | ||
* Person Controller | ||
* | ||
* @author Ushahidi Team <[email protected]> | ||
* @package Ushahidi\Application\Controllers | ||
* @copyright Ushahidi - http://www.ushahidi.com | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License Version 3 (GPLv3) | ||
*/ | ||
class Controller_Person extends Controller_PingApp { | ||
|
||
/** | ||
* Add/Edit Person | ||
* | ||
* @return void | ||
*/ | ||
public function action_edit() | ||
{ | ||
$this->template->content = View::factory('pages/person/edit'); | ||
} | ||
|
||
/** | ||
* View Person | ||
* | ||
* @return void | ||
*/ | ||
public function action_view() | ||
{ | ||
$this->template->content = View::factory('pages/person/view'); | ||
} | ||
} |
Oops, something went wrong.