1 | <?php |
---|
2 | |
---|
3 | if (!defined('PHPWG_ROOT_PATH')) |
---|
4 | die('Hacking attempt!'); |
---|
5 | |
---|
6 | |
---|
7 | //Add link menu |
---|
8 | add_event_handler('get_admin_plugin_menu_links', 'meta_admin_menu'); |
---|
9 | |
---|
10 | function meta_admin_menu($menu) { |
---|
11 | load_language('plugin.lang', meta_PATH); |
---|
12 | array_push($menu, array( |
---|
13 | 'NAME' => l10n('Manage tag Metadata'), |
---|
14 | 'URL' => get_admin_plugin_menu_link(meta_PATH . 'admin/admin.php'))); |
---|
15 | return $menu; |
---|
16 | } |
---|
17 | |
---|
18 | //add prefiltre photo |
---|
19 | add_event_handler('loc_begin_admin', 'metaPadminf', 55); |
---|
20 | add_event_handler('loc_begin_admin_page', 'metaPadminA', 55); |
---|
21 | |
---|
22 | function metaPadminf() { |
---|
23 | global $template; |
---|
24 | $template->set_prefilter('picture_modify', 'metaPadminfT'); |
---|
25 | } |
---|
26 | |
---|
27 | function metaPadminfT($content, &$smarty) { |
---|
28 | $search = '#</form>#'; |
---|
29 | |
---|
30 | $replacement = ' |
---|
31 | <div> |
---|
32 | <fieldset> |
---|
33 | <br> |
---|
34 | <legend>{\'Metadata - Plugin meta\'|@translate}</legend> |
---|
35 | {\'meta_compimg\'|@translate} : <input type="text" name="insermetaKP" value="{$metaCONTENT}" size="110" maxlenght="110"> |
---|
36 | <br> |
---|
37 | <br> |
---|
38 | {\'meta_compimgdes\'|@translate} : <input type="text" name="insermetaDP" value="{$metaCONTENT2}" size="110" maxlenght="110"> |
---|
39 | ({\'meta_compcatdeshelp\'|@translate}) |
---|
40 | <br> |
---|
41 | <br> |
---|
42 | <div style="text-align:center;"> |
---|
43 | <input class="submit" name="submetaphoto" type="submit" value="{\'meta_inscat\'|@translate}" {$TAG_INPUT_ENABLED} /> |
---|
44 | </div> |
---|
45 | </fieldset> |
---|
46 | </div> |
---|
47 | </form>'; |
---|
48 | |
---|
49 | return preg_replace($search, $replacement, $content); |
---|
50 | } |
---|
51 | |
---|
52 | function metaPadminA() { |
---|
53 | load_language('plugin.lang', meta_PATH); |
---|
54 | if (isset($_GET['image_id'])) { |
---|
55 | global $template, $prefixeTable; |
---|
56 | $query = ' |
---|
57 | select id,metaKeyimg,metadesimg |
---|
58 | FROM ' . meta_img_TABLE . ' |
---|
59 | WHERE id = ' . $_GET['image_id'] . ' |
---|
60 | ;'; |
---|
61 | $result = pwg_query($query); |
---|
62 | $row = pwg_db_fetch_assoc($result); |
---|
63 | $chvalimg = $row['metaKeyimg']; |
---|
64 | $chvalimgdes = $row['metadesimg']; |
---|
65 | |
---|
66 | $template->assign( |
---|
67 | array( |
---|
68 | 'metaCONTENT' => $chvalimg, |
---|
69 | 'metaCONTENT2' => $chvalimgdes, |
---|
70 | )); |
---|
71 | } |
---|
72 | |
---|
73 | if (isset($_POST['submetaphoto'])) { |
---|
74 | $query = ' |
---|
75 | DELETE |
---|
76 | FROM ' . meta_img_TABLE . ' |
---|
77 | WHERE id = ' . $_GET['image_id'] . ' |
---|
78 | ;'; |
---|
79 | $result = pwg_query($query); |
---|
80 | $q = ' |
---|
81 | INSERT INTO ' . $prefixeTable . 'meta_img(id,metaKeyimg,metadesimg)VALUES (' . $_GET['image_id'] . ',"' . $_POST['insermetaKP'] . '","' . $_POST['insermetaDP'] . '");'; |
---|
82 | pwg_query($q); |
---|
83 | |
---|
84 | $template->assign( |
---|
85 | array( |
---|
86 | 'metaCONTENT' => $_POST['insermetaKP'], |
---|
87 | 'metaCONTENT2' => $_POST['insermetaDP'], |
---|
88 | )); |
---|
89 | } |
---|
90 | } |
---|
91 | |
---|
92 | //add prefiltre album |
---|
93 | add_event_handler('loc_end_cat_modify', 'metaAadminf'); |
---|
94 | add_event_handler('loc_end_cat_modify', 'metaAadminA'); |
---|
95 | |
---|
96 | function metaAadminf() { |
---|
97 | global $template; |
---|
98 | $template->set_prefilter('album_properties', 'metaAadminfT'); |
---|
99 | } |
---|
100 | |
---|
101 | function metaAadminfT($content, &$smarty) { |
---|
102 | $search = '#</form>#'; |
---|
103 | |
---|
104 | $replacement = ' |
---|
105 | <div> |
---|
106 | |
---|
107 | <fieldset> |
---|
108 | <legend>{\'Metadata - Plugin meta\'|@translate}</legend> |
---|
109 | {\'meta_compcat\'|@translate} : <input type="text" name="insermetaKA" value="{$metaCONTENT}" size="110" maxlenght="110"> |
---|
110 | <br> |
---|
111 | <br> |
---|
112 | {\'meta_compcatdes\'|@translate} : <input type="text" name="insermetaDA" value="{$metaCONTENT2}" size="110" maxlenght="110"> : ({\'meta_compcatdeshelp\'|@translate}) |
---|
113 | <br> |
---|
114 | <br> |
---|
115 | <div style="text-align:center;"> |
---|
116 | <input class="submit" name="submetaalbum" type="submit" value="{\'meta_inscat\'|@translate}" {$TAG_INPUT_ENABLED} /> |
---|
117 | </div> |
---|
118 | </fieldset> |
---|
119 | |
---|
120 | </div> |
---|
121 | </form> |
---|
122 | |
---|
123 | '; |
---|
124 | |
---|
125 | return preg_replace($search, $replacement, $content); |
---|
126 | } |
---|
127 | |
---|
128 | function metaAadminA() { |
---|
129 | load_language('plugin.lang', meta_PATH); |
---|
130 | if (isset($_GET['cat_id'])) { |
---|
131 | global $template, $prefixeTable; |
---|
132 | $query = ' |
---|
133 | select id,metaKeycat,metadescat |
---|
134 | FROM ' . meta_cat_TABLE . ' |
---|
135 | WHERE id = ' . $_GET['cat_id'] . ' |
---|
136 | ;'; |
---|
137 | $result = pwg_query($query); |
---|
138 | $row = pwg_db_fetch_assoc($result); |
---|
139 | $chvalcat = $row['metaKeycat']; |
---|
140 | $chvalcatdes = $row['metadescat']; |
---|
141 | |
---|
142 | $template->assign( |
---|
143 | array( |
---|
144 | 'metaCONTENT' => $chvalcat, |
---|
145 | 'metaCONTENT2' => $chvalcatdes, |
---|
146 | )); |
---|
147 | } |
---|
148 | |
---|
149 | if (isset($_POST['submetaalbum'])) { |
---|
150 | $query = ' |
---|
151 | DELETE |
---|
152 | FROM ' . meta_cat_TABLE . ' |
---|
153 | WHERE id = ' . $_GET['cat_id'] . ' |
---|
154 | ;'; |
---|
155 | $result = pwg_query($query); |
---|
156 | $q = ' |
---|
157 | INSERT INTO ' . $prefixeTable . 'meta_cat(id,metaKeycat,metadescat)VALUES (' . $_GET['cat_id'] . ',"' . $_POST['insermetaKA'] . '","' . $_POST['insermetaDA'] . '");'; |
---|
158 | pwg_query($q); |
---|
159 | |
---|
160 | $template->assign( |
---|
161 | array( |
---|
162 | 'metaCONTENT' => $_POST['insermetaKA'], |
---|
163 | 'metaCONTENT2' => $_POST['insermetaDA'], |
---|
164 | )); |
---|
165 | } |
---|
166 | } |
---|
167 | |
---|
168 | ?> |
---|