File tree 5 files changed +34
-23
lines changed
5 files changed +34
-23
lines changed Original file line number Diff line number Diff line change 1
1
.DS_Store
2
+ config.php
Original file line number Diff line number Diff line change
1
+ HTML5 Notepad App
2
+ by Kaspars Dambis
3
+ http://konstruktors.com
4
+
5
+ ## Installation
6
+
7
+ * Copy files up
8
+ * Make a data dir for notebook pages to go into
9
+ * Copy config-example.php to config.php
10
+ * Edit config.php
11
+
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ <?php
2
+ // Example config.php
3
+ // Copy this file to config.php to take effect
4
+
5
+ $ username = "demo " ;
6
+ $ password = "demo " ;
7
+ $ data_dir = "entries "
8
+ ?>
Original file line number Diff line number Diff line change 2
2
3
3
error_reporting (E_ERROR );
4
4
5
- define ('DATA_DIR ' , 'entries ' ); // use this to protect files from being publicly viewable
6
- define ("USERNAME " , 'demo ' );
7
- define ('PASSWORD ' , 'demo ' );
8
-
9
- if (($ _SERVER ['PHP_AUTH_USER ' ] !== USERNAME ) || ($ _SERVER ['PHP_AUTH_PW ' ] !== PASSWORD )) {
10
- header ('WWW-Authenticate: Basic realm="Cloud Notes" ' );
11
- header ('HTTP/1.0 401 Unauthorized ' );
12
- exit ;
5
+ // if config file exists then load it
6
+ if (file_exists ('config.php ' )) {
7
+ require_once ('config.php ' );
8
+ }
9
+
10
+ define ('DATA_DIR ' , isset ($ data_dir ) ? $ data_dir : 'entries ' ); // use this to protect files from being publicly viewable
11
+
12
+ if (isset ($ username ) && isset ($ password )) {
13
+ if (($ _SERVER ['PHP_AUTH_USER ' ] !== $ username ) || ($ _SERVER ['PHP_AUTH_PW ' ] !== $ password )) {
14
+ header ('WWW-Authenticate: Basic realm="Cloud Notes" ' );
15
+ header ('HTTP/1.0 401 Unauthorized ' );
16
+ exit ;
17
+ }
13
18
}
14
19
15
20
header ('Content-type: application/json; charset=utf-8 ' );
@@ -136,4 +141,4 @@ function get_entries() {
136
141
return json_encode ($ entries );
137
142
}
138
143
139
- ?>
144
+ ?>
You can’t perform that action at this time.
0 commit comments