Index: branches/5.3.x/core/units/admin/admin_events_handler.php =================================================================== diff -u -N -r15574 -r15677 --- branches/5.3.x/core/units/admin/admin_events_handler.php (.../admin_events_handler.php) (revision 15574) +++ branches/5.3.x/core/units/admin/admin_events_handler.php (.../admin_events_handler.php) (revision 15677) @@ -1,6 +1,6 @@ Conn->Query($sql); $this->Application->SetVar('sql_time', round(microtime(true) - $start, 7)); - if ( $result ) { - if ( is_array($result) ) { - $this->Application->SetVar('sql_has_rows', 1); - $this->Application->SetVar('sql_rows', serialize($result)); - } + if ( $result && is_array($result) ) { + $this->Application->SetVar('sql_has_rows', 1); + $this->Application->SetVar('sql_rows', serialize($result)); } $check_sql = trim(strtolower($sql)); @@ -1157,6 +1155,43 @@ $mass_resizer->run(); } + + /** + * Returns popup size (by template), if not cached, then parse template to get value + * + * @param kEvent $event + * @return void + * @access protected + */ + protected function OnGetPopupSize(kEvent $event) + { + $event->status = kEvent::erSTOP; + + if ( $this->Application->GetVar('ajax') != 'yes' ) { + return; + } + + $t = $this->Application->GetVar('template_name'); + + $sql = 'SELECT * + FROM ' . TABLE_PREFIX . 'PopupSizes + WHERE TemplateName = ' . $this->Conn->qstr($t); + $popup_info = $this->Conn->GetRow($sql); + + $this->Application->setContentType('text/plain'); + + if ( !$popup_info ) { + // dies when SetPopupSize tag found & in ajax request + $this->Application->InitParser(); + $this->Application->ParseBlock(Array ('name' => $t)); + + // tag SetPopupSize not found in template -> use default size + echo '750x400'; + } + else { + echo $popup_info['PopupWidth'] . 'x' . $popup_info['PopupHeight']; + } + } } /**