Conditions | 6 |
Paths | 12 |
Total Lines | 72 |
Code Lines | 46 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
56 | public function doDefault() |
||
57 | { |
||
58 | $data = $this->misc->getDatabaseAccessor(); |
||
59 | |||
60 | if (!isset($_SESSION['sqlquery'])) { |
||
61 | $_SESSION['sqlquery'] = ''; |
||
62 | } |
||
63 | |||
64 | $this->coalesceArr($_REQUEST, 'search_path', implode(',', $data->getSearchPath())); |
||
65 | $search_path = htmlspecialchars($_REQUEST['search_path']); |
||
66 | $sqlquery = htmlspecialchars($_SESSION['sqlquery']); |
||
67 | |||
68 | $default_html = $this->printTabs($this->misc->getNavTabs('popup'), 'sql', false); |
||
69 | |||
70 | $default_html .= '<form action="'.\SUBFOLDER.'/src/views/sql" method="post" enctype="multipart/form-data" class="sqlform" id="sqlform" target="detail">'; |
||
71 | $default_html .= PHP_EOL; |
||
72 | $default_html .= $this->printConnection('sql', false); |
||
73 | |||
74 | $default_html .= PHP_EOL; |
||
75 | |||
76 | $default_html .= ' <div class="searchpath">'; |
||
77 | $default_html .= '<label>'; |
||
78 | $default_html .= $this->misc->printHelp($this->lang['strsearchpath'], 'pg.schema.search_path', false); |
||
79 | |||
80 | $default_html .= ': <input type="text" name="search_path" id="search_path" size="45" value="'.$search_path.'" />'; |
||
81 | $default_html .= '</label>'.PHP_EOL; |
||
82 | |||
83 | $default_html .= '</div>'.PHP_EOL; |
||
84 | |||
85 | $default_html .= '<div id="queryedition" style="padding:1%;width:98%;float:left;">'; |
||
86 | $default_html .= PHP_EOL; |
||
87 | $default_html .= '<textarea style="width:98%;" rows="10" cols="50" name="query" id="query" resizable="true">'.$sqlquery.'</textarea>'; |
||
88 | $default_html .= PHP_EOL; |
||
89 | $default_html .= '</div>'.PHP_EOL; |
||
90 | |||
91 | $default_html .= '<div class="sqledit_bottom_inputs" >'; |
||
92 | |||
93 | if (ini_get('file_uploads')) { |
||
94 | // Don't show upload option if max size of uploads is zero |
||
95 | $max_size = $this->misc->inisizeToBytes(ini_get('upload_max_filesize')); |
||
96 | if (is_double($max_size) && $max_size > 0) { |
||
97 | $default_html .= '<p class="upload_sql_script">'; |
||
98 | $default_html .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.$max_size.'" />'; |
||
99 | $default_html .= PHP_EOL; |
||
100 | $default_html .= '<label for="script">'.$this->lang['struploadscript'].'</label>'; |
||
101 | $default_html .= ' <input class="btn btn-small" id="script" name="script" type="file" /></p>'; |
||
102 | $default_html .= '</p>'.PHP_EOL; |
||
103 | } |
||
104 | } |
||
105 | |||
106 | // Check that file uploads are enabled |
||
107 | $checked = (isset($_REQUEST['paginate']) ? ' checked="checked"' : ''); |
||
108 | |||
109 | $default_html .= '<p><input type="submit" class="btn btn-small" name="execute" accesskey="r" value="'.$this->lang['strexecute'].'" />'; |
||
110 | $default_html .= PHP_EOL; |
||
111 | |||
112 | $default_html .= '<input type="reset" class="btn btn-small" accesskey="q" value="'.$this->lang['strreset'].'" /></p>'; |
||
113 | $default_html .= PHP_EOL; |
||
114 | |||
115 | $default_html .= '<p>'; |
||
116 | $default_html .= '<label for="paginate">'; |
||
117 | $default_html .= '<input type="checkbox" id="paginate" name="paginate"'.$checked.' /> '.$this->lang['strpaginate'].' '; |
||
118 | $default_html .= '</label>'.PHP_EOL; |
||
119 | $default_html .= '</p>'.PHP_EOL; |
||
120 | |||
121 | $default_html .= '</div>'.PHP_EOL; |
||
122 | $default_html .= '</form>'; |
||
123 | $default_html .= PHP_EOL; |
||
124 | |||
125 | // Default focus |
||
126 | //$this->setFocus('forms[0].query'); |
||
127 | return $default_html; |
||
128 | } |
||
215 |