From 3fc28c0142bf8ab4e2cfae44931e2a51aadc4d51 Mon Sep 17 00:00:00 2001 From: mcramer <m.cramer@pixcept.de> Date: Mon, 25 Feb 2013 13:51:37 -0500 Subject: [PATCH] - Added: remoting queries with a lot of results (e.g. email addresses or alias domains or dns rr) lead to non-functioning soap requests - added '#OFFSET#' AND '#LIMIT#' handling to the query - added automatic 'WHERE 1' if an empty array was given as query example: $result = $api->sites_web_domain_get('type' => 'vhost', '#OFFSET#' => 25, '#LIMIT#' => 50); to get the websites 26 to 75 --- interface/lib/classes/listform_actions.inc.php | 28 +++++++++++++++++++++++----- 1 files changed, 23 insertions(+), 5 deletions(-) diff --git a/interface/lib/classes/listform_actions.inc.php b/interface/lib/classes/listform_actions.inc.php index 70aa155..ed689eb 100644 --- a/interface/lib/classes/listform_actions.inc.php +++ b/interface/lib/classes/listform_actions.inc.php @@ -33,8 +33,9 @@ private $id; public $idx_key; public $DataRowColor; - public $SQLExtWhere = ''; - public $SQLOrderBy = ''; + public $SQLExtWhere = ''; + public $SQLOrderBy = ''; + public $SQLExtSelect = ''; public function onLoad() { @@ -141,7 +142,8 @@ if($_SESSION['s']['user']['typ'] == "admin") { $sql_where = ''; } else { - $sql_where = $app->tform->getAuthSQL('r').' and'; + $sql_where = $app->tform->getAuthSQL('r', $app->listform->listDef['table']).' and'; + //$sql_where = $app->tform->getAuthSQL('r').' and'; } } if($this->SQLExtWhere != '') { @@ -248,6 +250,11 @@ $order_by_sql = "GROUP BY mailuser_id ".$order_by_sql; } } + + if($this->SQLExtSelect != '') { + if(substr($this->SQLExtSelect,0,1) != ',') $this->SQLExtSelect = ','.$this->SQLExtSelect; + $extselect .= $this->SQLExtSelect; + } return 'SELECT '.$app->listform->listDef['table'].'.*'.$extselect.' FROM '.$app->listform->listDef['table']."$join WHERE $sql_where $order_by_sql $limit_sql"; } @@ -268,20 +275,31 @@ $limits = array('5'=>'5','15'=>'15','25'=>'25','50'=>'50','100'=>'100','999999999' => 'all'); //* create options and set selected, if default -> 15 is selected + + $options = ''; foreach($limits as $key => $val){ $options .= '<option value="'.$key.'" '.(isset($_SESSION['search']['limit']) && $_SESSION['search']['limit'] == $key ? 'selected="selected"':'' ).(!isset($_SESSION['search']['limit']) && $key == '15' ? 'selected="selected"':'').'>'.$val.'</option>'; } - $app->tpl->setVar('search_limit','<select name="search_limit" style="width:50px">'.$options.'</select>'); + $app->tpl->setVar('search_limit','<select name="search_limit" class="search_limit">'.$options.'</select>'); $app->tpl->setVar('toolsarea_head_txt',$app->lng('toolsarea_head_txt')); $app->tpl->setVar($app->listform->wordbook); $app->tpl->setVar('form_action', $app->listform->listDef['file']); + if(isset($_SESSION['show_info_msg'])) { + $app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']); + unset($_SESSION['show_info_msg']); + } + if(isset($_SESSION['show_error_msg'])) { + $app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']); + unset($_SESSION['show_error_msg']); + } + //* Parse the templates and send output to the browser $this->onShowEnd(); } - private function onShowEnd() + public function onShowEnd() { global $app; $app->tpl_defaults(); -- Gitblit v1.9.1