From 7e23259aa7cc140cdae31a0f38678df41f7be0c2 Mon Sep 17 00:00:00 2001 From: rylon Date: Fri, 30 May 2014 02:55:07 +0200 Subject: [PATCH] docu --- docu/system/1.system.md | 33 ++++++++++++-- docu/system/2.license.md | 2 +- docu/system/3.getting started.md | 23 +--------- docu/system/system.api.md | 69 +++++++++++++++++++++++++++++ docu/system/system.cache.md | 2 + docu/system/system.config.md | 2 + docu/system/system.db.qq.md | 76 ++++++++++++++++++++++++++++++++ security/RIGHTS.php | 1 - 8 files changed, 181 insertions(+), 27 deletions(-) create mode 100644 docu/system/system.db.qq.md diff --git a/docu/system/1.system.md b/docu/system/1.system.md index 0ed15d5..1d61300 100644 --- a/docu/system/1.system.md +++ b/docu/system/1.system.md @@ -1,5 +1,32 @@ -system +SYSTEM ====== -System - PHP Framework +SYSTEM - PHP Framework -Licensed under MIT \ No newline at end of file +Licensed under MIT + +----------- + +Description +----------- + +SYSTEM is a PHP Lightweight Framework. + +You can obtain a copy from + +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, QQ + * docu - register documentation right were it is - show it in the backend + * files - file management & external access api + * 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 \ No newline at end of file diff --git a/docu/system/2.license.md b/docu/system/2.license.md index 8cccd96..a67cf9a 100644 --- a/docu/system/2.license.md +++ b/docu/system/2.license.md @@ -1,6 +1,6 @@ License ======= -Copyright (c) 2013 TU-Darmstadt, Ulf Gebhardt +Copyright (c) 2014 Ulf Gebhardt Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/docu/system/3.getting started.md b/docu/system/3.getting started.md index 5a1b331..15f31f9 100644 --- a/docu/system/3.getting started.md +++ b/docu/system/3.getting started.md @@ -1,27 +1,6 @@ ##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 +This is an introduction how to setup a webpage with system ##Setup diff --git a/docu/system/system.api.md b/docu/system/system.api.md index e69de29..b1a46aa 100644 --- a/docu/system/system.api.md +++ b/docu/system/system.api.md @@ -0,0 +1,69 @@ +SYSTEM API +---------- + +The SYSTEM-Api allows you to validate post/get/jsonpost parameters to function-calls. +This allows you to direct calls to your website to a class which can process those +calls in a typesave maner. + +WARNING: This Method breaks inheritance in some use-cases! + +How it Works +------------ + +Mapping of URLs to Functions -> thats it basicly + +The URL + + http://mypage.net/api.php?call=test&action=bla¶m1=1¶m2=abc + +maps to + + public static function call_test_action_bla($param1,$param2){} + +if you set your database properly: + + INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1, 0, 0, -1, NULL, 'call', NULL); + INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (2, 0, 0, 1, 'test', 'action', NULL); + INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (3, 0, 2, 2, 'bla', 'param1', 'UINT'); + INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (4, 0, 2, 2, 'bla', 'param2', 'STRING'); + +(note that the params are on the same level of the tree) +now you just need a php class with your function + + look there + echo \SYSTEM\API\api::run('my_verify', 'api_dasense',$json, 25); + +note the use of api group 25 - this allows you to construct several apis. \ No newline at end of file diff --git a/docu/system/system.cache.md b/docu/system/system.cache.md index e69de29..463d5d1 100644 --- a/docu/system/system.cache.md +++ b/docu/system/system.cache.md @@ -0,0 +1,2 @@ +cache +----- \ No newline at end of file diff --git a/docu/system/system.config.md b/docu/system/system.config.md index e69de29..7fd5b2d 100644 --- a/docu/system/system.config.md +++ b/docu/system/system.config.md @@ -0,0 +1,2 @@ +config +------ \ No newline at end of file diff --git a/docu/system/system.db.qq.md b/docu/system/system.db.qq.md new file mode 100644 index 0000000..d98b5a4 --- /dev/null +++ b/docu/system/system.db.qq.md @@ -0,0 +1,76 @@ +QQ Objects +---------- + +Referenz: + +QQ-Objekte können von zwei verschiedenen Klassen erben: + + - QQ (quick query) + - QP (quick prepare) + +Class Definitions: + + class MY_QUERY_QQ extends \SYSTEM\DB\QQ {} + class MY_QUERY_QP extends \SYSTEM\DB\QP {} + + +Je nachdem was du benutzt kannst du in deinem SQL String $1,$2,$3... +benutzen oder nicht (prepare hat $1..., query hat das nicht). +Folglich mache alle Querys ohne Paramter als QQ, alle mit als QP Klasse! + +Der Unterschied der Klassen ist einfach, dass bei allen Funktionen von QP +ein array mit den Parametern übergeben werden muss. + +Es gibt 4 Funktionen + + - QQ (selber über die daten loopen) + - Q1 (geb mir genau eine zeile) + - QA (geb mir alle Zeilen) + - QI (Insert/Delete... -> returns true) + +Q1 +-- + + MY_QUERY_QQ::Q1() + -> array(feld1 => value, feld2 => value...) + + MY_QUERY_QP::Q1(array(param1,param2,...)) + -> array(feld1 => value, feld2 => value...) + +QA +-- + + MY_QUERY_QQ::QA() + -> array(array(feld1 => value, feld2 => value...), array(feld1 => ...)) + MY_QUERY_QP::QA(array(param1,param2,...)) + -> array(array(feld1 => value, feld2 => value...), array(feld1 => ...)) + +QI +-- + + MY_QUERY_QQ::QI() + -> true/false + MY_QUERY_QP::QI(array(param1,param2,...)) + -> true/false + +QQ +-- + + $result = array(); + $rows = MY_QUERY_QQ::QQ(); + while($row = $rows->next()){ //1. über alle loopen + $row[field1] = 5; + $result[] = $row; + } + + -> QQ Benutzen, um das Datenbank Ergebnis auszuschmücken ohne zweimal über + das ergebniss zu loopen: + +Wrong +----- + $result = array(); + $rows = MY_QUERY_QQ::QA(); // 1. über alle loppen + foreach($rows as $row){ // 2. über alle loopen + $row[field1] = 5; + $result[] = $row; + } \ No newline at end of file diff --git a/security/RIGHTS.php b/security/RIGHTS.php index dc785ed..ebc1781 100644 --- a/security/RIGHTS.php +++ b/security/RIGHTS.php @@ -1,5 +1,4 @@