Index: branches/5.3.x/core/units/admin/admin_tag_processor.php =================================================================== diff -u -N -r15483 -r15677 --- branches/5.3.x/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 15483) +++ branches/5.3.x/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 15677) @@ -1,6 +1,6 @@ SelectParam($params, 'name,render_as,block'); $params['section_name'] = $section_name; - $template = $section_data['url']['t']; - unset($section_data['url']['t']); + $url_params = $section_data['url']; + unset($url_params['t']); - $section_data['section_url'] = $this->Application->HREF($template, '', $section_data['url']); + $section_data['section_url'] = $this->Application->HREF($section_data['url']['t'], '', $url_params); $ret = $this->Application->ParseBlock( array_merge($params, $section_data) ); return $ret; @@ -654,64 +654,49 @@ * Allows to set popup size (key - current template name) * * @param Array $params + * @return string + * @access protected */ - function SetPopupSize($params) + protected function SetPopupSize($params) { $width = $params['width']; $height = $params['height']; - if ($this->Application->GetVar('ajax') == 'yes') { + if ( $this->Application->GetVar('ajax') == 'yes' ) { // during AJAX request just output size - die($width.'x'.$height); + die($width . 'x' . $height); } - if (!$this->UsePopups($params)) { - return ; + if ( !$this->UsePopups($params) ) { + return; } $t = $this->Application->GetVar('t'); + $sql = 'SELECT * - FROM '.TABLE_PREFIX.'PopupSizes - WHERE TemplateName = '.$this->Conn->qstr($t); + FROM ' . TABLE_PREFIX . 'PopupSizes + WHERE TemplateName = ' . $this->Conn->qstr($t); $popup_info = $this->Conn->GetRow($sql); - if (!$popup_info) { + + if ( !$popup_info ) { // create new popup size record - $fields_hash = Array ( - 'TemplateName' => $t, - 'PopupWidth' => $width, - 'PopupHeight' => $height, - ); - $this->Conn->doInsert($fields_hash, TABLE_PREFIX.'PopupSizes'); + $fields_hash = Array ( + 'TemplateName' => $t, + 'PopupWidth' => $width, + 'PopupHeight' => $height, + ); + + $this->Conn->doInsert($fields_hash, TABLE_PREFIX . 'PopupSizes'); } - elseif ($popup_info['PopupWidth'] != $width || $popup_info['PopupHeight'] != $height) { + elseif ( $popup_info['PopupWidth'] != $width || $popup_info['PopupHeight'] != $height ) { // popup found and size in tag differs from one in db -> update in db - $fields_hash = Array ( - 'PopupWidth' => $width, - 'PopupHeight' => $height, - ); - $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'PopupSizes', 'PopupId = '.$popup_info['PopupId']); - } - } + $fields_hash = Array ( + 'PopupWidth' => $width, + 'PopupHeight' => $height, + ); - /** - * Returns popup size (by template), if not cached, then parse template to get value - * - * @param Array $params - * @return string - */ - function GetPopupSize($params) - { - $t = $this->Application->GetVar('template_name'); - $sql = 'SELECT * - FROM '.TABLE_PREFIX.'PopupSizes - WHERE TemplateName = '.$this->Conn->qstr($t); - $popup_info = $this->Conn->GetRow($sql); - if (!$popup_info) { - $this->Application->InitParser(); - $this->Application->ParseBlock(array('name' => $t)); // dies when SetPopupSize tag found & in ajax requrest - return '750x400'; // tag SetPopupSize not found in template -> use default size + $this->Conn->doUpdate($fields_hash, TABLE_PREFIX . 'PopupSizes', 'PopupId = ' . $popup_info['PopupId']); } - return $popup_info['PopupWidth'].'x'.$popup_info['PopupHeight']; } /** @@ -972,34 +957,36 @@ function PrintSqlCols($params) { - $a_data = unserialize($this->Application->GetVar('sql_rows')); $ret = ''; $block = $params['render_as']; - foreach ($a_data AS $a_row) - { - foreach ($a_row AS $col => $value) - { - $ret .= $this->Application->ParseBlock(Array('name'=>$block, 'value'=>$col)); - } - break; + $a_data = unserialize($this->Application->GetVar('sql_rows')); + + $a_row = current($a_data); + + foreach ($a_row AS $col => $value) { + $ret .= $this->Application->ParseBlock(Array ('name' => $block, 'value' => $col)); } + return $ret; } function PrintSqlRows($params) { - $a_data = unserialize($this->Application->GetVar('sql_rows')); $ret = ''; $block = $params['render_as']; - foreach ($a_data AS $a_row) - { + $a_data = unserialize($this->Application->GetVar('sql_rows')); + + foreach ($a_data as $a_row) { $cells = ''; - foreach ($a_row AS $col => $value) - { - $cells .= '