diff --git a/.gitignore b/.gitignore
index a5d18839..7f9ce2a2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,3 @@
/runtime
/web/assets
-/web/data
-/nbproject/private/
\ No newline at end of file
+/web/data
\ No newline at end of file
diff --git a/controllers/ApiController.php b/controllers/ApiController.php
index 05854ed8..2092c47f 100644
--- a/controllers/ApiController.php
+++ b/controllers/ApiController.php
@@ -35,4 +35,14 @@ class ApiController extends Controller {
}
}
+ public function actionSyncUrl() {
+ if (Yii::$app->request->post()) {
+ $post = Yii::$app->request->bodyParams;
+ $model = new \app\models\FaceLogs();
+ $model->create($post);
+ Yii::$app->response->format = "json";
+ return ["stt" => true];
+ }
+ }
+
}
diff --git a/controllers/DashboardController.php b/controllers/DashboardController.php
index 6f227c96..8fe20fba 100644
--- a/controllers/DashboardController.php
+++ b/controllers/DashboardController.php
@@ -16,6 +16,9 @@ class DashboardController extends Controller {
public function init() {
parent::init();
+ if (Yii::$app->user->isGuest) {
+ return $this->redirect(['/site/login']);
+ }
}
/**
diff --git a/db/app.db b/db/app.db
index 3f4ca5b5..a68c1520 100644
Binary files a/db/app.db and b/db/app.db differ
diff --git a/models/FaceLogs.php b/models/FaceLogs.php
index 3401f428..980fce2d 100644
--- a/models/FaceLogs.php
+++ b/models/FaceLogs.php
@@ -35,7 +35,8 @@ class FaceLogs extends \yii\db\ActiveRecord {
*/
public function rules() {
return [
- [['camera_id', 'confidence', 'enable_door', 'encoded_person_image', 'frametime', 'face_id', 'person_id', 'image', 'status', 'stt', 'timezone', 'name'], 'string'],
+ [['camera_id', 'confidence', 'enable_door', 'encoded_person_image', 'face_id', 'person_id', 'image', 'status', 'stt', 'timezone', 'name'], 'string'],
+ [['frametime'], 'integer']
];
}
@@ -66,8 +67,8 @@ class FaceLogs extends \yii\db\ActiveRecord {
'confidence' => $data['confidence'],
'enable_door' => $data['enable_door'],
'encoded_person_image' => $data['encoded_person_image'],
- 'frametime' => $data['frametime'],
- 'face_id' => $data['face_id'],
+ 'frametime' => date_format(date_create_from_format('Y-m-d H:i:s', $data['frametime']), 'U'),
+ 'face_id' => $data['id'],
'person_id' => $data['person_id'],
'image' => $data['image'],
'status' => $data['status'],
diff --git a/models/SyncUrl.php b/models/SyncUrl.php
new file mode 100644
index 00000000..cbd78d6b
--- /dev/null
+++ b/models/SyncUrl.php
@@ -0,0 +1,56 @@
+ 'ID',
+ 'data' => 'Data',
+ ];
+ }
+
+ public function create($data) {
+ $r = $this->load([
+ 'data' => $data['url'],
+ ], '');
+ if ($r) {
+ try {
+ $this->save();
+ return $this->id;
+ } catch (\Exception $ex) {
+ return false;
+ }
+ }
+ }
+
+}
diff --git a/nbproject/private/config.properties b/nbproject/private/config.properties
new file mode 100644
index 00000000..e69de29b
diff --git a/nbproject/private/private.properties b/nbproject/private/private.properties
new file mode 100644
index 00000000..2455f53c
--- /dev/null
+++ b/nbproject/private/private.properties
@@ -0,0 +1,8 @@
+copy.src.files=false
+copy.src.on.open=false
+copy.src.target=
+remote.connection=BI-9f36c2
+remote.directory=/anpr
+remote.upload=ON_SAVE
+run.as=LOCAL
+url=http://localhost/
diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml
new file mode 100644
index 00000000..6807a2ba
--- /dev/null
+++ b/nbproject/private/private.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/nbproject/project.properties b/nbproject/project.properties
new file mode 100644
index 00000000..911a7b8b
--- /dev/null
+++ b/nbproject/project.properties
@@ -0,0 +1,7 @@
+include.path=${php.global.include.path}
+php.version=PHP_70
+source.encoding=UTF-8
+src.dir=.
+tags.asp=false
+tags.short=false
+web.root=.
diff --git a/nbproject/project.xml b/nbproject/project.xml
new file mode 100644
index 00000000..e4f8b1cc
--- /dev/null
+++ b/nbproject/project.xml
@@ -0,0 +1,9 @@
+
+
+ org.netbeans.modules.php.project
+
+
+ BIFace
+
+
+
diff --git a/web/index.php b/web/index.php
index 20ef696c..ac1919d0 100644
--- a/web/index.php
+++ b/web/index.php
@@ -1,8 +1,8 @@