Started work on Address

This commit is contained in:
Frank Schubert
2021-06-15 22:16:57 +02:00
parent 27a4ce998c
commit badcdcb329
26 changed files with 637 additions and 2180 deletions
+3
View File
@@ -6,6 +6,7 @@ include_once(realpath(dirname(__FILE__))."/mfBaseModel.php");
class mfBaseController {
protected $log;
protected $needlogin = false;
protected $request;
private $mfAction;
private $mfDBI;
private $mfLayout;
@@ -69,6 +70,8 @@ class mfBaseController {
include MFBASECONTROLLER_INIT_INCLUDE_FILE;
}
$this->request = new mfRequest($params);
// now run action
if($params['action']) {
$this->__call($params['action'],$params);
+6
View File
@@ -100,6 +100,12 @@ class mfBaseModel {
return false;
}
public function update(Array $data) {
foreach($data as $key => $value) {
$this->$key = $value;
}
}
public function save() {
if(method_exists($this, "beforeSave")) {
$this->beforeSave();
+9
View File
@@ -211,3 +211,12 @@ class mfLayout {
return $this->inline->cycle[$this->inline->cyclecount++];
}
}
function __($string) {
$lang = [];
include(BASEDIR."/lang/de.php");
if(array_key_exists($string, $lang['de'])) {
return $lang['de'][$string];
}
return $string;
}
+47
View File
@@ -0,0 +1,47 @@
<?php
class mfRequest {
protected static $instance;
protected $request = [];
public function __construct(Array $request = []) {
if(count($request)) {
$this->request = $request;
} else {
// get request from POST/GET
if(isset($_POST) && isset($_GET)) {
$this->request = array_merge($_GET, $_POST);
}
}
}
public static function singleton($request = false) {
if(!isset(self::$instance)) {
$c=__CLASS__;
self::$instance=new $c($request);
}
return self::$instance;
}
public function set($name, $value) {
if($name) {
$this->request[$name] = $value;
}
}
public function get($name = null) {
if($name) {
if(array_key_exists($name, $this->request)) {
//var_dump($this->request);exit;
return $this->request[$name];
} else {
return null;
}
}
return $this->request;
}
public function __get($name) {
return $this->get($name);
}
}