Menu

[2eb2a2]: / search_scripts.php  Maximize  Restore  History

Download this file

313 lines (275 with data), 10.5 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
<?php session_start(); ?>
<html>
<head>
<title>deltasql - Search Scripts</title>
<style type="text/css">@import url(utils/jscalendar-1.0/calendar-win2k-1.css);</style>
<script type="text/javascript" src="utils/jscalendar-1.0/calendar.js"></script>
<script type="text/javascript" src="utils/jscalendar-1.0/lang/calendar-en.js"></script>
<script type="text/javascript" src="utils/jscalendar-1.0/calendar-setup.js"></script>
<link rel="stylesheet" type="text/css" href="deltasql.css">
<link rel="shortcut icon" href="pictures/favicon.ico" />
</head>
<body>
<?php
include("conf/config.inc.php");
include("utils/utils.inc.php");
include("utils/components.inc.php");
include("head.inc.php");
if(isset($_SESSION['rights'])) {
$rights = $_SESSION["rights"];
} else $rights=0;
// load current settings
if (isset($_SESSION['search_title'])) $cookie_filtertitle=$_SESSION['search_title']; else $cookie_filtertitle="";
if (isset($_SESSION['search_comments'])) $cookie_filtercomment=$_SESSION['search_comments']; else $cookie_filtercomment="";
if (isset($_SESSION['search_script'])) $cookie_filterscript=$_SESSION['search_script']; else $cookie_filterscript="";
if (isset($_SESSION['search_authorid'])) $cookie_authorid=$_SESSION['search_authorid']; else $cookie_authorid="";
if (isset($_SESSION['search_moduleid'])) $cookie_moduleid=$_SESSION['search_moduleid']; else $cookie_moduleid="";
if (isset($_SESSION['search_branchid'])) $cookie_branchid=$_SESSION['search_branchid']; else $cookie_branchid="";
if (isset($_SESSION['search_frmisaview'])) $cookie_frmisaview=$_SESSION['search_frmisaview']; else $cookie_frmisaview="";
if (isset($_SESSION['search_frmisapackage'])) $cookie_frmisapackage=$_SESSION['search_frmisapackage']; else $cookie_frmisapackage="";
if (isset($_SESSION['search_comments_matchcase'])) $cookie_commentsmatchcase=$_SESSION['search_comments_matchcase']; else $cookie_commentsmatchcase="";
if (isset($_SESSION['search_script_matchcase'])) $cookie_scriptsmatchcase=$_SESSION['search_script_matchcase']; else $cookie_scriptsmatchcase;
if (isset($_SESSION['search_fromversion'])) $cookie_fromversion=$_SESSION['search_fromversion']; else $cookie_fromversion="";
if (isset($_SESSION['search_toversion'])) $cookie_toversion=$_SESSION['search_toversion']; else $cookie_toversion="";
if (isset($_SESSION['search_fromdata'])) $cookie_fromdata=$_SESSION['search_fromdata']; else $cookie_fromdata="";
if (isset($_SESSION['search_todata'])) $cookie_todata=$_SESSION['search_todata']; else $cookie_todata="";
if (isset($_SESSION['search_modified'])) $cookie_modified=$_SESSION['search_modified']; else $cookie_modified="";
if (isset($_SESSION['search_projectid'])) $cookie_project=$_SESSION['search_projectid']; else $cookie_project="";
if (!isset($_SESSION["userid"])) $userid="NULL"; else $userid=$_SESSION["userid"];
?>
<table border="0">
<tr>
<td>
<h2>Search Scripts</h2>
<form name="searchscripts" id="searchscripts" method="post" action="search_scripts_store_cookies.php">
<table>
<tr>
<td><b>Date Interval</b></td>
<td>
From:
<input type="text" id="fromdata" name="fromdata" value="<?php echo "$cookie_fromdata"; ?>" size="10">
<button id="trigger_from">...</button>
<script type="text/javascript">
Calendar.setup(
{
inputField : "fromdata", // ID of the input field
ifFormat : "%Y-%m-%d", // the date format
button : "trigger_from" // ID of the button
}
);
</script>
To:
<input type="text" id="todata" name="todata" value="<?php echo "$cookie_todata"; ?>" size="10">
<button id="trigger_to">...</button>
<script type="text/javascript">
Calendar.setup(
{
inputField : "todata", // ID of the input field
ifFormat : "%Y-%m-%d", // the date format
button : "trigger_to" // ID of the button
}
);
</script>
</td>
</tr>
<tr>
<td><b>Script Title:</b></td> <td><input type="text" name="title"
value="<?php echo "$cookie_filtertitle"; ?>" size="40">
</td>
</tr>
<td><b>Script Content:</b></td> <td><input type="text" name="script"
value="<?php echo "$cookie_filterscript"; ?>" size="40">
</td>
</tr>
<tr>
<td><b>Script Comments:</b></td> <td><input type="text" name="comments"
value="<?php echo "$cookie_filtercomment"; ?>" size="40">
</td>
</tr>
<tr><td>
<b>Submitter:</b></td><td>
<?php
echo "<select NAME=\"authorid\">";
echo "<option VALUE=\"\" ";
if ($cookie_authorid=="") echo "SELECTED";
echo ">";
mysql_connect($dbserver, $username, $password);
@mysql_select_db($database) or die("Unable to select database");
$query6="SELECT * FROM tbuser ORDER BY username";
$result6=mysql_query($query6);
$num6=mysql_num_rows($result6);
// Author
$i=0;
while ($i<$num6) {
$authorid=mysql_result($result6,$i,"id");
$authorname=mysql_result($result6,$i,"username");
echo "<option VALUE=\"$authorid\" ";
if ($cookie_authorid==$authorid) echo "SELECTED";
echo ">$authorname";
$i++;
}
echo "</select>";
echo "</td></tr>";
echo "<tr><td>";
// Module
echo "<b>Module</b>: </td> <td> <select NAME=\"moduleid\">";
echo "<option VALUE=\"\" ";
if ($cookie_moduleid=="") echo "SELECTED";
echo ">";
$query7="SELECT * FROM tbmodule WHERE visible=1 ORDER BY name";
$result7=mysql_query($query7);
$num7=mysql_num_rows($result7);
$i=0;
while ($i<$num7) {
$moduleid=mysql_result($result7,$i,"id");
$modulename=mysql_result($result7,$i,"name");
echo "<option VALUE=\"$moduleid\" ";
if ($cookie_moduleid==$moduleid) echo "SELECTED";
echo ">$modulename";
$i++;
}
echo "</select></td>";
echo "</tr><tr>";
// Project
echo "<td><b>Project:</b></td><td>";
printProjectComboBox($cookie_project);
echo "</td></tr><tr>";
//Branch
echo "<td><b>Branch:</b></td> ";
echo "<td><select NAME=\"branchid\">";
echo "<option VALUE=\"\" ";
if ($cookie_branchid=="") echo "SELECTED";
echo ">";
$query8="SELECT * FROM tbbranch WHERE istag=0 order by name ASC";
$result8=mysql_query($query8);
$num8=mysql_num_rows($result8);
$i=0;
while ($i<$num8) {
$branchid=mysql_result($result8,$i,"id");
$branchname=mysql_result($result8,$i,"name");
echo "<option VALUE=\"$branchid\" ";
if ($cookie_branchid==$branchid) echo "SELECTED";
echo ">$branchname";
$i++;
}
echo "</select></td></tr>";
echo "<tr>";
echo "<td><b>Particular script:</b></td>";
echo "<td><input name=\"frmisaview\" type=\"checkbox\" value=\"1\" ";
if ($cookie_frmisaview==1) echo "checked=\"checked\"";
echo "/>View";
echo "<input name=\"frmisapackage\" type=\"checkbox\" value=\"1\" ";
if ($cookie_frmisapackage==1) echo "checked=\"checked\"";
echo "/>Package</td>";
/* disabled as can be dangerous
if ($rights>1)
echo "<td><a href=\"detect_packages_and_views.php?backto=search\">Detect views and packages</a></td>";
*/
echo "</tr>";
mysql_close();
?>
<tr>
<td><b>Version number</b></td>
<td>From: <input type="text" name="fromversion" value="<?php echo "$cookie_fromversion"; ?>" size="10">
To: <input type="text" name="toversion" value="<?php echo "$cookie_toversion"; ?>" size="10"></td>
</td>
<?php
echo "<tr>";
echo "<td><b>Modified scripts only:</b></td>";
echo "<td><input name=\"frmmodified\" type=\"checkbox\" value=\"1\" ";
if ($cookie_modified=="1") echo "checked=\"checked\"";
echo "/> </td>";
echo "</tr>";
echo "<td><b>Output as a text list:</b></td>";
echo "<td><input name=\"frmtextlistoutput\" type=\"checkbox\" value=\"1\" ";
echo "/> (from lowest version to highest)</td>";
echo "</tr>";
?>
<?php
mysql_connect($dbserver, $username, $password);
@mysql_select_db($database) or die("Unable to select database");
if ($userid=="NULL") $userfilter="WHERE user_id IS NULL"; else $userfilter="WHERE user_id=$userid";
$query="SELECT count(*) from tbsearchquery $userfilter";
$result=mysql_query($query);
$count=mysql_result($result,0,"count(*)");
$queryfav="SELECT count(*) from tbsearchquery $userfilter AND isfavourite=1";
$resultfav=mysql_query($queryfav);
$countfav=mysql_result($resultfav,0,"count(*)");
$querytop="SELECT queryname,count(*) from tbsearchquery $userfilter group by queryname having count(*)>1";
$resulttop=mysql_query($querytop);
$counttop=mysql_num_rows($resulttop);
?>
<tr>
<td></td>
<td>
<input type="Submit" value="Search among Scripts">
</td>
<td></td>
</tr>
</table>
</form>
</td>
<td>
<table>
<?php
if ($countfav>0) echo "<h2>Favorites</h2>";
$query="SELECT * from tbsearchquery $userfilter AND isfavourite=1 ORDER BY queryname asc";
$result=mysql_query($query);
$num=mysql_num_rows($result);
$i=0;
while ($i<$num) {
$searchid=mysql_result($result,$i,"id");
$searchname=mysql_result($result,$i,"queryname");
echo "<tr><td>";
if ($rights>0) {
echo "<a href='search_edit.php?id=$searchid'><img src='icons/edit.png'></a>";
}
echo "</td><td><a href='search_fav.php?id=$searchid&fav=0'><img src='icons/delete.png'></a></td><td><a href='search_query.php?id=$searchid'>$searchname</a></td></tr>";
$i++;
}
?>
</table>
</td>
</tr>
<tr>
<td>
<table>
<?php
if ($count>0) echo "<h2>Last 10 Searches</h2>";
$query="SELECT * from tbsearchquery $userfilter ORDER BY id DESC LIMIT 10";
$result=mysql_query($query);
$num=mysql_num_rows($result);
$i=0;
while ($i<$num) {
$searchid=mysql_result($result,$i,"id");
$searchname=mysql_result($result,$i,"queryname");
echo "<tr><td><a href='search_fav.php?id=$searchid&fav=1'><img src='icons/fav.png'></a></td><td><a href='search_query.php?id=$searchid'>$searchname</a></td></tr>";
$i++;
}
?>
</table>
</td>
<td>
<table>
<?php
if ($counttop>0) echo "<h2>Top 10 Searches</h2>";
$query="SELECT max(id), queryname, count(*) from tbsearchquery $userfilter GROUP BY queryname HAVING count(*)>1 ORDER BY count(*) DESC LIMIT 10";
$result=mysql_query($query);
$num=mysql_num_rows($result);
$i=0;
while ($i<$num) {
$searchid=mysql_result($result,$i,"max(id)");
$searchname=mysql_result($result,$i,"queryname");
$count=mysql_result($result,$i,"count(*)");
echo "<tr><td><a href='search_fav.php?id=$searchid&fav=1'><img src='icons/fav.png'></a></td><td><a href='search_query.php?id=$searchid'>$searchname</a></td></tr>";
$i++;
}
?>
</table>
</td>
</tr>
<?php mysql_close(); ?>
</table>
<?php include("bottom.inc.php"); ?>
</body>
</html>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.