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