Index: branches/RC/core/kernel/event_manager.php =================================================================== diff -u -r8929 -r9274 --- branches/RC/core/kernel/event_manager.php (.../event_manager.php) (revision 8929) +++ branches/RC/core/kernel/event_manager.php (.../event_manager.php) (revision 9274) @@ -289,7 +289,7 @@ $this->Application->Session->SaveData(); exit; } - + if ($event->status == erPERM_FAIL) { // should do redirect but to no_permissions template $event->redirect = $this->Application->IsAdmin() ? 'no_permission' : $this->Application->ConfigValue('NoPermissionTemplate'); @@ -302,7 +302,7 @@ // don't save last_template, because no_permission template does js history.back and could cause invalid opener_stack content $this->Application->SetVar('skip_last_template', 1); } - + if ( ($event->status == erSUCCESS || $event->status == erPERM_FAIL) && ($event->redirect === true || strlen($event->redirect) > 0)) { // we need to pass category if the action was submitted to self-template, with the category passed // and it has not explicly set redirect template or pass_cateogry param @@ -516,28 +516,35 @@ return; }*/ - $sql = 'SELECT Data FROM '.TABLE_PREFIX.'Cache WHERE VarName = %s'; - $event_last_runs = $this->Conn->GetOne( sprintf($sql, $this->Conn->qstr('RegularEventRuns') ) ); + $sql = 'SELECT Data + FROM '.TABLE_PREFIX.'Cache + WHERE VarName = "RegularEventRuns"'; + $event_last_runs = $this->Conn->GetOne($sql); $event_last_runs = $event_last_runs ? unserialize($event_last_runs) : Array(); - foreach($events_source as $short_name => $event_data) - { + $user_id = $this->Application->RecallVar('user_id'); + $this->Application->StoreVar('user_id', -1); // to prevent permission checking inside events + + foreach ($events_source as $short_name => $event_data) { $event_last_run = getArrayValue($event_last_runs, $short_name); - if($event_last_run && $event_last_run > adodb_mktime() - $event_data['RunInterval']) - { + if ($event_last_run && $event_last_run > adodb_mktime() - $event_data['RunInterval']) { continue; } - else - { + else { $event = new kEvent($event_data['EventName']); $event->redirect = false; $this->Application->HandleEvent($event); $event_last_runs[$short_name] = adodb_mktime(); } } - $sql = 'REPLACE INTO '.TABLE_PREFIX.'Cache (VarName,Data,Cached) VALUES (%s,%s,%s)'; - $this->Conn->Query( sprintf($sql, $this->Conn->qstr('RegularEventRuns'), $this->Conn->qstr(serialize($event_last_runs)), adodb_mktime() ) ); + $this->Application->StoreVar('user_id', $user_id); + $fields_hash = Array ( + 'VarName' => 'RegularEventRuns', + 'Data' => serialize($event_last_runs), + 'Cached' => adodb_mktime(), + ); + $this->Conn->doInsert($fields_hash, TABLE_PREFIX.'Cache', 'REPLACE'); } /** Index: branches/RC/core/kernel/processors/main_processor.php =================================================================== diff -u -r9238 -r9274 --- branches/RC/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 9238) +++ branches/RC/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 9274) @@ -1039,6 +1039,10 @@ } header('Content-type: text/xml; charset='.$lang->GetDBField('Charset')); + + if (isset($params['xml_version']) && $params['xml_version']) { + return 'GetDBField('Charset').'"?>'; + } } function Header($params)