system docu

This commit is contained in:
Ulf Gebhardt 2013-11-20 05:05:28 +01:00
parent 2b512233c1
commit a0167916d0
2 changed files with 112 additions and 1 deletions

View File

@ -1,3 +1,5 @@
system
======
System - PHP Framework
System - PHP Framework
Licensed under MIT

View File

@ -0,0 +1,109 @@
##Getting started
SYSTEM is a PHP Lightweight Framework.
You can obtain a copy from https://github.com/gebhardtdasense/system/
SYSTEM provides several management techiques and general purpose funcionality
for a PHP Environment. All features of system are optional for using, altho
might be dependent on other features or standarts SYSTEM provides.
Following funcionality is provided by SYSTEM:
* api - php post/get input validation and handling
* cache - cache using the database as storage for images/other data
* config - configuration of a SYSTEM environment, can be extended for
project purposes
* db - database connection, query and prepare functionality,
supporting MYSQL and POSTGRESQL
* docu - register documentation right were it is - show it in the backend
* log - exceptionhandling - including dbwrite options
* page - html page generation scheme
* sai - Admininterface
* security - Userlogin, register, rights, (email), session management
* system - autoload, database texts, path generation, systemconfig, time
##Setup
Create a new git repository, initialize a submodule for system, check it out,
create a folder named like your project, it will contain all project files,
create a api.php, index.php, sai.php and config.php file.
Dependent on what part of SYSTEM you want to use leave out api or index.
* D: system
* D: project
* F: api.php
* F: index.php
* F: sai.php
* F: config.php
File api.php - console of your webpage (jquery...):
<?php
require_once 'system/autoload.inc.php'; //SYSTEM Classes
require_once 'project/autoload.inc.php'; //Project Classes
require_once 'config.php';
SYSTEM\system::start($project_config);
\SYSTEM\system::include_ExceptionShortcut();
\SYSTEM\system::include_ResultShortcut();
\SYSTEM\system::register_errorhandler_dbwriter();
\SYSTEM\system::register_errorhandler_jsonoutput();
echo \SYSTEM\API\api::run('\SYSTEM\API\verify','api_project',array_merge($_POST,$_GET));
File index.php - Frontend of your webpage:
<?php
require_once 'system/autoload.inc.php'; //SYSTEM Classes
require_once 'project/autoload.inc.php'; //Project Classes
require_once 'config.php'; //Server config
SYSTEM\system::start($project_config);
\SYSTEM\system::include_ExceptionShortcut();
\SYSTEM\system::include_ResultShortcut();
\SYSTEM\system::register_errorhandler_dbwriter();
\SYSTEM\system::register_errorhandler_jsonoutput();
echo \SYSTEM\API\api::run('\SYSTEM\API\verify','page_project',array_merge($_POST,$_GET),1,false,true)->html();
File sai.php - Admin Interface:
<?php
require_once 'system/autoload.inc.php'; //SYSTEM Classes
require_once 'project/autoload.inc.php'; //Project Classes
require_once 'config.php'; //Server config
SYSTEM\system::start($project_config); //Start System time + config
SYSTEM\system::include_ExceptionShortcut(); //allow ERROR() instead of \SYSTEM\LOG\ERROR()
SYSTEM\system::include_ResultShortcut(); //allow JsonResult() instead of \SYSTEM\LOG\JsonResult()
SYSTEM\system::register_errorhandler_dbwriter(); //write errors to database (must be first errorhandler to register)
SYSTEM\system::register_errorhandler_jsonoutput(); //print errors as json to caller
require_once 'system/sai/autoload.inc.php'; //load sai system modules
require_once 'project/sai/autoload.inc.php'; //autoload sai project modules
require_once 'project/sai/register_modules.php'; //register sai project modules
$sai = new SYSTEM\SAI\saigui(); //Draw it
echo $sai->html();
File config.php - Your Server and Project config
<?php
$project_config=array( array(SYSTEM\CONFIG\config_ids::SYS_CONFIG_ERRORREPORTING, E_ALL | E_STRICT),
array(SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL, 'http://www.project.eu/'),
array(SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEPATH, '/home/web/project/'),
array(SYSTEM\CONFIG\config_ids::SYS_CONFIG_DB_TYPE, SYSTEM\CONFIG\config_ids::SYS_CONFIG_DB_TYPE_MYS),
array(SYSTEM\CONFIG\config_ids::SYS_CONFIG_DB_HOST, '127.0.0.1'),
array(SYSTEM\CONFIG\config_ids::SYS_CONFIG_DB_PORT, ''),
array(SYSTEM\CONFIG\config_ids::SYS_CONFIG_DB_USER, 'dbuser'),
array(SYSTEM\CONFIG\config_ids::SYS_CONFIG_DB_PASSWORD, 'dbpw'),
array(SYSTEM\CONFIG\config_ids::SYS_CONFIG_DB_DBNAME, 'dbname'),
array(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_SYSTEMPATHREL, 'system/'),
array(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_NAVIMG, '/system/sai/page/default_page/img/logo.png'),//not working, cuz paths are not set yet! \SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/default_page/img/logo.png')),
array(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_BASEURL, 'http://www.project.eu/sai.php?'),
array(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_TITLE, 'mojotrollz - Admin Area'),
array(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_COPYRIGHT, '<a href="http://www.project.eu/" target="_blank">mojotrollz</a>, &copy; WebCraft Media 2013'),
array(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_LANGS, array('deDE', 'enUS')),
array(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_DEFAULT_LANG, 'enUS'));