Index: branches/5.1.x/core/kernel/db/db_event_handler.php =================================================================== diff -u -r13691 -r13750 --- branches/5.1.x/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 13691) +++ branches/5.1.x/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 13750) @@ -1,6 +1,6 @@ Application->isDebugMode()) { $this->Application->Debugger->appendTrace(); } - trigger_error('ItemLoad Permission Failed for prefix [' . $event->getPrefixSpecial() . '] in checkItemStatus, leading to "404 Not Found"', E_USER_WARNING); + trigger_error('ItemLoad Permission Failed for prefix [' . $event->getPrefixSpecial() . '] in checkItemStatus, leading to "404 Not Found"', E_USER_NOTICE); header('HTTP/1.0 404 Not Found'); @@ -555,7 +555,7 @@ $this->Application->Debugger->appendTrace(); } - trigger_error('ItemLoad Permission Failed for prefix ['.$event->getPrefixSpecial().'] in '.($status_checked ? 'checkItemStatus' : 'CheckPermission').'', E_USER_WARNING); + trigger_error('ItemLoad Permission Failed for prefix ['.$event->getPrefixSpecial().'] in '.($status_checked ? 'checkItemStatus' : 'CheckPermission').'', E_USER_NOTICE); $template = $this->Application->isAdmin ? 'no_permission' : $this->Application->ConfigValue('NoPermissionTemplate'); if (MOD_REWRITE) { @@ -1326,15 +1326,12 @@ $this->customProcessing($event,'before'); //look at kDBItem' Create for ForceCreateId description, it's rarely used and is NOT set by default - if( $object->Create($event->getEventParam('ForceCreateId')) ) - { - if( $object->IsTempTable() ) $object->setTempID(); + if ( $object->Create($event->getEventParam('ForceCreateId')) ) { $this->customProcessing($event,'after'); $event->status=erSUCCESS; $event->redirect_params = Array('opener'=>'u'); } - else - { + else { $event->status = erFAIL; $event->redirect = false; $this->Application->SetVar($event->Prefix_Special.'_SaveEvent','OnCreate'); @@ -2409,9 +2406,6 @@ if ($is_new) { $object->Create(); - if (!$is_main && $object->IsTempTable()) { - $object->setTempID(); - } } else { $object->Update(); @@ -2619,9 +2613,17 @@ $fname = $id . '_' . $fname; } + $field_name = $this->Application->GetVar('field'); $fields = $this->Application->getUnitOption($event->Prefix, 'Fields'); - $upload_dir = $fields[ $this->Application->GetVar('field') ]['upload_dir']; + if (array_key_exists($field_name, $fields)) { + $upload_dir = $fields[$field_name]['upload_dir']; + } + else { + $virtual_fields = $this->Application->getUnitOption($event->Prefix, 'VirtualFields'); + $upload_dir = $virtual_fields[$field_name]['upload_dir']; + } + if (!is_writable($tmp_path)) { // 500 Internal Server Error // check both temp and live upload directory