removed system from danube, config
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
namespace DBD;
|
||||
|
||||
class system extends \SYSTEM\DB\DBInfoMYS {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct('host_unet', 'mojotrolls_mysql', 'dajsabeaisvd345', '127.0.0.1');}
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace DBD\SYSTEM;
|
||||
|
||||
class APITable {
|
||||
|
||||
const NAME = 'system.api_calls';
|
||||
|
||||
const FIELD_ID = 'ID';
|
||||
const FIELD_FLAG = 'flag';
|
||||
const FIELD_PARENTID = 'parentID';
|
||||
const FIELD_PARENTVALUE = 'parentValue';
|
||||
const FIELD_NAME = 'name';
|
||||
// const FIELD_ISCHACHED = 'IsCached'; use flagfield!
|
||||
const FIELD_ALLOWEDVALUES = 'allowedValues';
|
||||
|
||||
const VALUE_FLAG_COMMAND = 0;
|
||||
const VALUE_FLAG_PARAM = 1;
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace DBD\SYSTEM;
|
||||
|
||||
class PAGETable {
|
||||
|
||||
const NAME = 'system_page_calls';
|
||||
|
||||
const FIELD_ID = 'ID';
|
||||
const FIELD_FLAG = 'flag';
|
||||
const FIELD_PARENTID = 'parentID';
|
||||
const FIELD_PARENTVALUE = 'parentValue';
|
||||
const FIELD_NAME = 'name';
|
||||
// const FIELD_ISCHACHED = 'IsCached'; use flagfield!
|
||||
const FIELD_ALLOWEDVALUES = 'allowedValues';
|
||||
|
||||
const VALUE_FLAG_COMMAND = 0;
|
||||
const VALUE_FLAG_PARAM = 1;
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace DBD\SYSTEM;
|
||||
|
||||
class UserLoginsTable {
|
||||
|
||||
const NAME = 'system.user_logins';
|
||||
|
||||
const FIELD_ID = 'id';
|
||||
const FIELD_USERID = 'userID';
|
||||
const FIELD_IP = 'IP';
|
||||
const FIELD_SUCC = 'succ';
|
||||
const FIELD_TIMESTAMP = 'timestamp';
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace DBD\SYSTEM;
|
||||
|
||||
class UserRightsTable {
|
||||
|
||||
const NAME = 'system.user_to_rights';
|
||||
|
||||
const FIELD_USERID = 'userID';
|
||||
const FIELD_RIGHTID = 'rightID';
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace DBD\SYSTEM;
|
||||
|
||||
class UserTable {
|
||||
|
||||
const NAME = 'system.user';
|
||||
|
||||
const FIELD_ID = 'id';
|
||||
const FIELD_USERNAME = 'username';
|
||||
const FIELD_PASSWORD_SHA = 'password_sha';
|
||||
const FIELD_PASSWORD_MD5 = 'password_md5';
|
||||
const FIELD_EMAIL = 'email';
|
||||
const FIELD_JOINDATE = 'joindate';
|
||||
const FIELD_LOCALE = 'locale';
|
||||
const FIELD_LAST_ACTIVE = 'last_active';
|
||||
const FIELD_ACCOUNT_FLAG = 'account_flag';
|
||||
}
|
||||
@ -1,43 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace DBD\SYSTEM;
|
||||
|
||||
class locale_string {
|
||||
const NAME = 'system.locale_string';
|
||||
|
||||
const FIELD_ID = 'id';
|
||||
const FIELD_CATEGORY = 'category';
|
||||
const FIELD_EN_US = 'enUS';
|
||||
const FIELD_DE_DE = 'deDE';
|
||||
|
||||
const VALUE_CATEGORY_TEST1 = 1;
|
||||
const VALUE_CATEGORY_TEST2 = 2;
|
||||
|
||||
const VALUE_CATEGORY_SYSTEM = 10;
|
||||
const VALUE_CATEGORY_SYSTEM_ERROR = 11;
|
||||
|
||||
const VALUE_CATEGORY_DASENSE = 100;
|
||||
const VALUE_CATEGORY_DASENSE_DEFAULTPAGE = 110;
|
||||
const VALUE_CATEGORY_DASENSE_GEOPOINT = 111;
|
||||
const VALUE_CATEGORY_DASENSE_IMPRESSUM = 112;
|
||||
const VALUE_CATEGORY_DASENSE_PROJECT = 113;
|
||||
const VALUE_CATEGORY_DASENSE_SENSOR = 114;
|
||||
const VALUE_CATEGORY_DASENSE_USERLOGIN = 115;
|
||||
const VALUE_CATEGORY_DASENSE_USERLOGOUT = 116;
|
||||
const VALUE_CATEGORY_DASENSE_USER = 117;
|
||||
const VALUE_CATEGORY_DASENSE_PRESS = 118;
|
||||
const VALUE_CATEGORY_DASENSE_CONTACT = 119;
|
||||
const VALUE_CATEGORY_DASENSE_USERSTATISTICS = 120;
|
||||
const VALUE_CATEGORY_DASENSE_HIGHSCORE = 121;
|
||||
const VALUE_CATEGORY_DASENSE_DEVS = 122;
|
||||
|
||||
const VALUE_CATEGORY_DB_ADMIN_LEVEL = 200;
|
||||
const VALUE_CATEGORY_DB_BADGE_CATEGORY = 201;
|
||||
const VALUE_CATEGORY_DB_BADGE = 202;
|
||||
const VALUE_CATEGORY_DB_TITLE = 203;
|
||||
const VALUE_CATEGORY_DB_LOCALITY = 204;
|
||||
|
||||
const VALUE_CATEGORY_APP_ALL = 300;
|
||||
const VALUE_CATEGORY_APP_ANDROID = 301;
|
||||
const VALUE_CATEGORY_APP_IOS = 302;
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
<?php
|
||||
namespace DBD\SYSTEM;
|
||||
|
||||
class systemPostgres extends \SYSTEM\DB\DBInfoPG {
|
||||
public function __construct() {
|
||||
parent::__construct('dasense', 'dasense', 'dasenseopendataserver', '212.72.183.108', '5432');}
|
||||
}
|
||||
22
index.php
@ -1,13 +1,19 @@
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
|
||||
require_once 'system/autoload.inc.php'; //SYSTEM Classes
|
||||
require_once 'dbd/autoload.inc.php'; //Database Definitions
|
||||
require_once '../system/autoload.inc.php'; //SYSTEM Classes
|
||||
require_once 'danube/autoload.inc.php'; //Project Classes
|
||||
require_once 'system/log/register_exception_shortcut.php'; //allow ERROR() instead of \SYSTEM\LOG\ERROR()
|
||||
//require_once 'dasense/log/register_errorhandler_dbwriter_dasensedata.php'; //write errors to database (must be first errorhandler to register)
|
||||
require_once 'system/log/register_errorhandler_jsonoutput.php'; //print errors as json to caller
|
||||
require_once '../system/log/register_exception_shortcut.php'; //allow ERROR() instead of \SYSTEM\LOG\ERROR()
|
||||
require_once '../system/log/register_errorhandler_jsonoutput.php'; //print errors as json to caller
|
||||
|
||||
SYSTEM\system::start(array( array(SYSTEM\CONFIG\config_ids::SYS_CONFIG_ERRORREPORTING, E_ALL | E_STRICT),
|
||||
array(SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL, 'www.mojotrollz.eu/web/danube/'),
|
||||
array(SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEPATH, '/home/web/webdir/danube/'),
|
||||
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, 'mojotrolls_mysql'),
|
||||
array(SYSTEM\CONFIG\config_ids::SYS_CONFIG_DB_PASSWORD, 'dajsabeaisvd345'),
|
||||
array(SYSTEM\CONFIG\config_ids::SYS_CONFIG_DB_DBNAME, 'host_unet')));
|
||||
|
||||
$page = new \SYSTEM\PAGE\PageApi( new DBD\system(), new SYSTEM\verifyclass(), new PageApi());
|
||||
$page = new \SYSTEM\PAGE\PageApi(new SYSTEM\verifyclass(), new PageApi());
|
||||
echo $page->CALL(array_merge($_POST,$_GET))->html();
|
||||
@ -1,6 +1,8 @@
|
||||
file.reference.source-system=../../system
|
||||
ignore.path=
|
||||
include.path=\
|
||||
${php.global.include.path}
|
||||
${php.global.include.path}:\
|
||||
${file.reference.source-system}
|
||||
php.version=PHP_54
|
||||
source.encoding=UTF-8
|
||||
src.dir=.
|
||||
|
||||
@ -1,154 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
API CALL:
|
||||
COMMANDS OPTIONS PARAMETERS via post/get
|
||||
|
||||
COMMANDS:
|
||||
Handled by the Api, verified and processed via database table
|
||||
COMMAND(ID,VALUE)
|
||||
|
||||
PARAMS:
|
||||
Verified and typechecked by the api
|
||||
PARAM(ID,VALUE)
|
||||
*/
|
||||
|
||||
// $api = new \API\API(..);
|
||||
// return $api->CALL($call);
|
||||
|
||||
/*
|
||||
* Table:
|
||||
* ID FLAG C/P PARENTCOMMANDID ISCHACHED ALLOWEDVALUES (cache only for commands, null on command = dont care)
|
||||
* 0 C 'CALL' -1 null null (calculated by the api for commands)
|
||||
* 1 C 'ALGO' 0 true null
|
||||
* 2 P 'x' 1 null GOOGLEMAPXY (function in MYVERIFY::func)
|
||||
* 3 P 'y' 1 null GOOGLEMAPXY
|
||||
* 4 P 'zoom' 1 null GOOGLEMAPZOOM
|
||||
* 5 P 'from' 1 null TIMEWIERDFORMAT
|
||||
* 6 P 'to' 1 null TIMEWIERDFORMAT
|
||||
* 7 P 'type' 1 null SENSORTYPE
|
||||
* 8 P 'provider' 1 null SENSORPROVIDER
|
||||
* 9 P 'visibility' 1 null SENSORVISIBILITY
|
||||
* 10 C 'markers' 1 null BOOL
|
||||
*
|
||||
* MYAPI::map_heatmap($PARAMS,$OPTIONS)
|
||||
* MYAPI::map_heatmap_key
|
||||
*/
|
||||
|
||||
namespace SYSTEM\API;
|
||||
|
||||
class Api {
|
||||
|
||||
private $m_dbinfo = null;
|
||||
private $m_verifyclass = null;
|
||||
private $m_apiclass = null;
|
||||
|
||||
public function __construct($DBInfo,\SYSTEM\verifyclass $VerifyClass, \SYSTEM\API\apiclass $ApiClass){
|
||||
$this->m_dbinfo = $DBInfo;
|
||||
$this->m_verifyclass = $VerifyClass;
|
||||
$this->m_apiclass = $ApiClass;
|
||||
}
|
||||
|
||||
// $call = post + get params
|
||||
// returns resultstring
|
||||
public function CALL($call = array()){
|
||||
|
||||
if( !isset($call) || !is_array($call) || count($call) <= 0){
|
||||
throw new \SYSTEM\LOG\ERROR("No call given for the api");}
|
||||
|
||||
//Get the Databasetree
|
||||
$tree = array();
|
||||
if($this->m_dbinfo instanceof \SYSTEM\DB\DBInfo){
|
||||
$tree = self::getApiTree();
|
||||
if(!is_array($tree)){
|
||||
throw new \SYSTEM\LOG\ERROR("Database Tree for Api empty - cannot proced!");}
|
||||
} else {
|
||||
if(!is_array($this->m_dbinfo)){
|
||||
throw new \SYSTEM\LOG\ERROR('No Connectioninfo and no call table given to the api');}
|
||||
$tree = $this->m_dbinfo;
|
||||
}
|
||||
|
||||
//Commands
|
||||
$commands = array();
|
||||
$parentid = -1;
|
||||
|
||||
foreach($tree as $item){
|
||||
if( intval($item[\DBD\SYSTEM\APITable::FIELD_FLAG]) == \DBD\SYSTEM\APITable::VALUE_FLAG_COMMAND &&
|
||||
intval($item[\DBD\SYSTEM\APITable::FIELD_PARENTID]) == $parentid &&
|
||||
isset($call[$item[\DBD\SYSTEM\APITable::FIELD_NAME]])){
|
||||
|
||||
if( isset($item[\DBD\SYSTEM\APITable::FIELD_PARENTVALUE]) &&
|
||||
$commands[count($commands)-1][1] != $item[\DBD\SYSTEM\APITable::FIELD_PARENTVALUE]){
|
||||
continue;
|
||||
}
|
||||
|
||||
$commands[] = array($item,$call[$item[\DBD\SYSTEM\APITable::FIELD_NAME]]);
|
||||
$parentid = intval($item[\DBD\SYSTEM\APITable::FIELD_ID]);
|
||||
}
|
||||
}
|
||||
|
||||
//Parameters
|
||||
$parameters = array();
|
||||
$lastCommand = $commands[count($commands)-1][0];
|
||||
foreach($tree as $item){
|
||||
if( intval($item[\DBD\SYSTEM\APITable::FIELD_FLAG]) == \DBD\SYSTEM\APITable::VALUE_FLAG_PARAM &&
|
||||
intval($item[\DBD\SYSTEM\APITable::FIELD_PARENTID]) == $lastCommand[\DBD\SYSTEM\APITable::FIELD_ID]){
|
||||
|
||||
if( isset($item[\DBD\SYSTEM\APITable::FIELD_PARENTVALUE]) &&
|
||||
$commands[count($commands)-1][1] != $item[\DBD\SYSTEM\APITable::FIELD_PARENTVALUE]){
|
||||
continue;}
|
||||
|
||||
if(!isset($call[$item[\DBD\SYSTEM\APITable::FIELD_NAME]])){
|
||||
throw new \SYSTEM\LOG\ERROR('Parameter missing: '.$item[\DBD\SYSTEM\APITable::FIELD_NAME]);}
|
||||
|
||||
|
||||
if( !method_exists($this->m_verifyclass, $item[\DBD\SYSTEM\APITable::FIELD_ALLOWEDVALUES]) ||
|
||||
!$this->m_verifyclass->$item[\DBD\SYSTEM\APITable::FIELD_ALLOWEDVALUES]($call[$item[\DBD\SYSTEM\APITable::FIELD_NAME]])){
|
||||
throw new \SYSTEM\LOG\ERROR('Parameter type missmacht or Missing Verifier. Param: '.$item[\DBD\SYSTEM\APITable::FIELD_NAME].' Verifier: '.$item[\DBD\SYSTEM\APITable::FIELD_ALLOWEDVALUES]);}
|
||||
|
||||
$parameters[] = array($item, $call[$item[\DBD\SYSTEM\APITable::FIELD_NAME]]);
|
||||
}
|
||||
}
|
||||
if(count($call) != (count($parameters) + count($commands)) ){
|
||||
throw new \SYSTEM\LOG\ERROR('Unhandled or misshandled parameters - api query is invalid');}
|
||||
|
||||
//Function Name
|
||||
$command_call = "";
|
||||
foreach($commands as $com){
|
||||
if(!\preg_match('^[0-9A-Za-z_]+$^', $com[1])){
|
||||
throw new \SYSTEM\LOG\ERROR('Call Command can only have letters!');}
|
||||
|
||||
if($com[0][\DBD\SYSTEM\APITable::FIELD_ALLOWEDVALUES] == 'FLAG'){
|
||||
$command_call .= '_flag_'.$com[0][\DBD\SYSTEM\APITable::FIELD_NAME];
|
||||
} else {
|
||||
$command_call .= '_'.$com[0][\DBD\SYSTEM\APITable::FIELD_NAME].'_'.\strtolower($com[1]);}
|
||||
}
|
||||
$command_call = substr($command_call, 1);
|
||||
|
||||
//Function parameters
|
||||
$parameter_call = array();
|
||||
foreach($parameters as $param){
|
||||
$parameter_call[] = $param[1];}
|
||||
|
||||
if(!\method_exists($this->m_apiclass, $command_call)){
|
||||
throw new \SYSTEM\LOG\ERROR("API call is not implemented in API: ".$command_call);}
|
||||
|
||||
//Call Function
|
||||
return \call_user_func_array(array($this->m_apiclass,$command_call),$parameter_call);
|
||||
}
|
||||
|
||||
private function getApiTree(){
|
||||
|
||||
$con = new \SYSTEM\DB\Connection($this->m_dbinfo);
|
||||
$res = $con->query('SELECT * FROM '.\DBD\SYSTEM\APITable::NAME.' ORDER BY "'.\DBD\SYSTEM\APITable::FIELD_ID.'"');
|
||||
unset($con);
|
||||
|
||||
if(!$res){
|
||||
throw new \SYSTEM\LOG\ERROR('Database Error '.pg_last_error($con));}
|
||||
|
||||
$result = array();
|
||||
while($row = $res->next()){
|
||||
$result[] = $row;}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\API;
|
||||
|
||||
class apiclass {}
|
||||
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\API;
|
||||
|
||||
class apiloginclass extends \SYSTEM\API\apiclass {
|
||||
/*
|
||||
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (0, 0, -1, NULL, 'call', NULL);
|
||||
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (60, 0, 0, 'account', 'action', NULL);
|
||||
|
||||
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (61, 1, 60, 'login', 'username', 'ALL');
|
||||
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (62, 1, 60, 'login', 'password', 'ALL');
|
||||
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (63, 1, 60, 'login', 'hashed', 'ALL');
|
||||
|
||||
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (64, 1, 60, 'check', 'rightid', 'ALL');
|
||||
|
||||
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (65, 1, 60, 'create', 'username', 'ALL');
|
||||
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (66, 1, 60, 'create', 'password', 'ALL');
|
||||
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (67, 1, 60, 'create', 'email', 'ALL');
|
||||
INSERT INTO `APICalls` (`ID`, `Flag`, `ParentID`, `ParentValue`, `Name`, `AllowedValues`) VALUES (68, 1, 60, 'create', 'hashed', 'ALL');
|
||||
*/
|
||||
|
||||
public static function call_account_action_login($username, $password_sha, $password_md5){
|
||||
return \SYSTEM\SECURITY\Security::login(new \DBD\SYSTEM\systemPostgres(), $username, $password_sha, $password_md5);}
|
||||
public static function call_account_action_logout(){
|
||||
return \SYSTEM\SECURITY\Security::logout();}
|
||||
public static function call_account_action_isloggedin(){
|
||||
return \SYSTEM\SECURITY\Security::isLoggedIn();}
|
||||
public static function call_account_action_check($rightid){
|
||||
return \SYSTEM\SECURITY\Security::check(new \DBD\SYSTEM\systemPostgres(),$rightid);}
|
||||
public static function call_account_action_create($username, $password_sha, $email, $locale){
|
||||
return \SYSTEM\SECURITY\Security::create(new \DBD\SYSTEM\systemPostgres(), $username, $password_sha, $email, $locale);}
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
//includ autoloadclass
|
||||
require_once dirname(__FILE__).'/system/path.php';
|
||||
require_once dirname(__FILE__).'/system/autoload.php';
|
||||
|
||||
//autoload hook -> refers to autoload class singleton
|
||||
function __autoload_system($class_name) {
|
||||
return system\autoload::getInstance()->autoload($class_name);
|
||||
}
|
||||
|
||||
//Register autoload
|
||||
spl_autoload_register('__autoload_system');
|
||||
|
||||
//Register system classes
|
||||
require_once dirname(__FILE__).'/system/register_system_autoload_classes.php';
|
||||
45
system/cache/cache.php
vendored
@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\CACHE;
|
||||
|
||||
class cache {
|
||||
|
||||
public static function get(\SYSTEM\DB\DBInfo $dbinfo, $cache_id, $ident){
|
||||
$con = new \SYSTEM\DB\Connection($dbinfo);
|
||||
$res = $con->prepare( 'checkCache',
|
||||
'SELECT "data" FROM system.cache'.
|
||||
' WHERE "CacheID" = $1 AND'.
|
||||
' "Ident" = $2;',
|
||||
array($cache_id,$ident));
|
||||
if(!($result = $res->next())){
|
||||
return NULL;}
|
||||
|
||||
return pg_unescape_bytea($result['data']);
|
||||
}
|
||||
|
||||
public static function put(\SYSTEM\DB\DBInfo $dbinfo, $cache_id, $ident, $data, $fail_on_exist = false){
|
||||
if((self::get($dbinfo,$cache_id,$ident) != NULL)){
|
||||
if($fail_on_exist){
|
||||
return false;}
|
||||
self::del($dbinfo, $cache_id, $ident);
|
||||
}
|
||||
|
||||
$con = new \SYSTEM\DB\Connection($dbinfo);
|
||||
$res = $con->prepare( 'insertCache',
|
||||
'INSERT INTO system.cache ("CacheID", "Ident", "data")'.
|
||||
' VALUES ($1,$2,$3);',
|
||||
array($cache_id,$ident,pg_escape_bytea($data)));
|
||||
return $res->next() ? $data : NULL;
|
||||
}
|
||||
|
||||
public static function del(\SYSTEM\DB\DBInfo $dbinfo, $cache_id, $ident){
|
||||
$con = new \SYSTEM\DB\Connection($dbinfo);
|
||||
$res = $con->prepare( 'deleteCache',
|
||||
'DELETE FROM system.cache'.
|
||||
' WHERE "CacheID" = $1 AND'.
|
||||
' "Ident" = $2;',
|
||||
array($cache_id,$ident));
|
||||
|
||||
return $res->next() ? true : false;
|
||||
}
|
||||
}
|
||||
@ -1,809 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
require_once '../../system/autoload.inc.php';
|
||||
require_once '../../dbd/autoload.inc.php';
|
||||
|
||||
$tr = new TransferData();
|
||||
$tr->transferAll();
|
||||
|
||||
|
||||
class TransferData{
|
||||
|
||||
private $dataTransfered = 0;
|
||||
|
||||
public function transferAll(){
|
||||
|
||||
echo "<b>Transfering data please waite ....</b><br /><br />";
|
||||
flush();
|
||||
|
||||
//order depending on foreign keys -> pls don't change !!!
|
||||
|
||||
// Schema -> SYSTEM:
|
||||
//$this->transferApiCalls();
|
||||
//$this->transferPageCalls();
|
||||
$this->transferUser();
|
||||
//Schema -> DATA / DATA_PROCESSED:
|
||||
$this->transferDevice_Types();
|
||||
$this->transferDevice_Models();
|
||||
$this->transferDevices();
|
||||
$this->transferDevice_Models_Specifications_Keys();
|
||||
$this->transferDevice_Models_Specifications();
|
||||
$this->transferSensor_Types();
|
||||
$this->transferSensor_Models();
|
||||
$this->transferSensors();
|
||||
$this->transferSensor_Attributes_Keys();
|
||||
$this->transferSensor_Attributes();
|
||||
$this->transferSeries();
|
||||
|
||||
$this->transferValues();
|
||||
//$this->transferData_Values_Cleaned(); //-> change preprocessor to Postgres
|
||||
//$this->transferOSMData();
|
||||
|
||||
$this->transferTag_Keys();
|
||||
$this->transferTags();
|
||||
|
||||
|
||||
//Schema -> DATA_PROCESSED:
|
||||
//$this->transferData_Cache_Index(); -> change cache to Postgres
|
||||
|
||||
echo "<br/><b>Done: Transfered ".$this->dataTransfered." rows of data :)</b>";
|
||||
flush();
|
||||
}
|
||||
|
||||
|
||||
//################################# Schema -> SYSTEM ##############################
|
||||
//##############################################################################################
|
||||
|
||||
private function transferApiCalls(){
|
||||
|
||||
$rowCount = 0;
|
||||
|
||||
$sqlString = "SELECT * FROM `APICalls`;";
|
||||
$mysql = new SYSTEM\DB\Connection(new \SYSTEM\DB\DBInfoMYS("dasensedata", "dasense", "dasenseopendataserver", "212.72.183.108"));
|
||||
$res = $mysql->query($sqlString);
|
||||
|
||||
$postgresSql = 'INSERT INTO system.api_calls ("ID", flag, "parentID", "parentValue", name, "allowedValues") VALUES';
|
||||
while($data = $res->next()){
|
||||
$rowCount++;
|
||||
$id = $data['ID'];
|
||||
$flag = $data['Flag'];
|
||||
$parentID = $data['ParentID'];
|
||||
$parentValue = isset($data['ParentValue']) ? "'".$data['ParentValue']."'" : "NULL";
|
||||
$name = isset($data['Name']) ? "'".$data['Name']."'" : "NULL";
|
||||
$allowedValues = isset($data['AllowedValues']) ? "'".$data['AllowedValues']."'" : "NULL";
|
||||
|
||||
$postgresSql.=" (".$id.", ".$flag.", ".$parentID.", ".$parentValue.", ".$name.", ".$allowedValues."),";
|
||||
}
|
||||
$postgresSql = substr($postgresSql, 0, strlen($postgresSql)-1);
|
||||
$postgresSql.=";";
|
||||
|
||||
|
||||
$postgres = new SYSTEM\DB\Connection(new DBD\dasensePostgres());
|
||||
|
||||
//delete old entries
|
||||
$res = $postgres->query("TRUNCATE system.api_calls");
|
||||
|
||||
//insert new stuff
|
||||
$res = $postgres->query($postgresSql);
|
||||
|
||||
$this->dataTransfered = $this->dataTransfered + $rowCount;
|
||||
echo 'Transfered table APICalls ['.$rowCount.' rows] (MySQL) to table system.api_calls (Postgres).<br />';
|
||||
flush();
|
||||
}
|
||||
|
||||
|
||||
private function transferPageCalls(){
|
||||
|
||||
$rowCount = 0;
|
||||
|
||||
$sqlString = "SELECT * FROM `PAGECalls`;";
|
||||
$mysql = new SYSTEM\DB\Connection(new \SYSTEM\DB\DBInfoMYS("dasensedata", "dasense", "dasenseopendataserver", "212.72.183.108"));
|
||||
$res = $mysql->query($sqlString);
|
||||
|
||||
$postgresSql = 'INSERT INTO system.page_calls ("ID", flag, "parentID", "parentValue", name, "allowedValues") VALUES';
|
||||
while($data = $res->next()){
|
||||
$rowCount++;
|
||||
$id = $data['ID'];
|
||||
$flag = $data['Flag'];
|
||||
$parentID = $data['ParentID'];
|
||||
$parentValue = isset($data['ParentValue']) ? "'".$data['ParentValue']."'" : "NULL";
|
||||
$name = isset($data['Name']) ? "'".$data['Name']."'" : "NULL";
|
||||
$allowedValues = isset($data['AllowedValues']) ? "'".$data['AllowedValues']."'" : "NULL";
|
||||
|
||||
$postgresSql.=" (".$id.", ".$flag.", ".$parentID.", ".$parentValue.", ".$name.", ".$allowedValues."),";
|
||||
}
|
||||
$postgresSql = substr($postgresSql, 0, strlen($postgresSql)-1);
|
||||
$postgresSql.=";";
|
||||
|
||||
|
||||
$postgres = new SYSTEM\DB\Connection(new DBD\dasensePostgres());
|
||||
|
||||
//delete old entries
|
||||
$res = $postgres->query("TRUNCATE system.page_calls");
|
||||
|
||||
//insert new stuff
|
||||
$res = $postgres->query($postgresSql);
|
||||
|
||||
$this->dataTransfered = $this->dataTransfered + $rowCount;
|
||||
echo 'Transfered table PAGECalls ['.$rowCount.' rows] (MySQL) to table system.page_calls (Postgres).<br />';
|
||||
flush();
|
||||
}
|
||||
|
||||
private function transferLocal_String(){
|
||||
|
||||
// sachen in postgres nicht löschen, nur unsere Sachen aus MySQL hinzufügen
|
||||
$rowCount = 0;
|
||||
|
||||
$sqlString = "SELECT * FROM `locale_string`;";
|
||||
$mysql = new SYSTEM\DB\Connection(new \SYSTEM\DB\DBInfoMYS("dasensedata", "dasense", "dasenseopendataserver", "212.72.183.108"));
|
||||
$res = $mysql->query($sqlString);
|
||||
|
||||
$postgresSql = 'INSERT INTO system.locale_string ("id", category, "enUS", "deDE") VALUES';
|
||||
while($data = $res->next()){
|
||||
$rowCount++;
|
||||
$id = isset($data['id']) ? "'".pg_escape_string($data['id'])."'" : "NULL";
|
||||
$category = $data['category'];
|
||||
$enUS = isset($data['enUS']) ? "'".pg_escape_string($data['enUS'])."'" : "NULL";
|
||||
$deDE = isset($data['deDE']) ? "'".pg_escape_string($data['deDE'])."'" : "NULL";
|
||||
|
||||
$postgresSql.=" (".$id.", ".$category.", ".$enUS.", ".$deDE."),";
|
||||
|
||||
}
|
||||
//echo $postgresSql;
|
||||
$postgresSql = substr($postgresSql, 0, strlen($postgresSql)-1);
|
||||
$postgresSql.=";";
|
||||
|
||||
|
||||
$postgres = new SYSTEM\DB\Connection(new DBD\dasensePostgres());
|
||||
|
||||
//don't delete entries in postgres
|
||||
//$res = $postgres->query("TRUNCATE system.locale_string");
|
||||
|
||||
//insert new stuff
|
||||
$res = $postgres->query($postgresSql);
|
||||
|
||||
$this->dataTransfered = $this->dataTransfered + $rowCount;
|
||||
echo 'Transfered table locale_string ['.$rowCount.' rows] (MySQL) to table system.locale_string (Postgres).<br />';
|
||||
flush();
|
||||
}
|
||||
|
||||
|
||||
private function transferUser(){
|
||||
|
||||
$rowCount = 0;
|
||||
|
||||
$sqlString = "SELECT * FROM `user`;";
|
||||
$mysql = new SYSTEM\DB\Connection(new \SYSTEM\DB\DBInfoMYS("dasenseuser", "dasense", "dasenseopendataserver", "212.72.183.108"));
|
||||
$res = $mysql->query($sqlString);
|
||||
|
||||
$postgresSql = 'INSERT INTO system.user ("id", "username", "password_md5", "email", "joindate") VALUES';
|
||||
while($data = $res->next()){
|
||||
$rowCount++;
|
||||
$id = $data['id'];
|
||||
$username = isset($data['username']) ? "'".pg_escape_string(utf8_encode($data['username']))."'" : "NULL";
|
||||
$pw_md5 = isset($data['password']) ? "'".$data['password']."'" : "NULL";
|
||||
$email = isset($data['email']) ? "'".$data['email']."'" : "NULL";
|
||||
$joindate = 'to_timestamp('.round($data['creationTimestamp']/1000).')';
|
||||
|
||||
$postgresSqlARY[] = " (".$id.", ".$username.", ".$pw_md5.", ".$email.", ".$joindate.");";
|
||||
|
||||
|
||||
}
|
||||
|
||||
$postgres = new SYSTEM\DB\Connection(new DBD\dasensePostgres());
|
||||
|
||||
//delete old entries
|
||||
$res = $postgres->query("TRUNCATE system.user CASCADE");
|
||||
|
||||
//insert new stuff
|
||||
foreach($postgresSqlARY as $val){
|
||||
$res = $postgres->query($postgresSql.$val);
|
||||
}
|
||||
|
||||
$this->dataTransfered = $this->dataTransfered + $rowCount;
|
||||
echo 'Transfered table user ['.$rowCount.' rows] (MySQL) to table system.user (Postgres).<br />';
|
||||
flush();
|
||||
}
|
||||
|
||||
|
||||
//################################# Schema -> DATA ##############################
|
||||
//############################################################################################
|
||||
|
||||
|
||||
private function transferDevice_Types(){
|
||||
|
||||
$rowCount = 0;
|
||||
|
||||
$sqlString = "SELECT * FROM `deviceTypes`;";
|
||||
$mysql = new SYSTEM\DB\Connection(new \SYSTEM\DB\DBInfoMYS("dasensedata", "dasense", "dasenseopendataserver", "212.72.183.108"));
|
||||
$res = $mysql->query($sqlString);
|
||||
|
||||
$postgresSql = 'INSERT INTO data.device_types ("ID", type) VALUES';
|
||||
while($data = $res->next()){
|
||||
$rowCount++;
|
||||
$id = $data['ID'];
|
||||
$type = isset($data['type']) ? "'".$data['type']."'" : "NULL";
|
||||
|
||||
$postgresSql.=" (".$id.", ".$type."),";
|
||||
}
|
||||
$postgresSql = substr($postgresSql, 0, strlen($postgresSql)-1);
|
||||
$postgresSql.=";";
|
||||
|
||||
|
||||
$postgres = new SYSTEM\DB\Connection(new DBD\dasensePostgres());
|
||||
|
||||
//delete old entries
|
||||
$res = $postgres->query("TRUNCATE data.device_types CASCADE");
|
||||
|
||||
//insert new stuff
|
||||
$res = $postgres->query($postgresSql);
|
||||
|
||||
$this->dataTransfered = $this->dataTransfered + $rowCount;
|
||||
echo 'Transfered table deviceTypes ['.$rowCount.' rows] (MySQL) to table data.device_types (Postgres).<br />';
|
||||
flush();
|
||||
}
|
||||
|
||||
private function transferDevice_Models(){
|
||||
|
||||
$rowCount = 0;
|
||||
|
||||
$sqlString = "SELECT * FROM `deviceModels`;";
|
||||
$mysql = new SYSTEM\DB\Connection(new \SYSTEM\DB\DBInfoMYS("dasensedata", "dasense", "dasenseopendataserver", "212.72.183.108"));
|
||||
$res = $mysql->query($sqlString);
|
||||
|
||||
$postgresSql = 'INSERT INTO data.device_models ("ID", "typeID", manufactor, model) VALUES';
|
||||
while($data = $res->next()){
|
||||
$rowCount++;
|
||||
$id = $data['ID'];
|
||||
$typeID = $data['typeID'];
|
||||
$manu = isset($data['manufactor']) ? "'".$data['manufactor']."'" : "NULL";
|
||||
$model = isset($data['model']) ? "'".$data['model']."'" : "NULL";
|
||||
|
||||
$postgresSql.=" (".$id.", ".$typeID.", ".$manu.", ".$model."),";
|
||||
}
|
||||
$postgresSql = substr($postgresSql, 0, strlen($postgresSql)-1);
|
||||
$postgresSql.=";";
|
||||
|
||||
|
||||
$postgres = new SYSTEM\DB\Connection(new DBD\dasensePostgres());
|
||||
|
||||
//delete old entries
|
||||
$res = $postgres->query("TRUNCATE data.device_models CASCADE");
|
||||
|
||||
//insert new stuff
|
||||
$res = $postgres->query($postgresSql);
|
||||
|
||||
$this->dataTransfered = $this->dataTransfered + $rowCount;
|
||||
echo 'Transfered table deviceModels ['.$rowCount.' rows] (MySQL) to table data.device_models (Postgres).<br/ >';
|
||||
flush();
|
||||
}
|
||||
|
||||
private function transferDevices(){
|
||||
|
||||
$rowCount = 0;
|
||||
|
||||
$sqlString = "SELECT * FROM `devices`;";
|
||||
$mysql = new SYSTEM\DB\Connection(new \SYSTEM\DB\DBInfoMYS("dasensedata", "dasense", "dasenseopendataserver", "212.72.183.108"));
|
||||
$res = $mysql->query($sqlString);
|
||||
|
||||
$postgresSql = 'INSERT INTO data.devices ("ID", "name", "modelID", identifier) VALUES';
|
||||
while($data = $res->next()){
|
||||
$rowCount++;
|
||||
$id = $data['ID'];
|
||||
$name = isset($data['name']) ? "'".$data['name']."'" : "NULL";
|
||||
$modelID = $data['modelID'];
|
||||
$identifier = isset($data['identifier']) ? "'".$data['identifier']."'" : "NULL";
|
||||
|
||||
$postgresSql.=" (".$id.", ".$name.", ".$modelID.", ".$identifier."),";
|
||||
}
|
||||
$postgresSql = substr($postgresSql, 0, strlen($postgresSql)-1);
|
||||
$postgresSql.=";";
|
||||
|
||||
|
||||
$postgres = new SYSTEM\DB\Connection(new DBD\dasensePostgres());
|
||||
|
||||
//delete old entries
|
||||
$res = $postgres->query("TRUNCATE data.devices CASCADE");
|
||||
|
||||
//insert new stuff
|
||||
$res = $postgres->query($postgresSql);
|
||||
|
||||
$this->dataTransfered = $this->dataTransfered + $rowCount;
|
||||
echo 'Transfered table devices ['.$rowCount.' rows] (MySQL) to table data.devices (Postgres).<br/ >';
|
||||
flush();
|
||||
}
|
||||
|
||||
private function transferDevice_Models_Specifications_Keys(){
|
||||
//-> no entries in MySQL
|
||||
}
|
||||
|
||||
private function transferDevice_Models_Specifications(){
|
||||
//-> no entries in MySQL
|
||||
}
|
||||
|
||||
private function transferSensor_Types(){
|
||||
|
||||
$rowCount = 0;
|
||||
|
||||
$sqlString = "SELECT * FROM `sensorTypes` INNER JOIN `sensorTypeBoundaries` ON sensorTypes.ID = sensorTypeBoundaries.ID;";
|
||||
$mysql = new SYSTEM\DB\Connection(new \SYSTEM\DB\DBInfoMYS("dasensedata", "dasense", "dasenseopendataserver", "212.72.183.108"));
|
||||
$res = $mysql->query($sqlString);
|
||||
|
||||
$postgresSql = 'INSERT INTO data.sensor_types ("ID", type, "measurementUnit", "maxBoundary", "minBoundary") VALUES';
|
||||
while($data = $res->next()){
|
||||
$rowCount++;
|
||||
$id = $data['ID'];
|
||||
$type = isset($data['type']) ? "'".$data['type']."'" : "NULL";
|
||||
$mesUnit = isset($data['measurementUnit']) ? "'".$data['measurementUnit']."'" : "NULL";
|
||||
$max = $data['max'];
|
||||
$min = $data['min'];
|
||||
|
||||
|
||||
$postgresSql.=" (".$id.", ".$type.", ".$mesUnit.", ".$max.", ".$min."),";
|
||||
}
|
||||
$postgresSql = substr($postgresSql, 0, strlen($postgresSql)-1);
|
||||
$postgresSql.=";";
|
||||
|
||||
|
||||
$postgres = new SYSTEM\DB\Connection(new DBD\dasensePostgres());
|
||||
|
||||
//delete old entries
|
||||
$res = $postgres->query("TRUNCATE data.sensor_types CASCADE");
|
||||
|
||||
//insert new stuff
|
||||
$res = $postgres->query($postgresSql);
|
||||
|
||||
$this->dataTransfered = $this->dataTransfered + $rowCount;
|
||||
echo 'Transfered table sensorTypes, sensorTypeBoundaries ['.$rowCount.' rows] (MySQL) to table data.sensor_types (Postgres).<br />';
|
||||
flush();
|
||||
}
|
||||
|
||||
private function transferSensor_Models(){
|
||||
|
||||
$rowCount = 0;
|
||||
|
||||
$sqlString = "SELECT * FROM `sensorModels`;";
|
||||
$mysql = new SYSTEM\DB\Connection(new \SYSTEM\DB\DBInfoMYS("dasensedata", "dasense", "dasenseopendataserver", "212.72.183.108"));
|
||||
$res = $mysql->query($sqlString);
|
||||
|
||||
$postgresSql = 'INSERT INTO data.sensor_models ("ID", manufactor, model) VALUES';
|
||||
while($data = $res->next()){
|
||||
$rowCount++;
|
||||
$id = $data['ID'];
|
||||
$manu = isset($data['manufactor']) ? "'".$data['manufactor']."'" : "NULL";
|
||||
$model = isset($data['model']) ? "'".$data['model']."'" : "NULL";
|
||||
|
||||
$postgresSql.=" (".$id.", ".$manu.", ".$model."),";
|
||||
}
|
||||
$postgresSql = substr($postgresSql, 0, strlen($postgresSql)-1);
|
||||
$postgresSql.=";";
|
||||
|
||||
|
||||
$postgres = new SYSTEM\DB\Connection(new DBD\dasensePostgres());
|
||||
|
||||
//delete old entries
|
||||
$res = $postgres->query("TRUNCATE data.sensor_models CASCADE");
|
||||
|
||||
//insert new stuff
|
||||
$res = $postgres->query($postgresSql);
|
||||
|
||||
$this->dataTransfered = $this->dataTransfered + $rowCount;
|
||||
echo 'Transfered table sensorModels ['.$rowCount.' rows] (MySQL) to table data.sensor_models (Postgres).<br/ >';
|
||||
flush();
|
||||
}
|
||||
|
||||
private function transferSensors(){
|
||||
|
||||
$rowCount = 0;
|
||||
|
||||
$sqlString = "SELECT * FROM `sensors`;";
|
||||
$mysql = new SYSTEM\DB\Connection(new \SYSTEM\DB\DBInfoMYS("dasensedata", "dasense", "dasenseopendataserver", "212.72.183.108"));
|
||||
$res = $mysql->query($sqlString);
|
||||
|
||||
$postgresSql = 'INSERT INTO data.sensors ("ID", "deviceID", "modelID", "typeID") VALUES';
|
||||
while($data = $res->next()){
|
||||
$rowCount++;
|
||||
$id = $data['ID'];
|
||||
$deviceID = $data['deviceID'];
|
||||
$typeID = $data['typeID'];
|
||||
$modelID = isset($data['modelID']) ? $data['modelID'] : "NULL";
|
||||
|
||||
$postgresSql.=" (".$id.", ".$deviceID.", ".$modelID.", ".$typeID."),";
|
||||
}
|
||||
$postgresSql = substr($postgresSql, 0, strlen($postgresSql)-1);
|
||||
$postgresSql.=";";
|
||||
|
||||
|
||||
$postgres = new SYSTEM\DB\Connection(new DBD\dasensePostgres());
|
||||
|
||||
//delete old entries
|
||||
$res = $postgres->query("TRUNCATE data.sensors CASCADE");
|
||||
|
||||
//insert new stuff
|
||||
$res = $postgres->query($postgresSql);
|
||||
|
||||
$this->dataTransfered = $this->dataTransfered + $rowCount;
|
||||
echo 'Transfered table sensors ['.$rowCount.' rows] (MySQL) to table data.sensors (Postgres).<br/ >';
|
||||
flush();
|
||||
}
|
||||
|
||||
|
||||
private function transferSensor_Attributes_Keys(){
|
||||
//-> no entries in MySQL
|
||||
}
|
||||
|
||||
private function transferSensor_Attributes(){
|
||||
//-> no entries in MySQL
|
||||
}
|
||||
|
||||
private function transferSeries(){
|
||||
|
||||
$rowCount = 0;
|
||||
|
||||
$sqlString = "SELECT * FROM `measurementSeries`;";
|
||||
$mysql = new SYSTEM\DB\Connection(new \SYSTEM\DB\DBInfoMYS("dasensedata", "dasense", "dasenseopendataserver", "212.72.183.108"));
|
||||
$res = $mysql->query($sqlString);
|
||||
|
||||
$postgresSql = 'INSERT INTO data.series ("ID", "visibility", "timestamp", "name") VALUES';
|
||||
while($data = $res->next()){
|
||||
$rowCount++;
|
||||
$id = $data['ID'];
|
||||
$timestamp = 'to_timestamp('.round($data['timestamp']/1000).')';
|
||||
$visibility = $data['visibility'];
|
||||
$name = isset($data['name']) ? "'".$data['name']."'" : "NULL";
|
||||
|
||||
$postgresSql.=" (".$id.", ".$visibility.", ".$timestamp.", ".$name."),";
|
||||
}
|
||||
$postgresSql = substr($postgresSql, 0, strlen($postgresSql)-1);
|
||||
$postgresSql.=";";
|
||||
|
||||
|
||||
$postgres = new SYSTEM\DB\Connection(new DBD\dasensePostgres());
|
||||
|
||||
//delete old entries
|
||||
$res = $postgres->query("TRUNCATE data.series CASCADE");
|
||||
|
||||
//insert new stuff
|
||||
$res = $postgres->query($postgresSql);
|
||||
|
||||
$this->dataTransfered = $this->dataTransfered + $rowCount;
|
||||
echo 'Transfered table measurementSeries ['.$rowCount.' rows] (MySQL) to table data.series (Postgres).<br/ >';
|
||||
flush();
|
||||
}
|
||||
|
||||
private function transferValues(){
|
||||
|
||||
//connections
|
||||
$mysql = new SYSTEM\DB\Connection(new \SYSTEM\DB\DBInfoMYS("dasensedata", "dasense", "dasenseopendataserver", "212.72.183.108"));
|
||||
$postgres = new SYSTEM\DB\Connection(new DBD\dasensePostgres());
|
||||
|
||||
//get max id
|
||||
$sql = "SELECT max(ID) as IDcount FROM `values`;";
|
||||
$res = $mysql->query($sql);
|
||||
|
||||
$res = $res->next();
|
||||
$IDcount = $res['IDcount'];
|
||||
|
||||
$transfereIncomplete = true;
|
||||
|
||||
$rowCount = 0;
|
||||
|
||||
|
||||
$min = 0;
|
||||
$max = 50000;
|
||||
|
||||
//delete old entries
|
||||
$res = $postgres->query("TRUNCATE data.values CASCADE");
|
||||
|
||||
while($transfereIncomplete){
|
||||
|
||||
$sqlString = "SELECT `values`.ID as ID,
|
||||
`sensors`.typeID as typeID,
|
||||
`values`.value as value,
|
||||
`measurementSeries`.visibility as visibility,
|
||||
`values`.timestamp as timestamp,
|
||||
`locations`.acc as acc,
|
||||
`locations`.alt as alt,
|
||||
`locations`.lat as lat,
|
||||
`locations`.long as lon,
|
||||
`locations`.speed as speed,
|
||||
`locations`.provider as provider,
|
||||
`values`.userID as userID,
|
||||
`values`.seriesID as seriesID,
|
||||
`values`.sensorID as sensorID
|
||||
FROM `values`
|
||||
INNER JOIN `locations` ON `values`.locationID = `locations`.ID
|
||||
INNER JOIN `sensors` ON `values`.sensorID = `sensors`.ID
|
||||
INNER JOIN `measurementSeries` ON `values`.seriesID = `measurementSeries`.ID
|
||||
WHERE `values`.ID > ".$min." && `values`.ID <= ".$max.";";
|
||||
|
||||
$res = $mysql->query($sqlString);
|
||||
|
||||
|
||||
$postgresSql = 'INSERT INTO data.values ("typeID", "value", "visibility", "timestamp", "alt", "acc", "speed",
|
||||
"provider", "userID", "seriesID", "sensorID", "center", "ID") VALUES';
|
||||
while($data = $res->next()){
|
||||
$rowCount++;
|
||||
$typeID = $data['typeID'];
|
||||
$value = $data['value'];
|
||||
$visibility = $data['visibility'];
|
||||
$timestamp = 'to_timestamp('.round($data['timestamp']/1000).')';
|
||||
$alt = $data['alt'];
|
||||
$acc = $data['acc'];
|
||||
$speed = $data['speed'];
|
||||
$provider = isset($data['provider']) ? "'".$data['provider']."'" : "NULL";
|
||||
$userID = $data['userID'];
|
||||
$seriesID = $data['seriesID'];
|
||||
$sensorID = $data['sensorID'];
|
||||
$id = $data['ID'];
|
||||
|
||||
$lat = $data['lat'];
|
||||
$long = $data['lon'];
|
||||
|
||||
//long / lat -> GEOMETRY object
|
||||
$center = "ST_GeomFromText('POINT(".$long." ".$lat.")')";
|
||||
|
||||
|
||||
|
||||
|
||||
$postgresSql.=" (".$typeID.", ".$value.", ".$visibility.", ".$timestamp." , ".$alt." , ".$acc." , ".$speed."
|
||||
, ".$provider.", ".$userID.", ".$seriesID.", ".$sensorID.", ".$center.", ".$id."),";
|
||||
}
|
||||
|
||||
$postgresSql = substr($postgresSql, 0, strlen($postgresSql)-1);
|
||||
$postgresSql.=";";
|
||||
|
||||
//insert new stuff
|
||||
$res = $postgres->query($postgresSql);
|
||||
|
||||
|
||||
if($max >= $IDcount){
|
||||
$transfereIncomplete = false;
|
||||
}else{
|
||||
$min += 50000;
|
||||
$max += 50000;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$this->dataTransfered = $this->dataTransfered + $rowCount;
|
||||
echo 'Transfered table values ['.$rowCount.' rows] (MySQL) to table data.values (Postgres).<br/ >';
|
||||
flush();
|
||||
}
|
||||
|
||||
private function transferTag_Keys(){
|
||||
|
||||
$rowCount = 0;
|
||||
|
||||
$sqlString = "SELECT * FROM `tagKeys`;";
|
||||
$mysql = new SYSTEM\DB\Connection(new \SYSTEM\DB\DBInfoMYS("dasensedata", "dasense", "dasenseopendataserver", "212.72.183.108"));
|
||||
$res = $mysql->query($sqlString);
|
||||
|
||||
$postgresSql = 'INSERT INTO data.tag_keys ("ID", "name") VALUES';
|
||||
while($data = $res->next()){
|
||||
$rowCount++;
|
||||
$id = $data['ID'];
|
||||
$name = isset($data['name']) ? "'".$data['name']."'" : "NULL";
|
||||
|
||||
$postgresSql.=" (".$id.", ".$name."),";
|
||||
}
|
||||
$postgresSql = substr($postgresSql, 0, strlen($postgresSql)-1);
|
||||
$postgresSql.=";";
|
||||
|
||||
|
||||
$postgres = new SYSTEM\DB\Connection(new DBD\dasensePostgres());
|
||||
|
||||
//delete old entries
|
||||
$res = $postgres->query("TRUNCATE data.tag_keys CASCADE");
|
||||
|
||||
//insert new stuff
|
||||
$res = $postgres->query($postgresSql);
|
||||
|
||||
$this->dataTransfered = $this->dataTransfered + $rowCount;
|
||||
echo 'Transfered table tagKeys ['.$rowCount.' rows] (MySQL) to table data.tag_keys (Postgres).<br/ >';
|
||||
flush();
|
||||
}
|
||||
|
||||
private function transferTags(){
|
||||
|
||||
$rowCount = 0;
|
||||
|
||||
$sqlString = "SELECT * FROM `tags`;";
|
||||
$mysql = new SYSTEM\DB\Connection(new \SYSTEM\DB\DBInfoMYS("dasensedata", "dasense", "dasenseopendataserver", "212.72.183.108"));
|
||||
$res = $mysql->query($sqlString);
|
||||
|
||||
$postgresSql = 'INSERT INTO data.tags ("ID", "tagKeyID", "value", "valueID") VALUES';
|
||||
while($data = $res->next()){
|
||||
$rowCount++;
|
||||
$id = $data['ID'];
|
||||
$tagKeyID = $data['tagKeyID'];
|
||||
|
||||
//TODO: Fix this. We have tagKeyIDs in tags which are not in tagKeys
|
||||
if($tagKeyID < 1 || $tagKeyID > 7){
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$valueID = $data['valueID'];
|
||||
$value = isset($data['value']) ? "'".$data['value']."'" : "NULL";
|
||||
|
||||
$postgresSql.=" (".$id.", ".$tagKeyID.", ".$value.", ".$valueID."),";
|
||||
}
|
||||
$postgresSql = substr($postgresSql, 0, strlen($postgresSql)-1);
|
||||
$postgresSql.=";";
|
||||
|
||||
|
||||
$postgres = new SYSTEM\DB\Connection(new DBD\dasensePostgres());
|
||||
|
||||
//delete old entries
|
||||
$res = $postgres->query("TRUNCATE data.tags CASCADE");
|
||||
|
||||
//insert new stuff
|
||||
$res = $postgres->query($postgresSql);
|
||||
|
||||
$this->dataTransfered = $this->dataTransfered + $rowCount;
|
||||
echo 'Transfered table tags ['.$rowCount.' rows] (MySQL) to table data.tags (Postgres).<br/ >';
|
||||
flush();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//################################# Schema -> DATA_PROCESSED ##############################
|
||||
//###################################################################################################
|
||||
|
||||
private function transferData_Cache_Index(){
|
||||
// -> nothing to transfer
|
||||
}
|
||||
|
||||
private function transferOSMData(){
|
||||
$mysql = new SYSTEM\DB\Connection(new \SYSTEM\DB\DBInfoMYS("dasensedata", "dasense", "dasenseopendataserver", "212.72.183.108"));
|
||||
$postgres = new SYSTEM\DB\Connection(new DBD\dasensePostgres());
|
||||
|
||||
$sql = "SELECT 4 as typeID,
|
||||
0 as value,
|
||||
0 as visibility,
|
||||
0 as timestamp,
|
||||
1 as acc,
|
||||
0 as alt,
|
||||
`locations`.lat as lat,
|
||||
`locations`.long as lon,
|
||||
0 as speed,
|
||||
`locations`.provider as provider,
|
||||
-1 as userID,
|
||||
1 as seriesID,
|
||||
417 as sensorID
|
||||
FROM `locations`
|
||||
WHERE `provider` = 'OSMData';";
|
||||
$res = $mysql->query($sql);
|
||||
|
||||
$rowCount = 0;
|
||||
while($result = $res->next()){
|
||||
$postgres->prepare( 'insertValue',
|
||||
'INSERT INTO data.values ("typeID", "value", "visibility", "alt", "acc", "speed", "provider", "userID", "seriesID", "sensorID", "center", "timestamp") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, ST_MakePoint($11, $12), to_timestamp($13)) RETURNING "ID";',
|
||||
array($result['typeID'], $result['value'], $result['visibility'], $result['alt'], $result['acc'], $result['speed'], $result['provider'], $result['userID'], $result['seriesID'], $result['sensorID'], $result['lon'], $result['lat'], $result['timestamp']));
|
||||
$rowCount++;
|
||||
}
|
||||
|
||||
$this->dataTransfered = $this->dataTransfered + $rowCount;
|
||||
echo 'Transfered table values -> OSM DATA ['.$rowCount.' rows] (MySQL) to table data.values (Postgres).<br/ >';
|
||||
flush();
|
||||
}
|
||||
|
||||
private function transferData_Values_Cleaned(){
|
||||
|
||||
|
||||
//connections
|
||||
$mysql = new SYSTEM\DB\Connection(new \SYSTEM\DB\DBInfoMYS("dasensedata", "dasense", "dasenseopendataserver", "212.72.183.108"));
|
||||
$postgres = new SYSTEM\DB\Connection(new DBD\dasensePostgres());
|
||||
|
||||
//get max id
|
||||
$sql = "SELECT max(ID) as IDcount FROM `valuesCleaned`;";
|
||||
$res = $mysql->query($sql);
|
||||
|
||||
$res = $res->next();
|
||||
$IDcount = $res['IDcount'];
|
||||
|
||||
$transfereIncomplete = true;
|
||||
|
||||
$rowCount = 0;
|
||||
|
||||
|
||||
$min = 0;
|
||||
$max = 50000;
|
||||
|
||||
//delete old entries
|
||||
$res = $postgres->query("TRUNCATE data_processed.data_values_cleaned CASCADE");
|
||||
|
||||
while($transfereIncomplete){
|
||||
|
||||
$sqlString = "SELECT `valuesCleaned`.ID as ID,
|
||||
`valuesCleaned`.valuesID as valuesID,
|
||||
`valuesCleaned`.typeID as typeID,
|
||||
`valuesCleaned`.value as value,
|
||||
`valuesCleaned`.visibility as visibility,
|
||||
`valuesCleaned`.timestamp as timestamp,
|
||||
`valuesCleaned`.acc as acc,
|
||||
`valuesCleaned`.alt as alt,
|
||||
`valuesCleaned`.lat as lat,
|
||||
`valuesCleaned`.long as lon,
|
||||
`valuesCleaned`.speed as speed,
|
||||
`valuesCleaned`.provider as provider,
|
||||
`valuesCleaned`.userID as userID,
|
||||
`valuesCleaned`.seriesID as seriesID,
|
||||
`valuesCleaned`.sensorID as sensorID,
|
||||
`valuesCleaned`.cluster as cluster,
|
||||
`valuesCleaned`.values_count as values_count
|
||||
FROM `valuesCleaned`
|
||||
WHERE `valuesCleaned`.ID > ".$min." && `valuesCleaned`.ID <= ".$max.";";
|
||||
|
||||
$res = $mysql->query($sqlString);
|
||||
|
||||
|
||||
$postgresSql = 'INSERT INTO data_processed.data_values_cleaned ("valuesID", "typeID", "value", "visibility", "timestamp", "alt", "acc", "speed",
|
||||
"provider", "userID", "seriesID", "sensorID", "center", "ID", "cluster", "values_count") VALUES';
|
||||
while($data = $res->next()){
|
||||
$rowCount++;
|
||||
$valuesID = $data['valuesID'];
|
||||
$typeID = $data['typeID'];
|
||||
$value = $data['value'];
|
||||
$visibility = $data['visibility'];
|
||||
$timestamp = 'to_timestamp('.round($data['timestamp']/1000).')';
|
||||
$alt = $data['alt'];
|
||||
$acc = $data['acc'];
|
||||
$speed = $data['speed'];
|
||||
$provider = isset($data['provider']) ? "'".$data['provider']."'" : "NULL";
|
||||
$userID = $data['userID'];
|
||||
$seriesID = $data['seriesID'];
|
||||
$sensorID = $data['sensorID'];
|
||||
$id = $data['ID'];
|
||||
$cluster = $data['cluster'];
|
||||
$values_count = $data['values_count'];
|
||||
|
||||
|
||||
$lat = $data['lat'];
|
||||
$long = $data['lon'];
|
||||
|
||||
//long / lat -> GEOMETRY object
|
||||
$center = "ST_GeomFromText('POINT(".$long." ".$lat.")')";
|
||||
|
||||
|
||||
|
||||
|
||||
$postgresSql.=" (".$valuesID.", ".$typeID.", ".$value.", ".$visibility.", ".$timestamp." , ".$alt." , ".$acc." , ".$speed."
|
||||
, ".$provider.", ".$userID.", ".$seriesID.", ".$sensorID.", ".$center.", ".$id.", ".$cluster.", ".$values_count."),";
|
||||
}
|
||||
|
||||
$postgresSql = substr($postgresSql, 0, strlen($postgresSql)-1);
|
||||
$postgresSql.=";";
|
||||
|
||||
//insert new stuff
|
||||
$res = $postgres->query($postgresSql);
|
||||
|
||||
|
||||
if($max >= $IDcount){
|
||||
$transfereIncomplete = false;
|
||||
}else{
|
||||
$min += 50000;
|
||||
$max += 50000;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$this->dataTransfered = $this->dataTransfered + $rowCount;
|
||||
echo 'Transfered table values_cleaned ['.$rowCount.' rows] (MySQL) to table data_processed.data_values_cleaned (Postgres).<br/ >';
|
||||
flush();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\DB;
|
||||
|
||||
class Connection extends ConnectionAbstr{
|
||||
|
||||
//The open Connection, either ConnectionPG or ConnectionMYS
|
||||
private $connection = NULL;
|
||||
//private $dbinfo = NULL;
|
||||
|
||||
//Connects to DB, dependent on DBInfo a connection to a PG or MYS will be established
|
||||
public function __construct(DBInfo $dbinfo){
|
||||
//$this->dbinfo = $dbinfo;
|
||||
|
||||
if($dbinfo instanceof \SYSTEM\DB\DBInfoPG){
|
||||
$this->connection = new \SYSTEM\DB\ConnectionPG($dbinfo);
|
||||
} else if ($dbinfo instanceof \SYSTEM\DB\DBInfoMYS){
|
||||
$this->connection = new \SYSTEM\DB\ConnectionMYS($dbinfo);
|
||||
} else if ($dbinfo instanceof \SYSTEM\DB\DBInfoAMQP){
|
||||
$this->connection = new \SYSTEM\DB\ConnectionAMQP($dbinfo);
|
||||
} else {
|
||||
throw new \Exception('Could not understand Database Settings. Check ur Database Settings');}
|
||||
}
|
||||
|
||||
//Destruct connection object.
|
||||
public function __destruct(){
|
||||
unset($this->connection);}
|
||||
|
||||
//Query connected Database with prepared statements, $stmt = sql string with ?; $values = array of values
|
||||
public function prepare($stmtName, $stmt, $values){
|
||||
return $this->connection->prepare($stmtName, $stmt, $values);}
|
||||
|
||||
//Close Connection
|
||||
public function close(){
|
||||
return $this->connection->close();}
|
||||
|
||||
//Query connected Database
|
||||
public function query($query){
|
||||
return $this->connection->query($query);}
|
||||
}
|
||||
@ -1,64 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\DB;
|
||||
|
||||
class ConnectionAMQP extends ConnectionAbstr {
|
||||
|
||||
private $connection = NULL;
|
||||
|
||||
public function __construct(DBInfo $dbinfo){
|
||||
$this->connection = new \AMQPConnection(
|
||||
array(
|
||||
'host' => $dbinfo->m_host,
|
||||
'vhost' => $dbinfo->m_database,
|
||||
'port' => $dbinfo->m_port,
|
||||
'login' => $dbinfo->m_user,
|
||||
'password' => $dbinfo->m_password
|
||||
));
|
||||
|
||||
$this->connection->connect();
|
||||
|
||||
if(!$this->connection || !$this->connection->isConnected()){
|
||||
throw new \SYSTEM\LOG\ERROR('Cannot connect to the amqp queue!');}
|
||||
}
|
||||
|
||||
public function send($msg){
|
||||
$channel = new \AMQPChannel($this->connection);
|
||||
$exchange = new \AMQPExchange($channel);
|
||||
$exchange->setFlags(AMQP_DURABLE);
|
||||
$exchange->setName('exchange2');
|
||||
$exchange->setType('direct');
|
||||
$exchange->declare();
|
||||
|
||||
$queue = new \AMQPQueue($channel);
|
||||
$queue->setName('series');
|
||||
$queue->setFlags(AMQP_DURABLE | AMQP_AUTODELETE);
|
||||
$queue->declare();
|
||||
$queue->bind('exchange2','series');
|
||||
|
||||
$channel->startTransaction();
|
||||
$message = $exchange->publish(json_encode($msg), 'series', AMQP_MANDATORY,
|
||||
array('content_type' => 'application/json',
|
||||
'delivery_mode' => 2));
|
||||
$channel->commitTransaction();
|
||||
|
||||
if(!$message) {
|
||||
throw new \SYSTEM\LOG\ERROR("Error: Message '".$message."' was not sent to queue.!");
|
||||
}
|
||||
}
|
||||
|
||||
public function __destruct(){
|
||||
$this->close();
|
||||
}
|
||||
|
||||
public function close(){
|
||||
if (!$this->connection->disconnect()) {
|
||||
throw new Exception("Could not disconnect !");
|
||||
}
|
||||
}
|
||||
|
||||
public function query($query){ }
|
||||
|
||||
public function prepare($stmtName, $stmt, $values){}
|
||||
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\DB;
|
||||
|
||||
abstract class ConnectionAbstr {
|
||||
//Connects to Database with given DBInfos
|
||||
abstract public function __construct(DBInfo $dbinfo);
|
||||
//Close Connection to Database
|
||||
abstract public function __destruct();
|
||||
//Close Connection to Database
|
||||
abstract public function close();
|
||||
//Query Database with prepared Statement with $stmtName = name of the stament(pg only) $stmt = string and $values = array()
|
||||
abstract public function prepare($stmtName, $stmt, $values);
|
||||
//Query Database with normal Statement with $query = SQLString
|
||||
abstract public function query($query);
|
||||
|
||||
//Convert Prepared Values to SQL Type identifiers
|
||||
protected static function getPrepareValueType($value){
|
||||
if(is_double($value)){
|
||||
return 'd';}
|
||||
if(is_integer($value)){
|
||||
return 'i';}
|
||||
if(is_string($value)){
|
||||
return 's';}
|
||||
//blob
|
||||
return 'b';
|
||||
}
|
||||
}
|
||||
@ -1,57 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\DB;
|
||||
|
||||
class ConnectionMYS extends ConnectionAbstr {
|
||||
private $connection = NULL;
|
||||
//private $dbinfo = NULL;
|
||||
|
||||
public function __construct(DBInfo $dbinfo, $new_link = false, $client_flag = 0){
|
||||
//$this->dbinfo = $dbinfo;
|
||||
|
||||
$this->connection = mysqli_connect($dbinfo->m_host, $dbinfo->m_user, $dbinfo->m_password, $new_link, $client_flag);
|
||||
if(!$this->connection){
|
||||
throw new \Exception('Could not connect to Database. Check ur Database Settings');}
|
||||
|
||||
if(!mysqli_select_db($this->connection, $dbinfo->m_database)){
|
||||
mysqli_close($this->connection);
|
||||
throw new \Exception('Could not select Database. Check ur Database Settings: '.mysqli_error($this->connection));}
|
||||
}
|
||||
|
||||
public function __destruct(){
|
||||
$this->close();}
|
||||
|
||||
public function prepare($stmtName, $stmt, $values){
|
||||
$prepStmt = \mysqli_prepare($this->connection, $stmt);
|
||||
if(!$prepStmt){
|
||||
throw new \Exception('Prepared Statement prepare fail: '. \mysqli_error($this->connection));}
|
||||
|
||||
$types = '';
|
||||
$binds = array($prepStmt,null);
|
||||
for($i =0; $i < \count($values);$i++){
|
||||
$types .= self::getPrepareValueType($values[$i]);
|
||||
$binds[] = &$values[$i];
|
||||
}
|
||||
$binds[1] = $types;
|
||||
\call_user_func_array('mysqli_stmt_bind_param', $binds);
|
||||
|
||||
if(!mysqli_stmt_execute($prepStmt)){
|
||||
throw new \Exception("Could not execute prepare statement: ". \mysqli_stmt_error($prepStmt));}
|
||||
|
||||
return new ResultMysqliPrepare($prepStmt);
|
||||
}
|
||||
|
||||
public function close(){
|
||||
return mysqli_close($this->connection);}
|
||||
|
||||
public function query($query){
|
||||
$result = mysqli_query($this->connection, $query);
|
||||
if(!$result){
|
||||
throw new \Exception('Could not query Database. Check ur Query Syntax or required Rights: '.mysqli_error($this->connection));}
|
||||
|
||||
if($result === TRUE){
|
||||
return TRUE;}
|
||||
|
||||
return new ResultMysqli($result);
|
||||
}
|
||||
}
|
||||
@ -1,54 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\DB;
|
||||
|
||||
class ConnectionPG extends ConnectionAbstr {
|
||||
|
||||
private $connection = NULL;
|
||||
//private $dbinfo = NULL;
|
||||
|
||||
public function __construct(DBInfo $dbinfo){
|
||||
//$this->dbinfo = $dbinfo;
|
||||
|
||||
$this->connection = pg_connect("host=".$dbinfo->m_host." port=".$dbinfo->m_port." dbname=".$dbinfo->m_database."
|
||||
user=".$dbinfo->m_user." password=".$dbinfo->m_password."");
|
||||
if(!$this->connection){
|
||||
throw new \SYSTEM\LOG\ERROR('Could not connect to Database. Check ur Database Settings');}
|
||||
}
|
||||
|
||||
public function __destruct(){}
|
||||
|
||||
public function prepare($stmtName, $stmt, $values){
|
||||
$result = pg_query_params($this->connection, 'SELECT name FROM pg_prepared_statements WHERE name = $1', array($stmtName));
|
||||
//var_dump($stmt);
|
||||
//var_dump($values);
|
||||
if (pg_num_rows($result) == 0) {
|
||||
$result = \pg_prepare($this->connection, $stmtName, $stmt);
|
||||
}
|
||||
|
||||
if(!$result)
|
||||
throw new \SYSTEM\LOG\ERROR('Prepared Statement prepare fail: '. \pg_last_error($this->connection));
|
||||
|
||||
$result = \pg_execute($this->connection, $stmtName, $values);
|
||||
|
||||
if(!$result)
|
||||
throw new \SYSTEM\LOG\ERROR("Could not execute prepare statement: ". \pg_last_error($this->connection));
|
||||
|
||||
return new ResultPostgres($result);
|
||||
}
|
||||
|
||||
public function close(){
|
||||
return pg_close($this->connection);}
|
||||
|
||||
public function query($query){
|
||||
$result = pg_query($this->connection, $query);
|
||||
if(!$result){
|
||||
throw new \SYSTEM\LOG\ERROR('Could not query Database. Check ur Query Syntax or required Rights: '.pg_last_error($this->connection));}
|
||||
|
||||
if($result === TRUE){
|
||||
return TRUE;}
|
||||
|
||||
return new ResultPostgres($result);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\DB;
|
||||
|
||||
abstract class DBInfo {
|
||||
public $m_database = null;
|
||||
public $m_user = null;
|
||||
public $m_password = null;
|
||||
public $m_host = null;
|
||||
public $m_port = null;
|
||||
|
||||
abstract public function __construct($database , $user , $password, $host, $port = null);
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
namespace SYSTEM\DB;
|
||||
|
||||
class DBInfoAMQP extends \SYSTEM\DB\DBInfo {
|
||||
|
||||
public function __construct($vhost , $user , $password, $host, $port = null){
|
||||
$this->m_database = $vhost;
|
||||
$this->m_user = $user;
|
||||
$this->m_password = $password;
|
||||
$this->m_host = $host;
|
||||
$this->m_port = $port;
|
||||
|
||||
if( $this->m_database == null ||
|
||||
$this->m_user == null ||
|
||||
$this->m_password == null ||
|
||||
$this->m_host == null){
|
||||
throw new \Exception("AMQP Connection Info not correct, vhost, user, password or host are null");}
|
||||
}
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
namespace SYSTEM\DB;
|
||||
|
||||
class DBInfoMYS extends \SYSTEM\DB\DBInfo {
|
||||
|
||||
public function __construct($database , $user , $password, $host, $port = null){
|
||||
$this->m_database = $database;
|
||||
$this->m_user = $user;
|
||||
$this->m_password = $password;
|
||||
$this->m_host = $host;
|
||||
$this->m_port = $port;
|
||||
|
||||
if( $this->m_database == null ||
|
||||
$this->m_user == null ||
|
||||
$this->m_password == null ||
|
||||
$this->m_host == null){
|
||||
throw new \Exception("DBInfo not correct, database, user, password or host are null");}
|
||||
}
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
namespace SYSTEM\DB;
|
||||
|
||||
class DBInfoPG extends \SYSTEM\DB\DBInfo {
|
||||
|
||||
public function __construct($database , $user , $password, $host, $port = null){
|
||||
$this->m_database = $database;
|
||||
$this->m_user = $user;
|
||||
$this->m_password = $password;
|
||||
$this->m_host = $host;
|
||||
$this->m_port = $port;
|
||||
|
||||
if( $this->m_database == null ||
|
||||
$this->m_user == null ||
|
||||
$this->m_password == null ||
|
||||
$this->m_host == null){
|
||||
throw new \Exception("DBInfo not correct, database, user, password or host are null");}
|
||||
}
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\DB;
|
||||
|
||||
abstract class Result {
|
||||
|
||||
public abstract function count();
|
||||
|
||||
public abstract function affectedRows();
|
||||
|
||||
public abstract function next($object = false, $result_type = MYSQL_BOTH);
|
||||
|
||||
public abstract function seek($row_number);
|
||||
|
||||
public abstract function close();
|
||||
}
|
||||
@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\DB;
|
||||
|
||||
class ResultAMQP extends \SYSTEM\DB\Result{ // < maybe not ? check if amqpchannel is compatible with dbresult.
|
||||
|
||||
private $res = NULL;
|
||||
private $current = NULL;
|
||||
|
||||
//Result from mysql_query
|
||||
public function __construct($res){
|
||||
$this->res = $res;}
|
||||
|
||||
public function __destruct(){
|
||||
$this->close();}
|
||||
|
||||
public function close(){
|
||||
pg_free_result($this->res);}
|
||||
|
||||
public function count(){
|
||||
return pg_num_rows($this->res);}
|
||||
|
||||
public function affectedRows(){
|
||||
throw new \SYSTEM\LOG\ERROR("Not Supported!");}
|
||||
|
||||
public function next($object = false, $result_type = MYSQL_BOTH){
|
||||
if($object){
|
||||
$this->current = pg_fetch_object($this->res);
|
||||
} else {
|
||||
$this->current = pg_fetch_assoc($this->res);
|
||||
}
|
||||
return $this->current;
|
||||
}
|
||||
|
||||
public function seek($row_number){
|
||||
return pg_data_seek($this->res,$row_number);}
|
||||
}
|
||||
@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\DB;
|
||||
|
||||
class ResultMysqli extends \SYSTEM\DB\Result{
|
||||
|
||||
private $res = NULL;
|
||||
private $current = NULL;
|
||||
|
||||
//Result from mysql_query
|
||||
public function __construct($res){
|
||||
$this->res = $res;}
|
||||
|
||||
public function __destruct(){
|
||||
$this->close();}
|
||||
|
||||
public function close(){
|
||||
mysqli_free_result($this->res);}
|
||||
|
||||
public function count(){
|
||||
return mysqli_num_rows($this->res);}
|
||||
|
||||
public function affectedRows(){
|
||||
return mysqli_affected_rows($this->res);}
|
||||
|
||||
public function next($object = false, $result_type = MYSQL_BOTH){
|
||||
if($object){
|
||||
$this->current = mysqli_fetch_object($this->res);
|
||||
} else {
|
||||
$this->current = mysqli_fetch_assoc($this->res);
|
||||
}
|
||||
return $this->current;
|
||||
}
|
||||
|
||||
public function seek($row_number){
|
||||
return mysqli_data_seek($this->res,$row_number);}
|
||||
}
|
||||
@ -1,55 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\DB;
|
||||
|
||||
class ResultMysqliPrepare extends \SYSTEM\DB\Result{
|
||||
|
||||
private $res = NULL;
|
||||
private $meta = NULL;
|
||||
private $binds = array();
|
||||
|
||||
//Result from mysql_query
|
||||
public function __construct($res){
|
||||
$this->res = $res;
|
||||
|
||||
$this->meta = \mysqli_stmt_result_metadata($this->res);
|
||||
|
||||
if(!$this->meta){
|
||||
//occurs on insert
|
||||
//throw new \Exception("Could not retrieve meta for prepare statement");}
|
||||
return;}
|
||||
|
||||
while ($field = $this->meta->fetch_field() ) {
|
||||
$this->binds[$field->name] = &$this->binds[$field->name];}
|
||||
|
||||
\mysqli_free_result($this->meta);
|
||||
|
||||
call_user_func_array(array($this->res, 'bind_result'), $this->binds);
|
||||
}
|
||||
|
||||
public function __destruct() {
|
||||
$this->close();}
|
||||
|
||||
public function close(){
|
||||
mysqli_stmt_free_result($this->res);
|
||||
mysqli_stmt_close($this->res);
|
||||
}
|
||||
|
||||
public function count(){
|
||||
return \mysqli_stmt_num_rows($this->res);}
|
||||
|
||||
public function affectedRows(){
|
||||
return \mysqli_stmt_affected_rows($this->res);}
|
||||
|
||||
//$object not used
|
||||
//$result_type not used!
|
||||
public function next($object = false, $result_type = MYSQL_BOTH){
|
||||
if(\mysqli_stmt_fetch($this->res)){
|
||||
return $this->binds;}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
public function seek($row_number){
|
||||
return \mysqli_stmt_data_seek($this->res,$row_number);}
|
||||
}
|
||||
@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\DB;
|
||||
|
||||
class ResultPostgres extends \SYSTEM\DB\Result{
|
||||
|
||||
private $res = NULL;
|
||||
private $current = NULL;
|
||||
|
||||
//Result from mysql_query
|
||||
public function __construct($res){
|
||||
$this->res = $res;}
|
||||
|
||||
public function __destruct(){
|
||||
$this->close();}
|
||||
|
||||
public function close(){
|
||||
pg_free_result($this->res);}
|
||||
|
||||
public function count(){
|
||||
return pg_num_rows($this->res);}
|
||||
|
||||
public function affectedRows(){
|
||||
return pg_affected_rows($this->res);}
|
||||
|
||||
public function next($object = false, $result_type = MYSQL_BOTH){
|
||||
if($object){
|
||||
$this->current = pg_fetch_object($this->res);
|
||||
} else {
|
||||
$this->current = pg_fetch_assoc($this->res);
|
||||
}
|
||||
return $this->current;
|
||||
}
|
||||
|
||||
public function seek($row_number){
|
||||
return pg_data_seek($this->res,$row_number);}
|
||||
}
|
||||
@ -1,96 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\LOG;
|
||||
|
||||
class LOG {
|
||||
|
||||
//Singleton
|
||||
private $handlers = array();
|
||||
private static $instance = null;
|
||||
public static function getInstance(){
|
||||
if (null === self::$instance) {
|
||||
self::$instance = new self;}
|
||||
return self::$instance;
|
||||
}
|
||||
private function __construct(){}
|
||||
private function __clone(){}
|
||||
|
||||
//$handler = string with classname
|
||||
public function registerHandler($handler){
|
||||
if( !class_exists($handler) ||
|
||||
!\method_exists($handler,'MASK') ||
|
||||
!\method_exists($handler,'CALL')){
|
||||
die("You registered an invalid Errorhandler!");}
|
||||
$this->handlers[] = $handler;
|
||||
|
||||
set_error_handler('\SYSTEM\LOG\LOG::__error_handler');
|
||||
set_exception_handler('\SYSTEM\LOG\LOG::__exception_handler');
|
||||
}
|
||||
|
||||
private function call_handlers(\Exception $E, $errno, $thrown = false){
|
||||
foreach($this->handlers as $handler){
|
||||
if( ((call_user_func(array($handler,'MASK')) & $errno)) &&
|
||||
call_user_func_array(array($handler,'CALL'),array($E,$errno, $thrown))){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//Static
|
||||
//Exceptions
|
||||
public static function __exception_handler(\Exception $E, $thrown = true){
|
||||
if($E instanceof \SYSTEM\LOG\ERROR) { return self::LOG_EXCEPTION($E, E_USER_ERROR, $thrown);} //Dies
|
||||
if($E instanceof \SYSTEM\LOG\WARNING) { return self::LOG_EXCEPTION($E, E_USER_WARNING, $thrown);} //Continues
|
||||
if($E instanceof \SYSTEM\LOG\INFO) { return self::LOG_EXCEPTION($E, E_NOTICE, $thrown);} //Continues
|
||||
if($E instanceof \SYSTEM\LOG\DEPRECATED){ return self::LOG_EXCEPTION($E, E_USER_DEPRECATED, $thrown);} //Continues
|
||||
self::LOG_EXCEPTION($E, E_USER_ERROR, $thrown); //Dies
|
||||
}
|
||||
|
||||
//Triggers error, if not handled by registered Handlers(double check -> but only this way we can keep the original Exception class)
|
||||
protected static function LOG_EXCEPTION(\Exception $E,$errno = E_USER_ERROR, $thrown = false){
|
||||
self::__error_handler_e($E, $errno, $thrown);}
|
||||
|
||||
//Errors
|
||||
public static function __error_handler($errno, $errstr, $errfile, $errline){
|
||||
$e = new \SYSTEM\LOG\ERROR($errstr,$errno);
|
||||
return self::__error_handler_e($e ,$errno, true);}
|
||||
public static function __error_handler_e(\Exception $E, $errno, $thrown){
|
||||
switch ($errno) {
|
||||
//Fatal run-time errors. These indicate errors that can not be recovered from, such as a memory allocation problem. Execution of the script is halted.
|
||||
case E_ERROR: return self::_DIE($E,$errno,true);
|
||||
//Run-time warnings (non-fatal errors). Execution of the script is not halted.
|
||||
case E_WARNING: return self::_CONTINUE($E,$errno,true);
|
||||
//Compile-time parse errors. Parse errors should only be generated by the parser.
|
||||
case E_PARSE: return self::_DIE($E,$errno,true);
|
||||
//Run-time notices. Indicate that the script encountered something that could indicate an error, but could also happen in the normal course of running a script.
|
||||
case E_NOTICE: return self::_CONTINUE($E,$errno,false | $thrown);
|
||||
//Fatal errors that occur during PHP's initial startup. This is like an E_ERROR, except it is generated by the core of PHP.
|
||||
case E_CORE_ERROR: return self::_DIE($E,$errno,true);
|
||||
//Warnings (non-fatal errors) that occur during PHP's initial startup. This is like an E_WARNING, except it is generated by the core of PHP.
|
||||
case E_CORE_WARNING: return self::_CONTINUE($E,$errno,true);
|
||||
//Fatal compile-time errors. This is like an E_ERROR, except it is generated by the Zend Scripting Engine.
|
||||
case E_COMPILE_ERROR: return self::_DIE($E,$errno,true);
|
||||
//Compile-time warnings (non-fatal errors). This is like an E_WARNING, except it is generated by the Zend Scripting Engine.
|
||||
case E_COMPILE_WARNING: return self::_CONTINUE($E,$errno,true);
|
||||
//User-generated error message. This is like an E_ERROR, except it is generated in PHP code by using the PHP function trigger_error().
|
||||
case E_USER_ERROR: return self::_DIE($E,$errno,false | $thrown);
|
||||
//User-generated warning message. This is like an E_WARNING, except it is generated in PHP code by using the PHP function trigger_error().
|
||||
case E_USER_WARNING: return self::_CONTINUE($E,$errno,false | $thrown);
|
||||
//Enable to have PHP suggest changes to your code which will ensure the best interoperability and forward compatibility of your code. Since PHP 5 but not included in E_ALL until PHP 5.4.0 rated in PHP code by using the PHP function trigger_error().
|
||||
case E_STRICT: return self::_CONTINUE($E,$errno,true);
|
||||
//Catchable fatal error. It indicates that a probably dangerous error occurred, but did not leave the Engine in an unstable state. If the error is not caught by a user defined handle (see also set_error_handler()), the application aborts as it was an E_ERROR. Since PHP 5.2.0
|
||||
case E_RECOVERABLE_ERROR: return self::_CONTINUE($E,$errno,true);
|
||||
//Run-time notices. Enable this to receive warnings about code that will not work in future versions. Since PHP 5.3.0
|
||||
case E_DEPRECATED: return self::_CONTINUE($E,$errno,true);
|
||||
//User-generated warning message. This is like an E_DEPRECATED, except it is generated in PHP code by using the PHP function trigger_error(). Since PHP 5.3.0
|
||||
case E_USER_DEPRECATED: return self::_CONTINUE($E,$errno,false | $thrown);
|
||||
default: return false; //Not handled Error use std php handler
|
||||
}
|
||||
}
|
||||
|
||||
private static function _DIE(\Exception $E, $errno, $thrown = false){
|
||||
if(self::getInstance()->call_handlers($E, $errno, $thrown)){die();}}
|
||||
private static function _CONTINUE(\Exception $E, $errno, $thrown = false){
|
||||
return self::getInstance()->call_handlers($E, $errno, $thrown);}
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\LOG;
|
||||
|
||||
class error_handler {
|
||||
//Error Mask E_ALL, E_NOTICE ...
|
||||
public static function MASK(){
|
||||
throw new \RuntimeException("Unimplemented!");}
|
||||
//Errorhandler
|
||||
public static function CALL(\Exception $E, $errno, $thrown){
|
||||
throw new \RuntimeException("Unimplemented!");}
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\LOG;
|
||||
|
||||
//Register this before every other handler, cuz this will need to handle every single error.
|
||||
//And only the first ErrorHandler will be called if he returns true in CALL.
|
||||
abstract class error_handler_dbwriter extends \SYSTEM\LOG\error_handler {
|
||||
public static function CALL(\Exception $E, $errno, $thrown){
|
||||
try{
|
||||
$con = new \SYSTEM\DB\Connection(static::getDBInfo());
|
||||
$con->prepare( 'sysLogStmt', 'INSERT INTO system.sys_log '.
|
||||
'(class, message, code, file, line, trace, ip, querytime) '.
|
||||
'VALUES ($1, $2, $3, $4, $5, $6, $7, $8);',
|
||||
array( get_class($E), $E->getMessage(), $E->getCode(), $E->getFile(), $E->getLine(), $E->getTraceAsString(),
|
||||
getenv('REMOTE_ADDR'),round(microtime(true) - \SYSTEM\time::getStartTime(),5)));
|
||||
} catch (\Exception $E){} //Error -> Ignore
|
||||
|
||||
return false; //We just log and do not handle the error!
|
||||
}
|
||||
|
||||
abstract protected static function getDBInfo();
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\LOG;
|
||||
|
||||
class error_handler_jsonoutput extends \SYSTEM\LOG\error_handler {
|
||||
//Only those who die!
|
||||
public static function MASK(){ return \E_ALL;} //\E_ERROR | \E_USER_ERROR | \E_CORE_ERROR | \E_COMPILE_ERROR; }
|
||||
public static function CALL(\Exception $E, $errno, $thrown){
|
||||
if($thrown){
|
||||
//TODO move jsonresult into system
|
||||
echo \SYSTEM\LOG\JsonResult::error($E);
|
||||
die(); //we can have only one json result per page call else -> multiple headers are sent
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\LOG;
|
||||
|
||||
class DEPRECATED extends \Exception {
|
||||
public function __construct($message = "", $code = 0, $previous = NULL){
|
||||
parent::__construct($message, $code, $previous);
|
||||
\SYSTEM\LOG\LOG::__exception_handler($this,false);
|
||||
}
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\LOG;
|
||||
|
||||
class ERROR extends \Exception {
|
||||
public function __construct($message = "", $code = 0, $previous = NULL){
|
||||
parent::__construct($message, $code, $previous);
|
||||
\SYSTEM\LOG\LOG::__exception_handler($this,false);
|
||||
}
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\LOG;
|
||||
|
||||
class INFO extends \Exception {
|
||||
public function __construct($message = "", $code = 0, $previous = NULL){
|
||||
parent::__construct($message, $code, $previous);
|
||||
\SYSTEM\LOG\LOG::__exception_handler($this,false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\LOG;
|
||||
|
||||
class TranslatableError extends \SYSTEM\LOG\ERROR {
|
||||
public function __construct($string_id, $code = 0, $previous = NULL , $locale = NULL){
|
||||
|
||||
$message = \SYSTEM\locale::getStrings(array($string_id), $locale);
|
||||
//print_r($message);
|
||||
|
||||
if(!isset($message[$string_id])){
|
||||
throw new \SYSTEM\LOG\ERROR("Could not retrive Errortranslation: ".$string_id);}
|
||||
|
||||
parent::__construct($message[$string_id], $code, $previous);
|
||||
\SYSTEM\LOG\LOG::__exception_handler($this,false);
|
||||
}
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\LOG;
|
||||
|
||||
class WARNING extends \Exception {
|
||||
public function __construct($message = "", $code = 0, $previous = NULL){
|
||||
parent::__construct($message, $code, $previous);
|
||||
\SYSTEM\LOG\LOG::__exception_handler($this,false);
|
||||
}
|
||||
}
|
||||
@ -1,2 +0,0 @@
|
||||
<?php
|
||||
class DEPRECATED extends \SYSTEM\LOG\DEPRECATED {}
|
||||
@ -1,2 +0,0 @@
|
||||
<?php
|
||||
class ERROR extends \SYSTEM\LOG\ERROR {}
|
||||
@ -1,3 +0,0 @@
|
||||
<?php
|
||||
class INFO extends \SYSTEM\LOG\INFO {}
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
<?php
|
||||
class WARNING extends \SYSTEM\LOG\WARNING {}
|
||||
@ -1,2 +0,0 @@
|
||||
<?php
|
||||
\SYSTEM\LOG\LOG::getInstance()->registerHandler('\SYSTEM\LOG\error_handler_jsonoutput');
|
||||
@ -1,2 +0,0 @@
|
||||
<?php
|
||||
\SYSTEM\autoload::getInstance()->registerFolder(dirname(__FILE__).'/exceptions_shortcut','');
|
||||
@ -1,2 +0,0 @@
|
||||
<?php
|
||||
\SYSTEM\autoload::getInstance()->registerFolder(dirname(__FILE__).'/result_shortcut','');
|
||||
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\LOG;
|
||||
|
||||
class AbstractResult {
|
||||
//Returns the result as a string
|
||||
public static function toString($json_array, $status , $start_time){
|
||||
throw new RuntimeException("Unimplemented");}
|
||||
//Return Exception as string
|
||||
public static function error(\Exception $e){
|
||||
throw new RuntimeException("Unimplemented");}
|
||||
//Returns OK status
|
||||
public static function ok(){
|
||||
throw new RuntimeException("Unimplemented");}
|
||||
}
|
||||
@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\LOG;
|
||||
|
||||
class JsonResult extends \SYSTEM\LOG\AbstractResult {
|
||||
|
||||
const JSONRESULT_OK = true;
|
||||
const JSONRESULT_ERROR = false;
|
||||
|
||||
public static function toString($json_array, $status = self::JSONRESULT_OK, $start_time = NULL){
|
||||
//send Header
|
||||
\SYSTEM\HEADER::JSON();
|
||||
|
||||
if($start_time == NULL){
|
||||
$start_time = \SYSTEM\time::getStartTime();}
|
||||
|
||||
$json = array();
|
||||
$json['querytime'] = round(microtime(true) - $start_time,5);
|
||||
$json['status'] = $status;
|
||||
$json['result'] = $json_array;
|
||||
|
||||
return json_encode($json);
|
||||
}
|
||||
|
||||
//Return Exception as string
|
||||
public static function error(\Exception $e){
|
||||
$error = array();
|
||||
|
||||
$error['class'] = get_class($e);
|
||||
$error['message'] = htmlentities($e->getMessage());
|
||||
$error['code'] = $e->getCode();
|
||||
$error['file'] = $e->getFile();
|
||||
$error['line'] = $e->getLine();
|
||||
$error['trace'] = array_slice(explode('#', $e->getTraceAsString()), 1, -1);;
|
||||
|
||||
return self::toString($error, self::JSONRESULT_ERROR);
|
||||
}
|
||||
|
||||
//Returns OK status
|
||||
public static function ok(){
|
||||
return self::toString(array());}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
<?php
|
||||
|
||||
class JsonResult extends \SYSTEM\LOG\JsonResult {}
|
||||
@ -1,7 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\PAGE;
|
||||
|
||||
abstract class Page {
|
||||
abstract public function html();
|
||||
}
|
||||
@ -1,133 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Table:
|
||||
* ID FLAG C/P PARENTCOMMANDID ISCHACHED ALLOWEDVALUES (cache only for commands, null on command = dont care)
|
||||
* 0 C 'CALL' -1 null null (calculated by the api for commands)
|
||||
* 1 C 'ALGO' 0 true null
|
||||
* 2 P 'x' 1 null GOOGLEMAPXY (function in MYVERIFY::func)
|
||||
* 3 P 'y' 1 null GOOGLEMAPXY
|
||||
* 4 P 'zoom' 1 null GOOGLEMAPZOOM
|
||||
* 5 P 'from' 1 null TIMEWIERDFORMAT
|
||||
* 6 P 'to' 1 null TIMEWIERDFORMAT
|
||||
* 7 P 'type' 1 null SENSORTYPE
|
||||
* 8 P 'provider' 1 null SENSORPROVIDER
|
||||
* 9 P 'visibility' 1 null SENSORVISIBILITY
|
||||
* 10 C 'markers' 1 null BOOL
|
||||
*
|
||||
* MYAPI::map_heatmap($PARAMS,$OPTIONS)
|
||||
* MYAPI::map_heatmap_key
|
||||
*/
|
||||
|
||||
namespace SYSTEM\PAGE;
|
||||
|
||||
class PageApi {
|
||||
|
||||
private $m_dbinfo = null;
|
||||
private $m_verifyclass = null;
|
||||
private $m_pageclass = null;
|
||||
|
||||
public function __construct($DBInfo,\SYSTEM\verifyclass $VerifyClass, \SYSTEM\PAGE\PageClass $PageClass){
|
||||
$this->m_dbinfo = $DBInfo;
|
||||
$this->m_verifyclass = $VerifyClass;
|
||||
$this->m_pageclass = $PageClass;
|
||||
}
|
||||
|
||||
// $call = post + get params
|
||||
// returns resultstring
|
||||
public function CALL($call = array()){
|
||||
//Get the Databasetree
|
||||
$tree = array();
|
||||
if($this->m_dbinfo instanceof \SYSTEM\DB\DBInfo){
|
||||
$tree = self::getPageTree();}
|
||||
else {
|
||||
if(!is_array($this->m_dbinfo)){
|
||||
throw new \SYSTEM\LOG\ERROR('No Connectioninfo and no call table given to the api');}
|
||||
$tree = $this->m_dbinfo;
|
||||
}
|
||||
|
||||
//Commands
|
||||
$commands = array();
|
||||
$parentid = -1;
|
||||
foreach($tree as $item){
|
||||
if( $item[\DBD\SYSTEM\PAGETable::FIELD_FLAG] == \DBD\SYSTEM\PAGETable::VALUE_FLAG_COMMAND &&
|
||||
$item[\DBD\SYSTEM\PAGETable::FIELD_PARENTID] == $parentid &&
|
||||
isset($call[$item[\DBD\SYSTEM\PAGETable::FIELD_NAME]])){
|
||||
|
||||
if( isset($item[\DBD\SYSTEM\PAGETable::FIELD_PARENTVALUE]) &&
|
||||
$commands[count($commands)-1][1] != $item[\DBD\SYSTEM\PAGETable::FIELD_PARENTVALUE]){
|
||||
continue;}
|
||||
$commands[] = array($item,$call[$item[\DBD\SYSTEM\PAGETable::FIELD_NAME]]);
|
||||
$parentid = $item[\DBD\SYSTEM\PAGETable::FIELD_ID];
|
||||
}
|
||||
}
|
||||
|
||||
//Parameters
|
||||
$command_call = '';
|
||||
$parameters = array();
|
||||
if(count($commands) > 0){
|
||||
$lastCommand = $commands[count($commands) -1 ][0];
|
||||
foreach($tree as $item){
|
||||
if( $item[\DBD\SYSTEM\PAGETable::FIELD_FLAG] == \DBD\SYSTEM\PAGETable::VALUE_FLAG_PARAM &&
|
||||
$item[\DBD\SYSTEM\PAGETable::FIELD_PARENTID] == $lastCommand[\DBD\SYSTEM\PAGETable::FIELD_ID]){
|
||||
|
||||
if( isset($item[\DBD\SYSTEM\PAGETable::FIELD_PARENTVALUE]) &&
|
||||
$commands[count($commands)-1][1] != $item[\DBD\SYSTEM\PAGETable::FIELD_PARENTVALUE]){
|
||||
continue;}
|
||||
|
||||
if(!isset($call[$item[\DBD\SYSTEM\PAGETable::FIELD_NAME]])){
|
||||
throw new \SYSTEM\LOG\ERROR('Parameter missing: '.$item[\DBD\SYSTEM\PAGETable::FIELD_NAME]);}
|
||||
|
||||
|
||||
if( !method_exists($this->m_verifyclass, $item[\DBD\SYSTEM\PAGETable::FIELD_ALLOWEDVALUES]) ||
|
||||
!$this->m_verifyclass->$item[\DBD\SYSTEM\PAGETable::FIELD_ALLOWEDVALUES]($call[$item[\DBD\SYSTEM\PAGETable::FIELD_NAME]])){
|
||||
throw new \SYSTEM\LOG\ERROR('Parameter type missmacht or Missing Verifier. Param: '.$item[\DBD\SYSTEM\PAGETable::FIELD_NAME].' Verifier: '.$item[\DBD\SYSTEM\PAGETable::FIELD_ALLOWEDVALUES]);}
|
||||
|
||||
$parameters[] = array($item, $call[$item[\DBD\SYSTEM\PAGETable::FIELD_NAME]]);
|
||||
}
|
||||
}
|
||||
|
||||
//Function Name
|
||||
foreach($commands as $com){
|
||||
if(!\preg_match('^[0-9A-Za-z_]+$^', $com[1])){
|
||||
throw new \SYSTEM\LOG\ERROR("Call Command can only have letters!");}
|
||||
|
||||
if($com[0][\DBD\SYSTEM\PAGETable::FIELD_ALLOWEDVALUES] == 'FLAG'){
|
||||
$command_call .= '_flag_'.$com[0][\DBD\SYSTEM\PAGETable::FIELD_NAME];
|
||||
} else {
|
||||
$command_call .= '_'.$com[0][\DBD\SYSTEM\PAGETable::FIELD_NAME].'_'.\strtolower($com[1]);}
|
||||
}
|
||||
$command_call = substr($command_call, 1);
|
||||
}
|
||||
|
||||
$command_call = $command_call == '' ? 'default_page': $command_call;
|
||||
|
||||
//Function parameters
|
||||
$parameter_call = array();
|
||||
if(count($parameters) > 0){
|
||||
foreach($parameters as $param){
|
||||
$parameter_call[] = $param[1];}
|
||||
}
|
||||
|
||||
if(!\method_exists($this->m_pageclass, $command_call)){
|
||||
throw new \SYSTEM\LOG\ERROR("Page call is not implemented in PageApi: ".$command_call);}
|
||||
|
||||
//Call Function
|
||||
return \call_user_func_array(array($this->m_pageclass,$command_call),$parameter_call);
|
||||
}
|
||||
|
||||
private function getPageTree(){
|
||||
|
||||
$con = new \SYSTEM\DB\Connection($this->m_dbinfo);
|
||||
$res = $con->query('SELECT * FROM '.\DBD\SYSTEM\PAGETable::NAME.' ORDER BY "'.\DBD\SYSTEM\PAGETable::FIELD_ID.'"');
|
||||
|
||||
if(!$res){
|
||||
throw new \SYSTEM\LOG\ERROR("Database Error ". pg_last_error());}
|
||||
|
||||
$result = array();
|
||||
while($row = $res->next()){
|
||||
$result[] = $row;}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\PAGE;
|
||||
|
||||
abstract class PageClass {
|
||||
public static function default_page(){
|
||||
throw new RuntimeException("Unimplemented");}
|
||||
}
|
||||
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\PAGE;
|
||||
|
||||
class replace
|
||||
{
|
||||
|
||||
public static function replace($text, $vars){
|
||||
|
||||
$search = array();
|
||||
$replace = array();
|
||||
|
||||
foreach(array_keys($vars) as $var){
|
||||
$search[] = '/\${'.$var.'}/';
|
||||
}
|
||||
|
||||
foreach($vars as $var){
|
||||
$replace[] = $var;
|
||||
}
|
||||
|
||||
return @preg_replace($search, $replace, $text);
|
||||
}
|
||||
|
||||
public static function replaceFile($path, $vars){
|
||||
|
||||
$buffer = file_get_contents($path);
|
||||
|
||||
return self::replace($buffer, $vars);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\SAI;
|
||||
|
||||
abstract class SaiModule {
|
||||
public static abstract function html_js();
|
||||
public static abstract function html_css();
|
||||
public static abstract function html_content();
|
||||
public static abstract function html_li_menu();
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once 'saigui.php';
|
||||
|
||||
//TODO database
|
||||
new \SYSTEM\LOG\DEPRECATED("database");
|
||||
$sai = new \SYSTEM\SAI\saigui(/*new \DBD\system()*/ new \DBD\dasenseuser());
|
||||
|
||||
echo $sai->html();
|
||||
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\SAI;
|
||||
|
||||
class sai {
|
||||
|
||||
private $modules = array(); //only strings!
|
||||
|
||||
//SINGLETON!
|
||||
static private $instance = null;
|
||||
static public function getInstance(){
|
||||
if (null === self::$instance) {
|
||||
self::$instance = new self;}
|
||||
return self::$instance;
|
||||
}
|
||||
private function __construct(){}
|
||||
private function __clone(){}
|
||||
|
||||
public function register($module){
|
||||
if( !\class_exists($module) ||
|
||||
!\is_array($parents = \class_parents($module)) ||
|
||||
!\array_search('SYSTEM\SAI\SaiModule', $parents)){
|
||||
throw new \Exception('Problem with your Sysmodule class: '.$module);}
|
||||
$this->modules[] = $module;}
|
||||
|
||||
public function getModules(){
|
||||
return $this->modules;}
|
||||
}
|
||||
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
$autoload = SYSTEM\autoload::getInstance();
|
||||
$autoload->registerFolder(dirname(__FILE__),'SYSTEM\SAI');
|
||||
|
||||
$autoload->registerFolder(dirname(__FILE__).'/page','SYSTEM\SAI');
|
||||
$autoload->registerFolder(dirname(__FILE__).'/page/default_page','SYSTEM\SAI');
|
||||
$autoload->registerFolder(dirname(__FILE__).'/page/login_page','SYSTEM\SAI');
|
||||
|
||||
$autoload->registerFolder(dirname(__FILE__).'/modules','SYSTEM\SAI');
|
||||
$autoload->registerFolder(dirname(__FILE__).'/modules/badge_creator','SYSTEM\SAI');
|
||||
|
||||
require_once dirname(__FILE__).'/modules/register_modules.php';
|
||||
@ -1,151 +0,0 @@
|
||||
|
||||
|
||||
/* global variables */
|
||||
|
||||
var fill = "#c7cee0";
|
||||
var stroke = "#112761";
|
||||
var strokeWidth = 0.7;
|
||||
var shape = "circle"; // shield,circle
|
||||
var icon = "dasense/page/default_developer/icons/red_dark/xhdpi/ic_action_achievement.png";
|
||||
|
||||
var iconX = 19;
|
||||
var iconY = 20;
|
||||
|
||||
|
||||
/* jQuery on document ready */
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$("input[name=background-color]").val(fill);
|
||||
$("input[name=stroke-color]").val(stroke);
|
||||
$("input[name=stroke-width]").val(strokeWidth);
|
||||
$("input[name=file-url]").val(icon);
|
||||
$("input[name=iconx]").val(iconX);
|
||||
$("input[name=icony]").val(iconY);
|
||||
$("input[name=shape]").filter("[value="+shape+"]").attr('checked', true);
|
||||
|
||||
drawBadge();
|
||||
|
||||
$("form input").change(function() {
|
||||
updateValues();
|
||||
drawBadge();
|
||||
});
|
||||
|
||||
$("form .btn-submit").click(function() {
|
||||
updateValues();
|
||||
drawBadge();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function updateValues() {
|
||||
fill = $("input[name=background-color]").val();
|
||||
stroke = $("input[name=stroke-color]").val();
|
||||
strokeWidth = $("input[name=stroke-width]").val();
|
||||
shape = $("input[name=shape]:checked").val();
|
||||
icon = $("input[name=file-url]").val();
|
||||
iconX = $("input[name=iconx]").val();
|
||||
iconY = $("input[name=icony]").val();
|
||||
}
|
||||
|
||||
function drawBadge() {
|
||||
var c = $("#badge")[0];
|
||||
var ctx = c.getContext("2d");
|
||||
|
||||
if(shape == 'shield') {
|
||||
//iconY = 30;
|
||||
//iconY = parseInt(iconY) + 10;
|
||||
drawShield(ctx);
|
||||
}
|
||||
else if (shape == 'circle') {
|
||||
//iconY = 20;
|
||||
//iconY = parseInt(iconY) - 10;
|
||||
strokeWidth *= 12;
|
||||
drawCircle(ctx);
|
||||
strokeWidth /= 12;
|
||||
}
|
||||
|
||||
$("input[name=iconx]").val(iconX);
|
||||
$("input[name=icony]").val(iconY);
|
||||
|
||||
var img = new Image();
|
||||
img.onload = function() {
|
||||
ctx.drawImage(img, iconX, iconY);
|
||||
onFinish();
|
||||
}
|
||||
img.src = icon;
|
||||
}
|
||||
|
||||
function onFinish() {
|
||||
var c = $("#badge")[0];
|
||||
var ctx = c.getContext("2d");
|
||||
ctx.restore();
|
||||
ctx.restore();
|
||||
ctx.save();
|
||||
$("a.btn-submit").attr('href', c.toDataURL());
|
||||
}
|
||||
|
||||
function drawShield(ctx) {
|
||||
ctx.canvas.height = 120;
|
||||
ctx.canvas.width = 105;
|
||||
clearCanvas(ctx);
|
||||
ctx.save();
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(0,0);
|
||||
ctx.lineTo(543,0);
|
||||
ctx.lineTo(543,623);
|
||||
ctx.lineTo(0,623);
|
||||
ctx.closePath();
|
||||
ctx.clip();
|
||||
ctx.translate(0,-5);
|
||||
ctx.scale(12,12);
|
||||
ctx.save();
|
||||
ctx.fillStyle = fill;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(4.25,1.34);
|
||||
//ctx.bezierCurveTo(2.9985,1.7142367,1.747,2.0902233,0.4955,2.46621);
|
||||
//ctx.bezierCurveTo(0.58758835,5.2587502,1.2884488,8.6654921,4.25,9.66175);
|
||||
//ctx.bezierCurveTo(7.2442172,8.6940151,7.8773651,5.2291438,8.0045,2.46621);
|
||||
//ctx.bezierCurveTo(6.753,2.0902233,5.5015,1.7142367,4.25,1.33825);
|
||||
ctx.bezierCurveTo(3,1.7,1.75,2,0.5,2.5);
|
||||
ctx.bezierCurveTo(0.6,5.26,1.29,8.67,4.25,9.66);
|
||||
ctx.bezierCurveTo(7.24,8.69,7.88,5.23,8,2.47);
|
||||
ctx.bezierCurveTo(6.75,2,5.5,1.71,4.25,1.34);
|
||||
ctx.closePath();
|
||||
ctx.fill();
|
||||
ctx.strokeStyle = stroke;
|
||||
ctx.lineWidth = strokeWidth;
|
||||
ctx.stroke();
|
||||
ctx.restore();
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
function drawCircle(ctx) {
|
||||
ctx.canvas.height = 100;
|
||||
clearCanvas(ctx);
|
||||
ctx.save();
|
||||
//ctx.translate(20,0);
|
||||
ctx.beginPath();
|
||||
ctx.arc(50,50,40,0,2*Math.PI);
|
||||
ctx.fillStyle = fill;
|
||||
ctx.fill();
|
||||
ctx.strokeStyle = stroke;
|
||||
ctx.lineWidth = strokeWidth;
|
||||
ctx.stroke();
|
||||
ctx.restore();
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
function clearCanvas(ctx) {
|
||||
var c = $("#badge")[0];
|
||||
// Store the current transformation matrix
|
||||
ctx.save();
|
||||
|
||||
// Use the identity matrix while clearing the canvas
|
||||
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
||||
ctx.clearRect(0, 0, c.width, c.height);
|
||||
|
||||
// Restore the transform
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
@ -1,128 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Badge Creator</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
<link href="dasense/page/default_developer/css/libs/jquery.miniColors.css" rel="stylesheet" />
|
||||
<style type="text/css">
|
||||
|
||||
/* Custom container */
|
||||
.container-narrow {
|
||||
|
||||
}
|
||||
|
||||
.jumbotron {
|
||||
margin: 40px 30px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.jumbotron h1 {
|
||||
line-height: 1.3em;
|
||||
}
|
||||
|
||||
.jumbotron .btn {
|
||||
font-size: 21px;
|
||||
padding: 14px 24px;
|
||||
}
|
||||
|
||||
form label {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
form label.radio {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
form fieldset {
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
span.minicolors {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="container-narrow">
|
||||
|
||||
<div class="masthead">
|
||||
|
||||
<h3 class="muted">Badge Creator 1.0</h3>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="row">
|
||||
<div class="span5">
|
||||
<form>
|
||||
<legend>Design</legend>
|
||||
<label>Shape</label>
|
||||
<label class="radio">
|
||||
<input type="radio" name="shape" id="shape-circle" value="circle" checked>
|
||||
Circle
|
||||
</label>
|
||||
<label class="radio">
|
||||
<input type="radio" name="shape" id="shape-shield" value="shield">
|
||||
Shield
|
||||
</label>
|
||||
<fieldset>
|
||||
<div class="row">
|
||||
<div class="span2">
|
||||
<label>Background color</label>
|
||||
<input type="minicolors" name="background-color" />
|
||||
</div>
|
||||
<div class="span2">
|
||||
<label>Stroke color</label>
|
||||
<input type="minicolors" name="stroke-color" />
|
||||
</div>
|
||||
</div>
|
||||
<label>Stroke width</label>
|
||||
<input type="text" name="stroke-width" class="input-mini">
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>Icon</legend>
|
||||
<label>File URL</label>
|
||||
<input type="text" name="file-url" style="width:100%;">
|
||||
<span class="help-block">e.g. <code>icons/red_dark/xhdpi/ic_action_achievement.png</code></span>
|
||||
<div class="row">
|
||||
<div class="span2">
|
||||
<label>x-position</label>
|
||||
<input type="text" name="iconx" class="input-small">
|
||||
</div>
|
||||
<div class="span2">
|
||||
<label>y-position</label>
|
||||
<input type="text" name="icony" class="input-small">
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
<div class="span4">
|
||||
<legend>Preview</legend>
|
||||
<canvas id="badge" width="100" height="100"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div>
|
||||
<a class="btn btn-submit btn-primary" href="#"><i class="icon-arrow-down icon-white"></i> Download</a>
|
||||
<p>
|
||||
<small>Right-click → Save Link as</small>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
${js}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\SAI;
|
||||
|
||||
class saimod_dasense_badge_creator extends \SYSTEM\SAI\SaiModule {
|
||||
|
||||
|
||||
public static function html_js(){ return '<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'sai/page/default_page/js/libs/jquery.miniColors.js').'"></script>'.
|
||||
'<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'sai/modules/badge_creator/badgecreator.js').'"></script>';}
|
||||
public static function html_css(){return '';}
|
||||
public static function html_content(){
|
||||
return \SYSTEM\PAGE\replace::replaceFile( \SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'sai/modules/badge_creator/badgecreator.tpl'),
|
||||
array( 'js' => self::html_js()));}
|
||||
public static function html_li_menu(){return '<li><a href="#" id=".SYSTEM.SAI.saimod_dasense_badge_creator">Badge Creator</a></li>';}
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_sys_sys');
|
||||
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_sys_api');
|
||||
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_sys_page');
|
||||
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_sys_error');
|
||||
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_sys_security');
|
||||
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_sys_docu');
|
||||
|
||||
//TODO extern, namespace
|
||||
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_dasense_api_reference');
|
||||
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_dasense_badge_creator');
|
||||
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_dasense_bonusarea_creator');
|
||||
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_dasense_monitoring');
|
||||
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_dasense_push_message');
|
||||
\SYSTEM\SAI\sai::getInstance()->register('\SYSTEM\SAI\saimod_dasense_text_handler');
|
||||
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\SAI;
|
||||
|
||||
class saimod_dasense_api_reference extends \SYSTEM\SAI\SaiModule {
|
||||
public static function html_js(){ return '';}
|
||||
public static function html_css(){return '';}
|
||||
public static function html_content(){return 'API Reference';}
|
||||
public static function html_li_menu(){return '<li><a href="#" id="apireference">API Reference</a></li>';}
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\SAI;
|
||||
|
||||
class saimod_dasense_bonusarea_creator extends \SYSTEM\SAI\SaiModule {
|
||||
public static function html_js(){ return '';}
|
||||
public static function html_css(){return '';}
|
||||
public static function html_content(){return 'SYS';}
|
||||
public static function html_li_menu(){return '<li><a href="#" id="bonusareacreator">BonusArea Creator</a></li>';}
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\SAI;
|
||||
|
||||
class saimod_dasense_monitoring extends \SYSTEM\SAI\SaiModule {
|
||||
public static function html_js(){ return '';}
|
||||
public static function html_css(){return '';}
|
||||
public static function html_content(){return 'SYS';}
|
||||
public static function html_li_menu(){return '<li><a href="#" id="monitoring">Monitoring</a></li>';}
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\SAI;
|
||||
|
||||
class saimod_dasense_push_message extends \SYSTEM\SAI\SaiModule {
|
||||
public static function html_js(){ return '';}
|
||||
public static function html_css(){return '';}
|
||||
public static function html_content(){return 'SYS';}
|
||||
public static function html_li_menu(){return '<li><a href="#" id="pushmessage">Push Message</a></li>';}
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\SAI;
|
||||
|
||||
class saimod_dasense_text_handler extends \SYSTEM\SAI\SaiModule {
|
||||
public static function html_js(){ return '';}
|
||||
public static function html_css(){return '';}
|
||||
public static function html_content(){return 'SYS';}
|
||||
public static function html_li_menu(){return '<li><a href="#" id="texthandler">Text Handler</a></li>';}
|
||||
}
|
||||
@ -1,95 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\SAI;
|
||||
|
||||
class saimod_sys_api extends \SYSTEM\SAI\SaiModule {
|
||||
public static function html_js(){ return '';}
|
||||
public static function html_css(){return '';}
|
||||
public static function html_content(){
|
||||
$con = new \SYSTEM\DB\Connection(new \DBD\system());
|
||||
$res = $con->query('SELECT * FROM '.\DBD\APITable::NAME);
|
||||
|
||||
$tree = array();
|
||||
while($row = $res->next()){
|
||||
$tree[] = $row;}
|
||||
|
||||
$tree = self::buildTree($tree, -1);
|
||||
|
||||
$html = self::htmltree($tree,'http://www.da-sense.de/test/api.php?');
|
||||
return $html;
|
||||
}
|
||||
|
||||
private static function htmlTree($tree,$url, $url_rec = null){
|
||||
/*echo "<pre>";
|
||||
print_r($tree);
|
||||
echo "</pre>";
|
||||
die();*/
|
||||
$result = '';
|
||||
if( \is_array($tree) &&
|
||||
\count($tree) > 0 &&
|
||||
\is_array($tree['com'])){
|
||||
|
||||
foreach($tree['com'] as $root){
|
||||
//print_r($root);
|
||||
$url_rec_new = ($root['node'][\DBD\APITable::FIELD_PARENTVALUE] ? $root['node'][\DBD\APITable::FIELD_PARENTVALUE].'&' : '').
|
||||
$root['node'][\DBD\APITable::FIELD_NAME].'=';
|
||||
|
||||
//print_r($url_rec_new);
|
||||
//echo '</br>';
|
||||
|
||||
$result .= '<ul><li>'.
|
||||
$root['node'][\DBD\APITable::FIELD_NAME].' '.
|
||||
'</br>'.
|
||||
'<a href="'.$url.$url_rec.$url_rec_new.($root['node'][\DBD\APITable::FIELD_ALLOWEDVALUES] == 'FLAG' ? '1' : '${COM}').'">'.
|
||||
$url.$url_rec.$url_rec_new.($root['node'][\DBD\APITable::FIELD_ALLOWEDVALUES] == 'FLAG' ? '1' : '${COM}').'</a>';
|
||||
|
||||
if(\is_array($root['par'])){
|
||||
|
||||
foreach($root['par'] as $parentval => $param){
|
||||
$url_rec_new_par = ($parentval ? $parentval : ($root['node'][\DBD\APITable::FIELD_ALLOWEDVALUES] == 'FLAG' ? '1' : '${COM}'));
|
||||
foreach($param as $par){
|
||||
$url_rec_new_par .= '&'.$par[\DBD\APITable::FIELD_NAME].'=${'.$par[\DBD\APITable::FIELD_ALLOWEDVALUES].'}';
|
||||
}
|
||||
$result .= '</br>'.
|
||||
'<a href="'.$url.$url_rec.$url_rec_new.$url_rec_new_par.'">'.$url.$url_rec.$url_rec_new.$url_rec_new_par.'</a>';
|
||||
}
|
||||
}
|
||||
/*echo "<pre>";
|
||||
print_r($root['tree']);
|
||||
echo "</pre>";*/
|
||||
$result .= self::htmlTree($root['tree'],$url, $url_rec.$url_rec_new).
|
||||
'</li></ul>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
private static function buildTree($dbtree, $parentid){
|
||||
$result = array();
|
||||
foreach($dbtree as $node){
|
||||
if( $node[\DBD\APITable::FIELD_PARENTID] == $parentid &&
|
||||
(!$node[\DBD\APITable::FIELD_FLAG] || $node[\DBD\APITable::FIELD_ALLOWEDVALUES] == 'FLAG')){
|
||||
/*if($node[\DBD\APITable::FIELD_FLAG] && $node[\DBD\APITable::FIELD_ALLOWEDVALUES] != 'FLAG'){
|
||||
$result['par'][$node[\DBD\APITable::FIELD_PARENTVALUE]][] = $node;
|
||||
} else {
|
||||
$result['com'][] = array('tree' => self::buildTree($dbtree,$node[\DBD\APITable::FIELD_ID]),'node' => $node);}*/
|
||||
$pars = array();
|
||||
foreach($dbtree as $node2){
|
||||
if( $node2[\DBD\APITable::FIELD_PARENTID] == $node[\DBD\APITable::FIELD_ID] &&
|
||||
$node2[\DBD\APITable::FIELD_FLAG] && $node2[\DBD\APITable::FIELD_ALLOWEDVALUES] != 'FLAG'){
|
||||
$pars[$node2[\DBD\APITable::FIELD_PARENTVALUE]][] = $node2;
|
||||
}
|
||||
}
|
||||
$result['com'][] = array('tree' => self::buildTree($dbtree,$node[\DBD\APITable::FIELD_ID]),
|
||||
'node' => $node,
|
||||
'par' => $pars);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function html_li_menu(){return '<li><a href="#" id=".SYSTEM.SAI.saimod_sys_api">SYS API</a></li>';}
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\SAI;
|
||||
|
||||
class saimod_sys_docu extends \SYSTEM\SAI\SaiModule {
|
||||
public static function html_js(){ return '';}
|
||||
public static function html_css(){return '';}
|
||||
public static function html_content(){return 'SYS';}
|
||||
public static function html_li_menu(){return '<li><a href="#" id="documentation">Documentation</a></li>';}
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\SAI;
|
||||
|
||||
class saimod_sys_error extends \SYSTEM\SAI\SaiModule {
|
||||
public static function html_js(){ return '';}
|
||||
public static function html_css(){return '';}
|
||||
public static function html_content(){return 'SYS Error';}
|
||||
public static function html_li_menu(){return '<li><a href="#" id="SYS Error">SYS Error</a></li>';}
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\SAI;
|
||||
|
||||
class saimod_sys_page extends \SYSTEM\SAI\SaiModule {
|
||||
public static function html_js(){ return '';}
|
||||
public static function html_css(){return '';}
|
||||
public static function html_content(){return 'SYS Page';}
|
||||
public static function html_li_menu(){return '<li><a href="#" id="SYS PAGE">SYS PAGE</a></li>';}
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\SAI;
|
||||
|
||||
class saimod_sys_security extends \SYSTEM\SAI\SaiModule {
|
||||
public static function html_js(){ return '';}
|
||||
public static function html_css(){return '';}
|
||||
public static function html_content(){return 'SYS Security';}
|
||||
public static function html_li_menu(){return '<li><a href="#" id="SYS Security">SYS Security</a></li>';}
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\SAI;
|
||||
|
||||
class saimod_sys_sys extends \SYSTEM\SAI\SaiModule {
|
||||
public static function html_js(){ return '';}
|
||||
public static function html_css(){return '';}
|
||||
public static function html_content(){return 'SYS';}
|
||||
public static function html_li_menu(){return '<li><a href="#" id="SYS">SYS</a></li>';}
|
||||
}
|
||||
@ -1,49 +0,0 @@
|
||||
<div class="masthead">
|
||||
<h3 class="muted">Design.Simple.Fast.Reliable.Innovative.</h3>
|
||||
<h4 class="text-info">We write awesome code.</h4>
|
||||
</div>
|
||||
<br>
|
||||
<div id="myCarousel" class="carousel slide">
|
||||
<!-- Carousel items -->
|
||||
<div class="carousel-inner">
|
||||
<div class="active item">
|
||||
<img class="carousel-img" src="./sai/page/default_page/img/carousel/webseite.jpg" alt="">
|
||||
<div class="carousel-caption">
|
||||
<h4>TK Forschungspraktikum WS 2012/2013</h4>
|
||||
<p>Das Team</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<img class="carousel-img" src="./sai/page/default_page/img/carousel/verteidigung_immanuel.jpg" alt="">
|
||||
<div class="carousel-caption">
|
||||
<h4>Betreuer: "Hööööy sieee.." ;-D</h4>
|
||||
<p>Verteidigung Immanuel (Dezember 2012)</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<img class="carousel-img" src="./sai/page/default_page/img/carousel/webseite.jpg" alt="">
|
||||
<div class="carousel-caption">
|
||||
<h4>Noisemap 3.0 Release</h4>
|
||||
<p>Die neue Noisemap Version 3.0 ist jetzt für Android und iOS verfügbar.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<img class="carousel-img" src="./sai/page/default_page/img/carousel/webseite.jpg" alt="">
|
||||
<div class="carousel-caption">
|
||||
<h4>da_sense</h4>
|
||||
<p>Neues Webseiten Design. Nice.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<img class="carousel-img" src="./sai/page/default_page/img/carousel/webseite.jpg" alt="">
|
||||
<div class="carousel-caption">
|
||||
<h4>Presse: Echo Artikel</h4>
|
||||
<p>Sogar die Presse hat Interesse ;-P</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Carousel nav -->
|
||||
<a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a>
|
||||
<a class="carousel-control right" href="#myCarousel" data-slide="next">›</a>
|
||||
</div>
|
||||
@ -1,15 +0,0 @@
|
||||
/*
|
||||
Document : index.css
|
||||
Created on : 31.01.2013, 01:59:37
|
||||
Author : CHRIS MEURISCH
|
||||
Description:
|
||||
Purpose of the stylesheet follows.
|
||||
*/
|
||||
|
||||
.footer{
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#div-content{
|
||||
|
||||
}
|
||||
|
Before Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 12 KiB |
@ -1,37 +0,0 @@
|
||||
/*
|
||||
Document : index.css
|
||||
Created on : 31.01.2013, 01:59:37
|
||||
Author : CHRIS MEURISCH
|
||||
Description:
|
||||
Purpose of the stylesheet follows.
|
||||
*/
|
||||
|
||||
#content{
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
#content-wrapper{
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.brand-logo{
|
||||
float: left;
|
||||
padding-top: 8px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.footer{
|
||||
text-align: right;
|
||||
padding-right: 20px;
|
||||
color: #777;
|
||||
}
|
||||
|
||||
.footer a{
|
||||
color: #777;
|
||||
}
|
||||
|
||||
.carousel-img{
|
||||
width: 1200px;
|
||||
height: 650px;
|
||||
}
|
||||
@ -1,203 +0,0 @@
|
||||
/* line 9, ../sass/bootstrap-switch.scss */
|
||||
.switch {
|
||||
display: inline-block;
|
||||
cursor: pointer;
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-ms-border-radius: 5px;
|
||||
-o-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
border: 1px solid;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
background: #e6e6e6;
|
||||
position: relative;
|
||||
text-align: left;
|
||||
overflow: hidden;
|
||||
line-height: 8px;
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
min-width: 100px;
|
||||
}
|
||||
/* line 31, ../sass/bootstrap-switch.scss */
|
||||
.switch.switch-mini {
|
||||
min-width: 70px;
|
||||
}
|
||||
/* line 35, ../sass/bootstrap-switch.scss */
|
||||
.switch.switch-small {
|
||||
min-width: 80px;
|
||||
}
|
||||
/* line 39, ../sass/bootstrap-switch.scss */
|
||||
.switch.switch-large {
|
||||
min-width: 120px;
|
||||
}
|
||||
/* line 43, ../sass/bootstrap-switch.scss */
|
||||
.switch.deactivate {
|
||||
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50);
|
||||
opacity: 0.5;
|
||||
cursor: default !important;
|
||||
}
|
||||
/* line 46, ../sass/bootstrap-switch.scss */
|
||||
.switch.deactivate label, .switch.deactivate span {
|
||||
cursor: default !important;
|
||||
}
|
||||
/* line 50, ../sass/bootstrap-switch.scss */
|
||||
.switch > div {
|
||||
display: inline-block;
|
||||
width: 150%;
|
||||
position: relative;
|
||||
top: 0;
|
||||
}
|
||||
/* line 56, ../sass/bootstrap-switch.scss */
|
||||
.switch > div.switch-animate {
|
||||
-webkit-transition: left 0.5s;
|
||||
-moz-transition: left 0.5s;
|
||||
-o-transition: left 0.5s;
|
||||
transition: left 0.5s;
|
||||
}
|
||||
/* line 59, ../sass/bootstrap-switch.scss */
|
||||
.switch > div.switch-off {
|
||||
left: -49.5%;
|
||||
}
|
||||
/* line 62, ../sass/bootstrap-switch.scss */
|
||||
.switch > div.switch-on {
|
||||
left: 0%;
|
||||
}
|
||||
/* line 66, ../sass/bootstrap-switch.scss */
|
||||
.switch input[type=checkbox] {
|
||||
display: none;
|
||||
}
|
||||
/* line 74, ../sass/bootstrap-switch.scss */
|
||||
.switch span, .switch label {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
height: 100%;
|
||||
padding-bottom: 4px;
|
||||
padding-top: 4px;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
}
|
||||
/* line 87, ../sass/bootstrap-switch.scss */
|
||||
.switch span.switch-mini, .switch label.switch-mini {
|
||||
padding-bottom: 4px;
|
||||
padding-top: 4px;
|
||||
font-size: 10px;
|
||||
line-height: 9px;
|
||||
}
|
||||
/* line 94, ../sass/bootstrap-switch.scss */
|
||||
.switch span.switch-small, .switch label.switch-small {
|
||||
padding-bottom: 3px;
|
||||
padding-top: 3px;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
/* line 101, ../sass/bootstrap-switch.scss */
|
||||
.switch span.switch-large, .switch label.switch-large {
|
||||
padding-bottom: 9px;
|
||||
padding-top: 9px;
|
||||
font-size: 16px;
|
||||
line-height: normal;
|
||||
}
|
||||
/* line 109, ../sass/bootstrap-switch.scss */
|
||||
.switch label {
|
||||
background: white;
|
||||
margin-top: -1px;
|
||||
margin-bottom: -1px;
|
||||
z-index: 100;
|
||||
width: 34%;
|
||||
border-left: 1px solid #e6e6e6;
|
||||
border-right: 1px solid #e6e6e6;
|
||||
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ffffff), color-stop(100%, #e6e6e6));
|
||||
background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);
|
||||
background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
|
||||
background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
|
||||
background-image: linear-gradient(top, #ffffff, #e6e6e6);
|
||||
}
|
||||
/* line 121, ../sass/bootstrap-switch.scss */
|
||||
.switch span {
|
||||
color: white;
|
||||
text-align: center;
|
||||
z-index: 1;
|
||||
width: 33%;
|
||||
}
|
||||
/* line 127, ../sass/bootstrap-switch.scss */
|
||||
.switch span.switch-left {
|
||||
-moz-border-radius-topleft: 4px;
|
||||
-webkit-border-top-left-radius: 4px;
|
||||
border-top-left-radius: 4px;
|
||||
-moz-border-radius-bottomleft: 4px;
|
||||
-webkit-border-bottom-left-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
}
|
||||
/* line 131, ../sass/bootstrap-switch.scss */
|
||||
.switch span.switch-right {
|
||||
color: black;
|
||||
-moz-border-radius-topright: 4px;
|
||||
-webkit-border-top-right-radius: 4px;
|
||||
border-top-right-radius: 4px;
|
||||
-moz-border-radius-bottomright: 4px;
|
||||
-webkit-border-bottom-right-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #ffffff), color-stop(100%, #e6e6e6));
|
||||
background-image: -webkit-linear-gradient(bottom, #ffffff, #e6e6e6);
|
||||
background-image: -moz-linear-gradient(bottom, #ffffff, #e6e6e6);
|
||||
background-image: -o-linear-gradient(bottom, #ffffff, #e6e6e6);
|
||||
background-image: linear-gradient(bottom, #ffffff, #e6e6e6);
|
||||
}
|
||||
/* line 138, ../sass/bootstrap-switch.scss */
|
||||
.switch span.switch-primary, .switch span.switch-left {
|
||||
color: white;
|
||||
background: #0088cc;
|
||||
background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #0088cc), color-stop(100%, #0055cc));
|
||||
background-image: -webkit-linear-gradient(bottom, #0088cc, #0055cc);
|
||||
background-image: -moz-linear-gradient(bottom, #0088cc, #0055cc);
|
||||
background-image: -o-linear-gradient(bottom, #0088cc, #0055cc);
|
||||
background-image: linear-gradient(bottom, #0088cc, #0055cc);
|
||||
}
|
||||
/* line 143, ../sass/bootstrap-switch.scss */
|
||||
.switch span.switch-info {
|
||||
color: white;
|
||||
background: #5bc0de;
|
||||
background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #5bc0de), color-stop(100%, #2f96b4));
|
||||
background-image: -webkit-linear-gradient(bottom, #5bc0de, #2f96b4);
|
||||
background-image: -moz-linear-gradient(bottom, #5bc0de, #2f96b4);
|
||||
background-image: -o-linear-gradient(bottom, #5bc0de, #2f96b4);
|
||||
background-image: linear-gradient(bottom, #5bc0de, #2f96b4);
|
||||
}
|
||||
/* line 149, ../sass/bootstrap-switch.scss */
|
||||
.switch span.switch-success {
|
||||
color: white;
|
||||
background: #62c462;
|
||||
background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #62c462), color-stop(100%, #51a351));
|
||||
background-image: -webkit-linear-gradient(bottom, #62c462, #51a351);
|
||||
background-image: -moz-linear-gradient(bottom, #62c462, #51a351);
|
||||
background-image: -o-linear-gradient(bottom, #62c462, #51a351);
|
||||
background-image: linear-gradient(bottom, #62c462, #51a351);
|
||||
}
|
||||
/* line 155, ../sass/bootstrap-switch.scss */
|
||||
.switch span.switch-warning {
|
||||
color: white;
|
||||
background: #dbb450;
|
||||
background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #dbb450), color-stop(100%, #f89406));
|
||||
background-image: -webkit-linear-gradient(bottom, #dbb450, #f89406);
|
||||
background-image: -moz-linear-gradient(bottom, #dbb450, #f89406);
|
||||
background-image: -o-linear-gradient(bottom, #dbb450, #f89406);
|
||||
background-image: linear-gradient(bottom, #dbb450, #f89406);
|
||||
}
|
||||
/* line 161, ../sass/bootstrap-switch.scss */
|
||||
.switch span.switch-danger {
|
||||
color: white;
|
||||
background: #ee5f5b;
|
||||
background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #ee5f5b), color-stop(100%, #bd362f));
|
||||
background-image: -webkit-linear-gradient(bottom, #ee5f5b, #bd362f);
|
||||
background-image: -moz-linear-gradient(bottom, #ee5f5b, #bd362f);
|
||||
background-image: -o-linear-gradient(bottom, #ee5f5b, #bd362f);
|
||||
background-image: linear-gradient(bottom, #ee5f5b, #bd362f);
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
/*!
|
||||
* Timepicker Component for Twitter Bootstrap
|
||||
*
|
||||
* Copyright 2013 Joris de Wit
|
||||
*
|
||||
* Contributors https://github.com/jdewit/bootstrap-timepicker/graphs/contributors
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/.bootstrap-timepicker{position:relative}.bootstrap-timepicker.pull-right .bootstrap-timepicker-widget.dropdown-menu{left:auto;right:0}.bootstrap-timepicker.pull-right .bootstrap-timepicker-widget.dropdown-menu:before{left:auto;right:12px}.bootstrap-timepicker.pull-right .bootstrap-timepicker-widget.dropdown-menu:after{left:auto;right:13px}.bootstrap-timepicker .add-on{cursor:pointer}.bootstrap-timepicker .add-on i{display:inline-block;width:16px;height:16px}.bootstrap-timepicker .bootstrap-timepicker-widget.dropdown-menu{padding:2px 3px 2px 2px}.bootstrap-timepicker .bootstrap-timepicker-widget.dropdown-menu.open{display:inline-block}.bootstrap-timepicker .bootstrap-timepicker-widget.dropdown-menu:before{border-bottom:7px solid rgba(0,0,0,0.2);border-left:7px solid transparent;border-right:7px solid transparent;content:"";display:inline-block;left:9px;position:absolute;top:-7px}.bootstrap-timepicker .bootstrap-timepicker-widget.dropdown-menu:after{border-bottom:6px solid #fff;border-left:6px solid transparent;border-right:6px solid transparent;content:"";display:inline-block;left:10px;position:absolute;top:-6px}.bootstrap-timepicker .bootstrap-timepicker-widget.modal{top:30%;margin-top:0;width:200px;margin-left:-100px}.bootstrap-timepicker .bootstrap-timepicker-widget.modal .modal-content{padding:4px}.bootstrap-timepicker .bootstrap-timepicker-widget a.btn,.bootstrap-timepicker .bootstrap-timepicker-widget input{border-radius:4px}.bootstrap-timepicker .bootstrap-timepicker-widget table{width:100%;margin:0}.bootstrap-timepicker .bootstrap-timepicker-widget table td{text-align:center;height:30px;margin:0;padding:2px}.bootstrap-timepicker .bootstrap-timepicker-widget table td:not(.separator){min-width:30px}.bootstrap-timepicker .bootstrap-timepicker-widget table td span{width:100%}.bootstrap-timepicker .bootstrap-timepicker-widget table td a{border:1px transparent solid;width:100%;display:inline-block;margin:0;padding:8px 0;outline:0;color:#333}.bootstrap-timepicker .bootstrap-timepicker-widget table td a:hover{text-decoration:none;background-color:#eee;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;border-color:#ddd}.bootstrap-timepicker .bootstrap-timepicker-widget table td a i{margin-top:2px}.bootstrap-timepicker .bootstrap-timepicker-widget table td input{width:25px;margin:0;text-align:center}
|
||||
6039
system/sai/sai/page/default_page/css/libs/bootstrap.css
vendored
@ -1,7 +0,0 @@
|
||||
/*
|
||||
Datepicker for Bootstrap
|
||||
Copyright 2012 Stefan Petre
|
||||
Licensed under the Apache License v2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
.datepicker { top: 0; left: 0; padding: 4px; margin-top: 1px; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; /*.dow { border-top: 1px solid #ddd !important; }*/ } .datepicker:before { content: ''; display: inline-block; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 7px solid #ccc; border-bottom-color: rgba(0, 0, 0, 0.2); position: absolute; top: -7px; left: 6px; } .datepicker:after { content: ''; display: inline-block; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 6px solid #ffffff; position: absolute; top: -6px; left: 7px; } .datepicker > div { display: none; } .datepicker table { width: 100%; margin: 0; } .datepicker td, .datepicker th { text-align: center; width: 20px; height: 20px; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .datepicker td.day:hover { background: #eeeeee; cursor: pointer; } .datepicker td.old, .datepicker td.new { color: #999999; } .datepicker td.active, .datepicker td.active:hover { background-color: #006dcc; background-image: -moz-linear-gradient(top, #0088cc, #0044cc); background-image: -ms-linear-gradient(top, #0088cc, #0044cc); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); background-image: -o-linear-gradient(top, #0088cc, #0044cc); background-image: linear-gradient(top, #0088cc, #0044cc); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); border-color: #0044cc #0044cc #002a80; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); color: #fff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); } .datepicker td.active:hover, .datepicker td.active:hover:hover, .datepicker td.active:active, .datepicker td.active:hover:active, .datepicker td.active.active, .datepicker td.active:hover.active, .datepicker td.active.disabled, .datepicker td.active:hover.disabled, .datepicker td.active[disabled], .datepicker td.active:hover[disabled] { background-color: #0044cc; } .datepicker td.active:active, .datepicker td.active:hover:active, .datepicker td.active.active, .datepicker td.active:hover.active { background-color: #003399 \9; } .datepicker td span { display: block; width: 47px; height: 54px; line-height: 54px; float: left; margin: 2px; cursor: pointer; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .datepicker td span:hover { background: #eeeeee; } .datepicker td span.active { background-color: #006dcc; background-image: -moz-linear-gradient(top, #0088cc, #0044cc); background-image: -ms-linear-gradient(top, #0088cc, #0044cc); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); background-image: -o-linear-gradient(top, #0088cc, #0044cc); background-image: linear-gradient(top, #0088cc, #0044cc); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); border-color: #0044cc #0044cc #002a80; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); color: #fff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); } .datepicker td span.active:hover, .datepicker td span.active:active, .datepicker td span.active.active, .datepicker td span.active.disabled, .datepicker td span.active[disabled] { background-color: #0044cc; } .datepicker td span.active:active, .datepicker td span.active.active { background-color: #003399 \9; } .datepicker td span.old { color: #999999; } .datepicker th.switch { width: 145px; } .datepicker th.next, .datepicker th.prev { font-size: 19.5px; } .datepicker thead tr:first-child th { cursor: pointer; } .datepicker thead tr:first-child th:hover { background: #eeeeee; } .input-append.date .add-on i, .input-prepend.date .add-on i { display: block; cursor: pointer; width: 16px; height: 16px; }
|
||||
@ -1,206 +0,0 @@
|
||||
.minicolors {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.minicolors-focus {
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.minicolors INPUT {
|
||||
margin-right: 3px;
|
||||
border: solid 1px #CCC;
|
||||
font: 14px sans-serif;
|
||||
width: 65px;
|
||||
height: 16px;
|
||||
vertical-align: middle;
|
||||
border-radius: 0;
|
||||
box-shadow: inset 0 2px 4px rgba(0, 0, 0, .04);
|
||||
outline: none;
|
||||
padding: 2px;
|
||||
margin-right: -1px;
|
||||
}
|
||||
|
||||
.minicolors-swatch-left INPUT {
|
||||
margin-left: -1px;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.minicolors-focus INPUT,
|
||||
.minicolors-focus .minicolors-swatch {
|
||||
border-color: #999;
|
||||
}
|
||||
|
||||
.minicolors-hidden {
|
||||
position: absolute;
|
||||
left: -9999em;
|
||||
}
|
||||
|
||||
.minicolors-swatch {
|
||||
position: relative;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
background: url(jquery.minicolors.png) -80px 0;
|
||||
border: solid 1px #CCC;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.minicolors-swatch SPAN {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: none;
|
||||
box-shadow: inset 0 9px 0 rgba(255, 255, 255, .1);
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* Panel */
|
||||
.minicolors-panel {
|
||||
position: absolute;
|
||||
top: 26px;
|
||||
left: 0;
|
||||
width: 173px;
|
||||
height: 152px;
|
||||
background: white;
|
||||
border: solid 1px #CCC;
|
||||
box-shadow: 0 0 20px rgba(0, 0, 0, .2);
|
||||
display: none;
|
||||
}
|
||||
|
||||
.minicolors-position-top .minicolors-panel {
|
||||
top: -156px;
|
||||
}
|
||||
|
||||
.minicolors-position-left .minicolors-panel {
|
||||
left: -83px;
|
||||
}
|
||||
|
||||
.minicolors-position-left.minicolors-with-opacity .minicolors-panel {
|
||||
left: -104px;
|
||||
}
|
||||
|
||||
.minicolors-with-opacity .minicolors-panel {
|
||||
width: 194px;
|
||||
}
|
||||
|
||||
.minicolors .minicolors-grid {
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
left: 1px;
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
background: url(jquery.minicolors.png) -120px 0;
|
||||
cursor: crosshair;
|
||||
}
|
||||
|
||||
.minicolors .minicolors-grid-inner {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
background: none;
|
||||
}
|
||||
|
||||
.minicolors-slider-saturation .minicolors-grid {
|
||||
background-position: -420px 0;
|
||||
}
|
||||
|
||||
.minicolors-slider-saturation .minicolors-grid-inner {
|
||||
background: url(jquery.minicolors.png) -270px 0;
|
||||
}
|
||||
|
||||
.minicolors-slider-brightness .minicolors-grid {
|
||||
background-position: -570px 0;
|
||||
}
|
||||
|
||||
.minicolors-slider-brightness .minicolors-grid-inner {
|
||||
background: black;
|
||||
}
|
||||
|
||||
.minicolors-slider-wheel .minicolors-grid {
|
||||
background-position: -720px 0;
|
||||
}
|
||||
|
||||
.minicolors-slider,
|
||||
.minicolors-opacity-slider {
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
left: 152px;
|
||||
width: 20px;
|
||||
height: 150px;
|
||||
background: white url(jquery.minicolors.png) 0 0;
|
||||
cursor: crosshair;
|
||||
}
|
||||
|
||||
.minicolors-slider-saturation .minicolors-slider {
|
||||
background-position: -60px 0;
|
||||
}
|
||||
|
||||
.minicolors-slider-brightness .minicolors-slider {
|
||||
background-position: -20px 0;
|
||||
}
|
||||
|
||||
.minicolors-slider-wheel .minicolors-slider {
|
||||
background-position: -20px 0;
|
||||
}
|
||||
|
||||
.minicolors-opacity-slider {
|
||||
left: 173px;
|
||||
background-position: -40px 0;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.minicolors-with-opacity .minicolors-opacity-slider {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Pickers */
|
||||
.minicolors-grid .minicolors-picker {
|
||||
position: absolute;
|
||||
top: 70px;
|
||||
left: 70px;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border: solid 1px black;
|
||||
border-radius: 10px;
|
||||
margin-top: -6px;
|
||||
margin-left: -6px;
|
||||
background: none;
|
||||
}
|
||||
|
||||
.minicolors-grid .minicolors-picker SPAN {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 6px;
|
||||
border: solid 2px white;
|
||||
}
|
||||
|
||||
.minicolors-picker {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 18px;
|
||||
height: 2px;
|
||||
background: white;
|
||||
border: solid 1px black;
|
||||
margin-top: -2px;
|
||||
}
|
||||
|
||||
/* Inline controls */
|
||||
.minicolors-inline INPUT,
|
||||
.minicolors-inline .minicolors-swatch {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.minicolors-inline .minicolors-panel {
|
||||
position: relative;
|
||||
top: auto;
|
||||
left: auto;
|
||||
display: inline-block;
|
||||
}
|
||||
|
Before Width: | Height: | Size: 76 KiB |
@ -1,76 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SYSTEM\SAI;
|
||||
|
||||
class default_page extends \SYSTEM\PAGE\Page {
|
||||
|
||||
private $module = NULL;
|
||||
private $pg = NULL;
|
||||
|
||||
public function __construct($module = NULL, $pg = NULL){
|
||||
$this->module = \str_replace('.', '\\', $module);
|
||||
$this->pg = $pg;}
|
||||
|
||||
private function menu(){
|
||||
$mods = \SYSTEM\SAI\sai::getInstance()->getModules();
|
||||
|
||||
$result = '<li><a href="#" id="SAI">SAI</a></li>';
|
||||
foreach($mods as $mod){
|
||||
$result .= \call_user_func(array($mod, 'html_li_menu'));}
|
||||
return $result.'</ul>';
|
||||
}
|
||||
|
||||
private function content(){
|
||||
$mods = \SYSTEM\SAI\sai::getInstance()->getModules();
|
||||
if( $this->module &&
|
||||
\array_search($this->module, $mods) !== false){
|
||||
return \call_user_func(array($this->module, 'html_content'),array($this->pg));}
|
||||
|
||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'sai/page/default_page/carousel.tpl'), array());
|
||||
}
|
||||
|
||||
private function css(){
|
||||
$result = '<link rel="stylesheet" href="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'sai/page/default_page/css/libs/bootstrap.min.css').'" type="text/css" />'.
|
||||
'<link rel="stylesheet" href="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'sai/page/default_page/css/index.css').'" type="text/css" />';;
|
||||
|
||||
$mods = \SYSTEM\SAI\sai::getInstance()->getModules();
|
||||
if( $this->module &&
|
||||
\array_search($this->module, $mods) !== false){
|
||||
$result .= \call_user_func(array($this->module, 'html_css'));}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function js(){
|
||||
$result = '<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'sai/page/default_page/js/libs/jquery.min.js').'" type="text/javascript"></script>'.
|
||||
'<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'sai/page/default_page/js/libs/bootstrap.min.js').'" type="text/javascript"></script>'.
|
||||
'<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'sai/page/default_page/js/index.js').'" type="text/javascript"></script>';
|
||||
|
||||
$mods = \SYSTEM\SAI\sai::getInstance()->getModules();
|
||||
if( $this->module &&
|
||||
\array_search($this->module, $mods) !== false){
|
||||
$result .= \call_user_func(array($this->module, 'html_js'));}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function html(){
|
||||
|
||||
$vars = array();
|
||||
$vars['css'] = $this->css();
|
||||
$vars['js'] = $this->js();
|
||||
|
||||
$vars['menu'] = $this->menu();
|
||||
|
||||
//TODO
|
||||
new \SYSTEM\LOG\DEPRECATED();
|
||||
if($this->module != NULL){
|
||||
return $this->content();}
|
||||
|
||||
//$vars['PATH_IMG'] = SYSTEM\WEBPATH(new PPAGE(),'default_developer/img/');
|
||||
//$vars['PATH_LIB'] = SYSTEM\WEBPATH(new PLIB());
|
||||
//$vars['PATH_JS'] = SYSTEM\WEBPATH(new PJS());
|
||||
//$vars = array_merge($vars, SYSTEM\locale::getStrings(\DBD\SYSTEM\locale_string::VALUE_CATEGORY_DASENSE));
|
||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'sai/page/default_page/sai.tpl'), $vars);
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 669 KiB |
|
Before Width: | Height: | Size: 420 KiB |
|
Before Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 204 B |
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 43 KiB |
|
Before Width: | Height: | Size: 783 B |
|
Before Width: | Height: | Size: 363 B |
|
Before Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 13 KiB |