Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.css linguist-language=php
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
phalphp
phalphp
=================
v2.0

基于phalcon框架的PHP应用,可用于Restful API,命令行应用及Web应用。
支持分模块,支持访问权限控制,行为日志记录

A PHP application for APIs,cli,and webapp using the Phalcon framework.

Expand Down
8 changes: 8 additions & 0 deletions api/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
AddDefaultCharset UTF-8

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
</IfModule>
24 changes: 13 additions & 11 deletions public/api.php → api/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
* Driver for PHP HMAC Restful API using PhalconPHP's Micro framework
*
* @package None
* @author Lenix
* @author Itv
* @license none
*/


// Setup configuration files
$dir = dirname(__DIR__);
$appDir = $dir . '/app';

$apiDir = $dir . '/app/modules/Api';
define('API_PATH',$apiDir);
// Necessary requires to get things going
require $appDir . '/library/utilities/debugapi/PhpError.php';
require $appDir . '/library/interfaces/IRun.php';
Expand All @@ -23,13 +24,14 @@
register_shutdown_function(['Utilities\Debugapi\PhpError','runtimeShutdown']);

// Necessary paths to autoload & config settings
$configPath = $appDir . '/config/';
$config = $configPath . 'config.php';
$autoLoad = $configPath . 'autoload-api.php';
$routes = $configPath . 'routes-api.php';

use \Models\Api as Api;

$configPath = $apiDir . '/config/';
$configfile = $apiDir . '/config/';
$config = $appDir . '/config/config.php';
$autoLoad = $configPath . 'autoload.php';
$routes = $configPath . 'routes.php';

use Models\Api as Api;
use Models\Monitorsolution as Monitorsolution;
try {
$app = new Application\Micro();

Expand All @@ -46,7 +48,7 @@
$hash = $app->request->getHeader('API_HASH');

$privateKey = Api::findFirst($clientId)->private_key;

switch ($_SERVER['REQUEST_METHOD']) {

case 'GET':
Expand All @@ -66,7 +68,7 @@

// Setup HMAC Authentication callback to validate user before routing message
// Failure to validate will stop the process before going to proper Restful Route
$app->setEvents(new \Events\Api\HmacAuthenticate($message, $privateKey));
$app->setEvents(new \Events\Api\HmacAuthenticate($message, $privateKey));

// Setup RESTful Routes
$app->setRoutes($routes);
Expand Down

This file was deleted.

This file was deleted.

14 changes: 14 additions & 0 deletions app/cache/volt/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>new page 1</title>
</head>

<body>


</body>
</html>


36 changes: 30 additions & 6 deletions app/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,43 @@
* api & cli & webapp
* Settings to be stored in dependency injector
*/

//define('APP_MODULE_LIST','Admin,Api');
//define('ADMIN_MODULE','Admin');
//define('API_MODULE','Admin');
//define('APP_MODULE_PATH','Modules');
return [
'database' => array(
'adapter' => 'Mysql', /* Possible Values: Mysql, Postgres, Sqlite */
'host' => 'localhost',
'username' => 'root',
'password' => '39552041',
'name' => 'phalconframework',
'password' => '111111',
'name' => 'database',
'port' => 3306
),
'db2' => array(
'adapter' => 'Mysql',
'host' => 'localhost',
'username' => 'root',
'password' => '111111!',
'name' => 'database',
'port' => 3306,
'tablePrefix' => 'smt_'
),
'logdb' => array(
'adapter' => 'Mysql', /* Possible Values: Mysql, Postgres, Sqlite */
'host' => 'localhost',
'username' => 'root',
'password' => '111111!',
'name' => 'database',
'port' => 3306
),
'app' => array(
'debug' => FALSE
)
'debug' => false,
'publicKey' => 'uitv'
),
'tasktime' => 5,
'communityset' => 1, //1开启,0关闭
'serverowner'=>array('1'=>'a','2'=>'b','3'=>'c')

];

57 changes: 0 additions & 57 deletions app/config/routes-api.php

This file was deleted.

20 changes: 0 additions & 20 deletions app/controllers/AdminController.php

This file was deleted.

21 changes: 0 additions & 21 deletions app/controllers/ControllerBase.php

This file was deleted.

16 changes: 0 additions & 16 deletions app/controllers/IndexController.php

This file was deleted.

59 changes: 0 additions & 59 deletions app/controllers/LoginController.php

This file was deleted.

Loading