Conditions | 7 |
Paths | 24 |
Total Lines | 75 |
Code Lines | 48 |
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 |
||
61 | public function doDefault() |
||
62 | { |
||
63 | $lang = $this->lang; |
||
64 | $data = $this->misc->getDatabaseAccessor(); |
||
65 | |||
66 | if (!isset($_SESSION['sqlquery'])) { |
||
67 | $_SESSION['sqlquery'] = ''; |
||
68 | } |
||
69 | |||
70 | if (!isset($_REQUEST['search_path'])) { |
||
71 | $_REQUEST['search_path'] = implode(',', $data->getSearchPath()); |
||
72 | } |
||
73 | $search_path = htmlspecialchars($_REQUEST['search_path']); |
||
74 | $sqlquery = htmlspecialchars($_SESSION['sqlquery']); |
||
75 | |||
76 | $default_html = $this->printTabs($this->misc->getNavTabs('popup'), 'sql', false); |
||
77 | |||
78 | $default_html .= '<form action="' . \SUBFOLDER . '/src/views/sql" method="post" enctype="multipart/form-data" class="sqlform" id="sqlform" target="detail">'; |
||
79 | $default_html .= "\n"; |
||
80 | $default_html .= $this->printConnection('sql', false); |
||
81 | |||
82 | $default_html .= "\n"; |
||
83 | |||
84 | $default_html .= ' <div class="searchpath">'; |
||
85 | $default_html .= '<label>'; |
||
86 | $default_html .= $this->misc->printHelp($lang['strsearchpath'], 'pg.schema.search_path', false); |
||
87 | |||
88 | $default_html .= ': <input type="text" name="search_path" id="search_path" size="45" value="' . $search_path . '" />'; |
||
89 | $default_html .= "</label>\n"; |
||
90 | |||
91 | $default_html .= "</div>\n"; |
||
92 | |||
93 | $default_html .= '<div id="queryedition" style="padding:1%;width:98%;float:left;">'; |
||
94 | $default_html .= "\n"; |
||
95 | $default_html .= '<textarea style="width:98%;" rows="10" cols="50" name="query" id="query" resizable="true">' . $sqlquery . '</textarea>'; |
||
96 | $default_html .= "\n"; |
||
97 | $default_html .= "</div>\n"; |
||
98 | |||
99 | $default_html .= '<div class="sqledit_bottom_inputs" >'; |
||
100 | |||
101 | if (ini_get('file_uploads')) { |
||
102 | // Don't show upload option if max size of uploads is zero |
||
103 | $max_size = $this->misc->inisizeToBytes(ini_get('upload_max_filesize')); |
||
104 | if (is_double($max_size) && $max_size > 0) { |
||
105 | $default_html .= '<p class="upload_sql_script">'; |
||
106 | $default_html .= '<input type="hidden" name="MAX_FILE_SIZE" value="' . $max_size . '" />'; |
||
107 | $default_html .= "\n"; |
||
108 | $default_html .= '<label for="script">' . $lang['struploadscript'] . '</label>'; |
||
109 | $default_html .= ' <input class="btn btn-small" id="script" name="script" type="file" /></p>'; |
||
110 | $default_html .= "</p>\n"; |
||
111 | } |
||
112 | } |
||
113 | |||
114 | // Check that file uploads are enabled |
||
115 | $checked = (isset($_REQUEST['paginate']) ? ' checked="checked"' : ''); |
||
116 | |||
117 | $default_html .= '<p><input type="submit" class="btn btn-small" name="execute" accesskey="r" value="' . $lang['strexecute'] . '" />'; |
||
118 | $default_html .= "\n"; |
||
119 | |||
120 | $default_html .= '<input type="reset" class="btn btn-small" accesskey="q" value="' . $lang['strreset'] . '" /></p>'; |
||
121 | $default_html .= "\n"; |
||
122 | |||
123 | $default_html .= '<p>'; |
||
124 | $default_html .= '<label for="paginate">'; |
||
125 | $default_html .= '<input type="checkbox" id="paginate" name="paginate"' . $checked . ' /> ' . $lang['strpaginate'] . ' '; |
||
126 | $default_html .= "</label>\n"; |
||
127 | $default_html .= "</p>\n"; |
||
128 | |||
129 | $default_html .= "</div>\n"; |
||
130 | $default_html .= '</form>'; |
||
131 | $default_html .= "\n"; |
||
132 | |||
133 | // Default focus |
||
134 | //$this->setFocus('forms[0].query'); |
||
135 | return $default_html; |
||
136 | } |
||
194 |