Added fancyurl execption in mfRouter for Login process
This commit is contained in:
@@ -13,6 +13,8 @@ class ADBWohneinheit extends mfBaseModel {
|
||||
if(!$this->id) return true;
|
||||
if(!$this->hausnummer_id) return true;
|
||||
|
||||
// ADBWohneinheit_onSave_noAutoUnitCount can be defined if doing bulk
|
||||
// operations where unit count is calculated seperately
|
||||
if(!defined("ADBWohneinheit_onSave_noAutoUnitCount") || !ADBWohneinheit_onSave_noAutoUnitCount) {
|
||||
$unit_count = ADBWohneinheitModel::count(['hausnummer_id' => $this->hausnummer_id]);
|
||||
$hausnummer = $this->getProperty("hausnummer");
|
||||
|
||||
@@ -100,7 +100,7 @@ class Preorder extends mfBaseModel {
|
||||
$oaid->loadRandomUnassigned($oaid_attributes);
|
||||
|
||||
if(!$oaid->oaid) {
|
||||
$this->layout->setFlash("Keine weiteren OAIDs verfügbar", "error");
|
||||
$this->log->error("Keine weiteren OAIDs verfügbar");
|
||||
throw new Exception("Keine weiteren OAIDs verfügbar in ".$netowner->getCompanyOrName());
|
||||
} else {
|
||||
// make sure this OAID is not in use on another wohneinheit by accident
|
||||
@@ -137,7 +137,7 @@ class Preorder extends mfBaseModel {
|
||||
$oaid->unit_string = (string)$wohneinheit;
|
||||
//var_dump($oaid);exit;
|
||||
if(!$oaid->save()) {
|
||||
$this->layout()->setFlash("Fehler beim Speichern der OAID für Preorder ".$preorder->id);
|
||||
$this->log->error("Fehler beim Speichern der OAID für Preorder ".$preorder->id);
|
||||
$this->redirect("Preordercampaign", "Admin");
|
||||
}
|
||||
if(!$this->save()) {
|
||||
|
||||
@@ -610,8 +610,8 @@ class PreordercampaignController extends mfBaseController {
|
||||
//$preorder->save();
|
||||
$resp_data = json_decode($response);
|
||||
if(!is_object($resp_data)) {
|
||||
$this->log->error("Cannot create RimoWorkorder in Database! Invalid Response! (Preorder code: ".$preorder->ucode.") | Response: \n$response");
|
||||
throw new Exception("Cannot create RimoWorkorder in Database! Invalid Response! (Preorder code: ".$preorder->ucode.")");
|
||||
$this->log->error("Cannot create RimoWorkorder! Invalid Response! (Preorder code: ".$preorder->ucode.") | Response: \n$response");
|
||||
throw new Exception("Cannot create RimoWorkorder! Invalid Response! (Preorder code: ".$preorder->ucode.")");
|
||||
}
|
||||
|
||||
$wo = RimoWorkorderModel::create([
|
||||
|
||||
@@ -72,6 +72,7 @@ class mfRouter {
|
||||
|
||||
// get baseurl from fancy urls if used
|
||||
if(MFUSEFANCYURLS) {
|
||||
//var_dump($umod, $uaction, $_SERVER);
|
||||
if(!$umod) {
|
||||
$baseurl = $_SERVER['REQUEST_URI'];
|
||||
}
|
||||
@@ -85,6 +86,89 @@ class mfRouter {
|
||||
$baseurl = $m[1];
|
||||
}
|
||||
}
|
||||
|
||||
// Special case for login, because mod/action in $request mask the real url
|
||||
if($_SERVER['REQUEST_METHOD'] == "POST" && $umod == "mfLogin" && $uaction == "Login") {
|
||||
// try to extract baseurl from env
|
||||
// may not work on all webservers
|
||||
$virtual = preg_replace('@/+$@', "", $_SERVER["REQUEST_URI"]);
|
||||
$real = preg_replace('@/+$@', "", $_SERVER['PHP_SELF']);
|
||||
|
||||
$virtual_parts = explode("/", $virtual);
|
||||
$real_parts = explode("/", $real);
|
||||
|
||||
/*
|
||||
* if there are no parts then we're good.
|
||||
* Else find Action in last and Mod in second to last part.
|
||||
* Action is optional.
|
||||
*
|
||||
* In rare cases some parts can match by accident if a folder is
|
||||
* named the same as a mod or action. There is nothing we can do.
|
||||
*/
|
||||
$id_part_virtual = false;
|
||||
$action_part = false;
|
||||
$mod_part = false;
|
||||
|
||||
if(is_numeric($virtual_parts[count($virtual_parts) - 1]) && count($virtual_parts) > 2 && count($real_parts)) {
|
||||
|
||||
$id_part_virtual = $virtual_parts[count($virtual_parts) - 1];
|
||||
$id_part_real = $real_parts[count($real_parts) - 1];
|
||||
|
||||
$action_part_virtual = $virtual_parts[count($virtual_parts) - 2];
|
||||
$action_part_real = $real_parts[count($real_parts) - 2];
|
||||
|
||||
$mod_part_virtual = $virtual_parts[count($virtual_parts) - 3];
|
||||
$mod_part_real = $real_parts[count($real_parts) - 3];
|
||||
|
||||
if($id_part_virtual != $id_part_real) {
|
||||
$id_part = $id_part_virtual;
|
||||
}
|
||||
if($action_part_virtual != $action_part_real) {
|
||||
$action_part = $action_part_virtual;
|
||||
}
|
||||
if($mod_part_virtual != $mod_part_real) {
|
||||
$mod_part = $mod_part_virtual;
|
||||
}
|
||||
|
||||
} elseif(count($virtual_parts) > 1 && count($real_parts)) {
|
||||
$action_part_virtual = $virtual_parts[count($virtual_parts) - 1];
|
||||
$action_part_real = $real_parts[count($real_parts) - 1];
|
||||
|
||||
$mod_part_virtual = $virtual_parts[count($virtual_parts) - 2];
|
||||
$mod_part_real = $real_parts[count($real_parts) - 2];
|
||||
|
||||
if($action_part_virtual != $action_part_real) {
|
||||
$action_part = $action_part_virtual;
|
||||
}
|
||||
if($mod_part_virtual != $mod_part_real) {
|
||||
$mod_part = $mod_part_virtual;
|
||||
}
|
||||
|
||||
} elseif(count($virtual_parts) && count($real_parts)) {
|
||||
$mod_part_virtual = $virtual_parts[count($virtual_parts) - 1];
|
||||
$mod_part_real = $real_parts[count($real_parts) - 1];
|
||||
|
||||
if($mod_part_virtual != $mod_part_real) {
|
||||
$mod_part = $mod_part_virtual;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($id_part) {
|
||||
if(preg_match("#^(.+)/$mod_part/$action_part/$id_part/?\\??#i",$_SERVER['REQUEST_URI'],$m)) {
|
||||
$baseurl = $m[1];
|
||||
}
|
||||
} elseif($mod_part) {
|
||||
if(preg_match("#^(.+)/$mod_part/$action_part/?\\??#i",$_SERVER['REQUEST_URI'],$m)) {
|
||||
$baseurl = $m[1];
|
||||
}
|
||||
} else {
|
||||
if(preg_match("#^(.+)/$action_part/?\\??#i",$_SERVER['REQUEST_URI'],$m)) {
|
||||
$baseurl = $m[1];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
define("MFFANCYBASEURL",$baseurl);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user