forked from coppermine-gallery/cpg1.6.x
-
Notifications
You must be signed in to change notification settings - Fork 1
/
keyword_select.php
115 lines (85 loc) · 2.76 KB
/
keyword_select.php
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
<?php
/*************************
Coppermine Photo Gallery
************************
Copyright (c) 2003-2016 Coppermine Dev Team
v1.0 originally written by Gregory Demar
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3
as published by the Free Software Foundation.
********************************************
Coppermine version: 1.6.01
$HeadURL$
**********************************************/
define('IN_COPPERMINE', true);
define('UPLOAD_PHP', true);
require('include/init.inc.php');
if (!USER_CAN_UPLOAD_PICTURES) {
cpg_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);
}
pageheader_mini($lang_upload_php['keywords_sel']);
$query = "SELECT keyword FROM {$CONFIG['TABLE_DICT']} ORDER BY keyword";
$result = cpg_db_query($query);
$keywords = array();
while ($row = $result->fetchAssoc()) {
$keywords[] = $row['keyword'];
}
$total = $result->numRows(true);
if ($superCage->get->keyExists('id')) {
$formFieldId = $superCage->get->getInt('id');
}
echo '<form name="keywordform" action="">'.$LINEBREAK;
starttable("100%", $lang_upload_php['keywords_sel'], 3);
$keyword_separator = $CONFIG['keyword_separator'];
if ($total > 0) {
$options = '';
foreach ($keywords as $keyword) {
$options .= ' <option value="'.$keyword.'">'.$keyword.'</option>' . $LINEBREAK;
}
echo <<< EOT
<script type="text/javascript">
<!--
var str;
function CM_select(f)
{
new_keyword = f.value;
var current_keywords = window.parent.document.getElementById('keywords{$formFieldId}').value;
var substrings = current_keywords.split(new_keyword);
if (substrings.length <= 1) {
keyword_separator = (current_keywords.length == 0) ? '' : '$keyword_separator';
window.parent.document.getElementById('keywords{$formFieldId}').value += keyword_separator + new_keyword;
}
return false;
}
//-->
</script>
<tr>
<td class="tableb" align="left">
<select name="keyword" size="20" onchange="CM_select(this);" class="listbox">
$options
</select>
</td>
</tr>
EOT;
} else {
echo <<< EOT
<tr>
<td class="tablef" align="center">
<a href="#" onclick="parent.parent.GB_hide();" class="admin_menu">{$lang_upload_php['no_keywords']}</a>
</td>
</tr>
EOT;
}
if (GALLERY_ADMIN_MODE) {
echo <<< EOT
<tr>
<td class="tablef" align="center">
<a href="keyword_create_dict.php?referer=keyword_select.php" class="admin_menu">{$lang_upload_php['regenerate_dictionary']}</a>
</td>
</tr>
EOT;
}
endtable();
echo '</form>';
pagefooter_mini();
//EOF