Start project
This commit is contained in:
parent
2d98c68efd
commit
1897f4984b
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,4 +1,5 @@
|
|||||||
vendor
|
vendor
|
||||||
settings.php
|
settings.php
|
||||||
nbproject/private
|
nbproject/private
|
||||||
*.sync-conflict*
|
*.sync-conflict*
|
||||||
|
*.bak
|
68
README.md
68
README.md
@ -1,66 +1,4 @@
|
|||||||
Business App Template
|
SiteWriter
|
||||||
=====================
|
==========
|
||||||
|
|
||||||
This is an empty (but fully functional) PHP application. It is designed to
|
A public website builder.
|
||||||
integrate with AccountHub, an account management web interface. AccountHub manages
|
|
||||||
user credentials and account data, and is accessed by this app via [a simple API](http://docs.netsyms.com/docs/AccountHub/API%20Documentation/).
|
|
||||||
|
|
||||||
[](https://www.codacy.com/app/Netsyms/BusinessAppTemplate?utm_source=github.com&utm_medium=referral&utm_content=Netsyms/BusinessAppTemplate&utm_campaign=Badge_Grade)
|
|
||||||
|
|
||||||
Program Structure
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
### Folders
|
|
||||||
* lang
|
|
||||||
Translations and alert messages.
|
|
||||||
The language file that is loaded depends on the value of `LANGUAGE` in `settings.php`.
|
|
||||||
Translate the values (but not the keys) in `en_us.php` into other languages and save in appropriately named files to add languages.
|
|
||||||
* lib
|
|
||||||
A good place to put helper functions that you don't want "in the way".
|
|
||||||
* pages
|
|
||||||
What it looks like. If you go into `pages.php` and define a page with the name `foo`, there should be a `foo.php` in here.
|
|
||||||
The app checks before loading, so it will give a friendly 404 error if it doesn't find your page.
|
|
||||||
Woe to you if you delete `home.php` or `404.php`, as those are assumed to exist for fallback behavior.
|
|
||||||
* static
|
|
||||||
CSS, JS, fonts, images...
|
|
||||||
* vendor
|
|
||||||
If you don't know what this is about, or you don't have it, you need to read up on Composer. Right now.
|
|
||||||
|
|
||||||
### Files
|
|
||||||
* settings.template.php
|
|
||||||
App configuration. Copy to `settings.php` and customize. Documented with inline comments.
|
|
||||||
* required.php
|
|
||||||
The "duct tape" that holds the app together. Use `require_once __DIR__."/required.php"` at the top of every file.
|
|
||||||
It loads Composer dependencies, app settings, language data, and creates `$database` for accessing the database.
|
|
||||||
It also has some utility functions, including `dieifnotloggedin()`, `is_empty($var)`, and `lang('key')`.
|
|
||||||
Read through it to see what those functions do.
|
|
||||||
* action.php
|
|
||||||
A good place to post forms to. By default it only handles logging out, but is easily expanded.
|
|
||||||
* api.php
|
|
||||||
Similar to action.php, but designed for user/pass authenticated JSON responses.
|
|
||||||
* index.php
|
|
||||||
Login page and handler. Hands off to `app.php` after authenticating user.
|
|
||||||
It includes 2fa support, by the way.
|
|
||||||
* app.php
|
|
||||||
Main app page after login. Handles loading app pages and 404 errors.
|
|
||||||
Redirects to `index.php` if the user is not logged in.
|
|
||||||
Note: to show an alert message (success, error, whatever), set the GET argument `msg` to a message ID from `lang/messages.php`.
|
|
||||||
* pages.php
|
|
||||||
Define app pages/screens in an array. The page ID/array key is assumed to exist as a file `pages/{key}.php`, or it will 404.
|
|
||||||
__Optional parameters:__
|
|
||||||
`'navbar' => true` will show the page as a button in the app menu bar.
|
|
||||||
`'icon' => '...'` will show an icon from FontAwesome in the menu bar. Setting this to `home` will show the icon `fa-home`.
|
|
||||||
`'styles' => ["file.css"]` will inject the listed CSS files into the page header (after all other CSS, like Bootstrap).
|
|
||||||
`'scripts' => ["file.js"]` will inject the listed JavaScript files into the page footer (after jQuery and other builtin scripts).
|
|
||||||
* lang/messages.php
|
|
||||||
Array of alert messages.
|
|
||||||
`"string"` is the language string for the message, `"type"` is one of `success`, `info`, `warning`, or `danger` (i.e. Bootstrap alert classes).
|
|
||||||
Changing the type changes the icon and color of the alert box.
|
|
||||||
*lang/en_us.php
|
|
||||||
Language data for US English.
|
|
||||||
*lib/login.php
|
|
||||||
Functions for logging in users and stuff like that. Most functions transparently makes requests to the AccountHub API and return the results.
|
|
||||||
*lib/userinfo.php
|
|
||||||
Functions for getting user data, like real names and managed employees.
|
|
||||||
*static/css/app.css
|
|
||||||
Custom styles for the app. See the comments inside for instructions on theming the app.
|
|
2
app.php
2
app.php
@ -108,7 +108,7 @@ END;
|
|||||||
// For mobile app
|
// For mobile app
|
||||||
echo "<script nonce=\"$SECURE_NONCE\">var navbar_breakpoint = \"$navbar_breakpoint\";</script>"
|
echo "<script nonce=\"$SECURE_NONCE\">var navbar_breakpoint = \"$navbar_breakpoint\";</script>"
|
||||||
?>
|
?>
|
||||||
<nav class="navbar navbar-expand-<?php echo $navbar_breakpoint; ?> navbar-dark bg-blue fixed-top">
|
<nav class="navbar navbar-expand-<?php echo $navbar_breakpoint; ?> navbar-light bg-light-blue fixed-top">
|
||||||
<button class="navbar-toggler my-0 py-0" type="button" data-toggle="collapse" data-target="#navbar-collapse" aria-controls="navbar-collapse" aria-expanded="false" aria-label="Toggle navigation">
|
<button class="navbar-toggler my-0 py-0" type="button" data-toggle="collapse" data-target="#navbar-collapse" aria-controls="navbar-collapse" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
<!--<i class="fas fa-bars"></i>-->
|
<!--<i class="fas fa-bars"></i>-->
|
||||||
<span class="navbar-toggler-icon"></span>
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
28
composer.lock
generated
28
composer.lock
generated
@ -4,21 +4,21 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"hash": "577921e9d14ff39571692f88476151ee",
|
"hash": "5c7439c6e041764f2f6b0270a95ab3ae",
|
||||||
"content-hash": "1c8b61c5d506ae016285b99b20040cf0",
|
"content-hash": "e4e700119f47d2f68b0ed82abaf8c5c6",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "catfan/medoo",
|
"name": "catfan/medoo",
|
||||||
"version": "v1.5.3",
|
"version": "v1.5.6",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/catfan/Medoo.git",
|
"url": "https://github.com/catfan/Medoo.git",
|
||||||
"reference": "1aa25a4001e0cfb739ba2996f00f4a3d2a7fdf07"
|
"reference": "f77a93f72864e892c99d1033b8733e5da8fb0b3b"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/catfan/Medoo/zipball/1aa25a4001e0cfb739ba2996f00f4a3d2a7fdf07",
|
"url": "https://api.github.com/repos/catfan/Medoo/zipball/f77a93f72864e892c99d1033b8733e5da8fb0b3b",
|
||||||
"reference": "1aa25a4001e0cfb739ba2996f00f4a3d2a7fdf07",
|
"reference": "f77a93f72864e892c99d1033b8733e5da8fb0b3b",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -64,20 +64,20 @@
|
|||||||
"sql",
|
"sql",
|
||||||
"sqlite"
|
"sqlite"
|
||||||
],
|
],
|
||||||
"time": "2017-12-25 17:02:41"
|
"time": "2018-03-26 17:54:24"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "guzzlehttp/guzzle",
|
"name": "guzzlehttp/guzzle",
|
||||||
"version": "6.3.0",
|
"version": "6.3.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/guzzle/guzzle.git",
|
"url": "https://github.com/guzzle/guzzle.git",
|
||||||
"reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699"
|
"reference": "68d0ea14d5a3f42a20e87632a5f84931e2709c90"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/f4db5a78a5ea468d4831de7f0bf9d9415e348699",
|
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/68d0ea14d5a3f42a20e87632a5f84931e2709c90",
|
||||||
"reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699",
|
"reference": "68d0ea14d5a3f42a20e87632a5f84931e2709c90",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -87,7 +87,7 @@
|
|||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"ext-curl": "*",
|
"ext-curl": "*",
|
||||||
"phpunit/phpunit": "^4.0 || ^5.0",
|
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4",
|
||||||
"psr/log": "^1.0"
|
"psr/log": "^1.0"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
@ -96,7 +96,7 @@
|
|||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "6.2-dev"
|
"dev-master": "6.3-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@ -129,7 +129,7 @@
|
|||||||
"rest",
|
"rest",
|
||||||
"web service"
|
"web service"
|
||||||
],
|
],
|
||||||
"time": "2017-06-22 18:50:49"
|
"time": "2018-03-26 16:33:04"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "guzzlehttp/promises",
|
"name": "guzzlehttp/promises",
|
||||||
|
BIN
database.mwb
Normal file
BIN
database.mwb
Normal file
Binary file not shown.
@ -3,7 +3,7 @@
|
|||||||
<type>org.netbeans.modules.php.project</type>
|
<type>org.netbeans.modules.php.project</type>
|
||||||
<configuration>
|
<configuration>
|
||||||
<data xmlns="http://www.netbeans.org/ns/php-project/1">
|
<data xmlns="http://www.netbeans.org/ns/php-project/1">
|
||||||
<name>BusinessAppTemplate</name>
|
<name>SiteWriter</name>
|
||||||
</data>
|
</data>
|
||||||
</configuration>
|
</configuration>
|
||||||
</project>
|
</project>
|
||||||
|
@ -11,14 +11,14 @@ define("DEBUG", false);
|
|||||||
// Database connection settings
|
// Database connection settings
|
||||||
// See http://medoo.in/api/new for info
|
// See http://medoo.in/api/new for info
|
||||||
define("DB_TYPE", "mysql");
|
define("DB_TYPE", "mysql");
|
||||||
define("DB_NAME", "app");
|
define("DB_NAME", "sitewriter");
|
||||||
define("DB_SERVER", "localhost");
|
define("DB_SERVER", "localhost");
|
||||||
define("DB_USER", "app");
|
define("DB_USER", "sitewriter");
|
||||||
define("DB_PASS", "");
|
define("DB_PASS", "");
|
||||||
define("DB_CHARSET", "utf8");
|
define("DB_CHARSET", "utf8");
|
||||||
|
|
||||||
// Name of the app.
|
// Name of the app.
|
||||||
define("SITE_TITLE", "Web App Template");
|
define("SITE_TITLE", "SiteWriter");
|
||||||
|
|
||||||
|
|
||||||
// URL of the AccountHub API endpoint
|
// URL of the AccountHub API endpoint
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 17 KiB |
@ -1,6 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
||||||
|
|
||||||
<svg
|
<svg
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
xmlns:cc="http://creativecommons.org/ns#"
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
@ -11,38 +9,36 @@
|
|||||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
width="512"
|
width="512"
|
||||||
height="512"
|
height="512"
|
||||||
viewBox="0 0 512.00001 512.00001"
|
viewBox="0 0 511.99999 511.99999"
|
||||||
id="svg2"
|
id="svg2"
|
||||||
version="1.1"
|
version="1.1"
|
||||||
inkscape:version="0.91 r13725"
|
inkscape:version="0.91 r13725"
|
||||||
sodipodi:docname="logo.svg"
|
sodipodi:docname="logo.svg"
|
||||||
inkscape:export-filename="/home/skylar/Documents/Projects/Sources/WebAppTemplate/static/img/logo.png"
|
inkscape:export-filename="/home/skylar/Documents/Projects/Assets/SiteWriter/logo_512.png"
|
||||||
inkscape:export-xdpi="90"
|
inkscape:export-xdpi="90"
|
||||||
inkscape:export-ydpi="90">
|
inkscape:export-ydpi="90">
|
||||||
<defs
|
|
||||||
id="defs4">
|
|
||||||
<inkscape:perspective
|
|
||||||
sodipodi:type="inkscape:persp3d"
|
|
||||||
inkscape:vp_x="-493.3276 : 245.89848 : 1"
|
|
||||||
inkscape:vp_y="0 : 1000 : 0"
|
|
||||||
inkscape:vp_z="464.45088 : 245.89848 : 1"
|
|
||||||
inkscape:persp3d-origin="-14.438371 : 160.56515 : 1"
|
|
||||||
id="perspective4236" />
|
|
||||||
</defs>
|
|
||||||
<sodipodi:namedview
|
<sodipodi:namedview
|
||||||
id="base"
|
|
||||||
pagecolor="#ffffff"
|
pagecolor="#ffffff"
|
||||||
bordercolor="#666666"
|
bordercolor="#666666"
|
||||||
borderopacity="1.0"
|
borderopacity="1"
|
||||||
inkscape:pageopacity="0.0"
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
inkscape:pageshadow="2"
|
inkscape:pageshadow="2"
|
||||||
inkscape:zoom="0.49497475"
|
inkscape:window-width="1440"
|
||||||
inkscape:cx="-135.9681"
|
inkscape:window-height="842"
|
||||||
inkscape:cy="352.66131"
|
id="namedview14"
|
||||||
inkscape:document-units="px"
|
|
||||||
inkscape:current-layer="layer1"
|
|
||||||
showgrid="false"
|
showgrid="false"
|
||||||
units="px" />
|
inkscape:zoom="0.65186406"
|
||||||
|
inkscape:cx="-263.8452"
|
||||||
|
inkscape:cy="164.6375"
|
||||||
|
inkscape:window-x="1024"
|
||||||
|
inkscape:window-y="156"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="svg2" />
|
||||||
|
<defs
|
||||||
|
id="defs4" />
|
||||||
<metadata
|
<metadata
|
||||||
id="metadata7">
|
id="metadata7">
|
||||||
<rdf:RDF>
|
<rdf:RDF>
|
||||||
@ -51,28 +47,58 @@
|
|||||||
<dc:format>image/svg+xml</dc:format>
|
<dc:format>image/svg+xml</dc:format>
|
||||||
<dc:type
|
<dc:type
|
||||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
<dc:title></dc:title>
|
<dc:title />
|
||||||
</cc:Work>
|
</cc:Work>
|
||||||
</rdf:RDF>
|
</rdf:RDF>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<rect
|
||||||
|
style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:20;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.74509804"
|
||||||
|
id="rect4726-3"
|
||||||
|
width="512"
|
||||||
|
height="512"
|
||||||
|
x="0"
|
||||||
|
y="0"
|
||||||
|
rx="50"
|
||||||
|
ry="50" />
|
||||||
|
<path
|
||||||
|
id="rect4149"
|
||||||
|
d="m 151.84815,105.55999 c 0,0 208.08221,4e-4 208.08221,4e-4 8.87969,2e-5 17.47765,5.42434 19.32647,12.34724 0,0 68.50606,256.52161 68.50606,256.52161 4.65095,17.41553 -3.3789,32.03897 -18.20921,32.01073 0,0 -347.207046,-0.66126 -347.207046,-0.66126 -14.762494,-0.0281 -22.747362,-14.64569 -18.112131,-32.00219 0,0 68.337707,-255.88862 68.337707,-255.88862 1.84592,-6.91197 10.42061,-12.32792 19.27594,-12.32791 0,0 0,0 0,0"
|
||||||
|
style="opacity:1;fill:#03a9f4;fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
<g
|
<g
|
||||||
inkscape:label="Layer 1"
|
transform="matrix(5.9992735,-11.249026,11.249026,5.999273,-1609.4403,-1737.4273)"
|
||||||
inkscape:groupmode="layer"
|
id="g2030"
|
||||||
id="layer1"
|
style="display:inline;stroke-width:1.91200209" />
|
||||||
transform="translate(0,-540.36216)">
|
<rect
|
||||||
<rect
|
ry="11.220414"
|
||||||
style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:20;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.74509804"
|
rx="11.220414"
|
||||||
id="rect4726"
|
y="237.21503"
|
||||||
width="512"
|
x="150.21944"
|
||||||
height="512"
|
height="18.934093"
|
||||||
x="0"
|
width="211.56111"
|
||||||
y="540.36218"
|
id="rect5279"
|
||||||
rx="50"
|
style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||||
ry="50" />
|
<rect
|
||||||
<path
|
style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
id="path4348"
|
id="rect5281"
|
||||||
style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:9.87128067;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
width="245.31049"
|
||||||
d="m 132.93564,682.51771 213.96788,-43.14304 0,313.97496 -213.96788,-37.9643 z m 213.96788,-43.14304 0,313.97496 32.16084,-45.18373 0,-217.44396 z m -213.96788,43.14304 213.96788,-43.14304 32.16084,51.34727 -167.21823,22.47784 z m 78.91049,30.68207 167.21823,-22.47784 0,217.44396 -167.21823,-19.77968 z m -78.91049,-30.68207 0,232.86762 78.91049,-26.99911 0,-175.18644 z m 0,232.86762 213.96788,37.9643 32.16084,-45.18373 -167.21823,-19.77968 z"
|
height="21.954561"
|
||||||
inkscape:connector-curvature="0" />
|
x="133.34476"
|
||||||
</g>
|
y="287.24475"
|
||||||
|
rx="13.010355"
|
||||||
|
ry="13.010355" />
|
||||||
|
<rect
|
||||||
|
style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
id="rect5277"
|
||||||
|
width="188.55019"
|
||||||
|
height="16.874683"
|
||||||
|
x="161.7249"
|
||||||
|
y="189.24477"
|
||||||
|
rx="10"
|
||||||
|
ry="10" />
|
||||||
|
<path
|
||||||
|
style="opacity:1;fill:#3f51b5;fill-opacity:1;stroke:#ffffff;stroke-width:5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 413.40083,100.4255 c -6.25994,-3.614167 -12.82305,-3.883777 -14.71576,-0.605517 L 267.15452,327.63761 c -0.1189,0.20593 -0.21483,0.42009 -0.29174,0.64289 -2.61136,2.10628 3.51508,29.26281 7.21558,31.3993 3.70042,2.13644 30.28348,-6.13458 30.80284,-9.44936 0.1545,-0.17801 0.28948,-0.3696 0.40838,-0.57554 L 436.82014,121.83727 c 1.8927,-3.27826 -1.62235,-8.82729 -7.88226,-12.44145 l -15.53706,-8.97032 z"
|
||||||
|
id="rect4549"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 4.1 KiB |
Loading…
x
Reference in New Issue
Block a user