[12496] | 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); |
---|
| 18 | add_event_handler('loc_begin_admin', 'metaPadminA',55); |
---|
| 19 | |
---|
| 20 | function metaPadminf() |
---|
| 21 | { |
---|
| 22 | global $template; |
---|
| 23 | $template->set_prefilter('picture_modify', 'metaPadminfT'); |
---|
| 24 | } |
---|
| 25 | |
---|
| 26 | function metaPadminfT($content, &$smarty) |
---|
| 27 | { |
---|
| 28 | $search = '#<form id="associations"#'; |
---|
| 29 | |
---|
| 30 | $replacement = ' |
---|
| 31 | <div> |
---|
| 32 | <form method="post" > |
---|
| 33 | <fieldset> |
---|
| 34 | <br> |
---|
| 35 | <legend>{\'Metadata - Plugin meta\'|@translate}</legend> |
---|
| 36 | {\'meta_compimg\'|@translate} : <input type="text" name="inser" value="{$metaCONTENT}" size="110" maxlenght="110"> |
---|
| 37 | <br> |
---|
| 38 | <br> |
---|
| 39 | {\'meta_compimgdes\'|@translate} : <input type="text" name="inser2" value="{$metaCONTENT2}" size="110" maxlenght="110"> |
---|
| 40 | ({\'meta_compcatdeshelp\'|@translate}) |
---|
| 41 | <br> |
---|
| 42 | <br> |
---|
| 43 | <div style="text-align:center;"> |
---|
| 44 | <input class="submit" name="submetaphoto" type="submit" value="{\'meta_inscat\'|@translate}" {$TAG_INPUT_ENABLED} /> |
---|
| 45 | </div> |
---|
| 46 | </fieldset> |
---|
| 47 | </form> |
---|
| 48 | </div> |
---|
| 49 | <form id="associations"'; |
---|
| 50 | |
---|
| 51 | return preg_replace($search, $replacement, $content); |
---|
| 52 | } |
---|
| 53 | |
---|
| 54 | function metaPadminA() |
---|
| 55 | { |
---|
| 56 | load_language('plugin.lang', meta_PATH); |
---|
| 57 | if (isset($_GET['image_id'])) |
---|
| 58 | { |
---|
| 59 | global $template, $prefixeTable; |
---|
| 60 | $query = ' |
---|
| 61 | select id,metaKeyimg,metadesimg |
---|
| 62 | FROM ' . meta_img_TABLE . ' |
---|
| 63 | WHERE id = '.$_GET['image_id'].' |
---|
| 64 | ;'; |
---|
| 65 | $result = pwg_query($query); |
---|
| 66 | $row = mysql_fetch_array($result); |
---|
| 67 | $chvalimg=$row['metaKeyimg']; |
---|
| 68 | $chvalimgdes=$row['metadesimg']; |
---|
| 69 | |
---|
| 70 | $template->assign( |
---|
| 71 | array( |
---|
| 72 | 'metaCONTENT' => $chvalimg, |
---|
| 73 | 'metaCONTENT2' => $chvalimgdes, |
---|
| 74 | )); |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | if (isset($_POST['submetaphoto'])) |
---|
| 78 | { |
---|
| 79 | $query = ' |
---|
| 80 | DELETE |
---|
| 81 | FROM ' . meta_img_TABLE . ' |
---|
| 82 | WHERE id = '.$_GET['image_id'].' |
---|
| 83 | ;'; |
---|
| 84 | $result = pwg_query($query); |
---|
| 85 | $q = ' |
---|
| 86 | INSERT INTO ' . $prefixeTable . 'meta_img(id,metaKeyimg,metadesimg)VALUES ('.$_GET['image_id'].',"'.$_POST['inser'].'","'.$_POST['inser2'].'");'; |
---|
| 87 | pwg_query($q); |
---|
| 88 | |
---|
| 89 | $template->assign( |
---|
| 90 | array( |
---|
| 91 | 'metaCONTENT' => $_POST['inser'], |
---|
| 92 | 'metaCONTENT2' => $_POST['inser2'], |
---|
| 93 | )); |
---|
| 94 | } |
---|
| 95 | } |
---|
| 96 | |
---|
| 97 | //add prefiltre album |
---|
| 98 | add_event_handler('loc_end_cat_modify', 'metaAadminf'); |
---|
| 99 | add_event_handler('loc_end_cat_modify', 'metaAadminA'); |
---|
| 100 | |
---|
| 101 | function metaAadminf() |
---|
| 102 | { |
---|
| 103 | global $template; |
---|
| 104 | $template->set_prefilter('categories', 'metaAadminfT'); |
---|
| 105 | } |
---|
| 106 | |
---|
| 107 | function metaAadminfT($content, &$smarty) |
---|
| 108 | { |
---|
| 109 | $search = '#name="reset"> |
---|
| 110 | </p>#'; |
---|
| 111 | |
---|
| 112 | $replacement = 'name="reset"> |
---|
| 113 | </p> |
---|
| 114 | |
---|
| 115 | <div> |
---|
| 116 | <form method="post" > |
---|
| 117 | <fieldset> |
---|
| 118 | <legend>{\'Metadata - Plugin meta\'|@translate}</legend> |
---|
| 119 | {\'meta_compcat\'|@translate} : <input type="text" name="inser" value="{$metaCONTENT}" size="110" maxlenght="110"> |
---|
| 120 | <br> |
---|
| 121 | <br> |
---|
| 122 | {\'meta_compcatdes\'|@translate} : <input type="text" name="inser2" value="{$metaCONTENT2}" size="110" maxlenght="110"> : ({\'meta_compcatdeshelp\'|@translate}) |
---|
| 123 | <br> |
---|
| 124 | <br> |
---|
| 125 | <div style="text-align:center;"> |
---|
| 126 | <input class="submit" name="submetaalbum" type="submit" value="{\'meta_inscat\'|@translate}" {$TAG_INPUT_ENABLED} /> |
---|
| 127 | </div> |
---|
| 128 | </fieldset> |
---|
| 129 | </form> |
---|
| 130 | </div> |
---|
| 131 | '; |
---|
| 132 | |
---|
| 133 | return preg_replace($search, $replacement, $content); |
---|
| 134 | } |
---|
| 135 | |
---|
| 136 | function metaAadminA() |
---|
| 137 | { |
---|
| 138 | load_language('plugin.lang', meta_PATH); |
---|
| 139 | if (isset($_GET['cat_id'])) |
---|
| 140 | { |
---|
| 141 | global $template, $prefixeTable; |
---|
| 142 | $query = ' |
---|
| 143 | select id,metaKeycat,metadescat |
---|
| 144 | FROM ' . meta_cat_TABLE . ' |
---|
| 145 | WHERE id = '.$_GET['cat_id'].' |
---|
| 146 | ;'; |
---|
| 147 | $result = pwg_query($query); |
---|
| 148 | $row = mysql_fetch_array($result); |
---|
| 149 | $chvalcat=$row['metaKeycat']; |
---|
| 150 | $chvalcatdes=$row['metadescat']; |
---|
| 151 | |
---|
| 152 | $template->assign( |
---|
| 153 | array( |
---|
| 154 | 'metaCONTENT' => $chvalcat, |
---|
| 155 | 'metaCONTENT2' => $chvalcatdes, |
---|
| 156 | )); |
---|
| 157 | } |
---|
| 158 | |
---|
| 159 | if (isset($_POST['submetaalbum'])) |
---|
| 160 | { |
---|
| 161 | $query = ' |
---|
| 162 | DELETE |
---|
| 163 | FROM ' . meta_cat_TABLE . ' |
---|
| 164 | WHERE id = '.$_GET['cat_id'].' |
---|
| 165 | ;'; |
---|
| 166 | $result = pwg_query($query); |
---|
| 167 | $q = ' |
---|
| 168 | INSERT INTO ' . $prefixeTable . 'meta_cat(id,metaKeycat,metadescat)VALUES ('.$_GET['cat_id'].',"'.$_POST['inser'].'","'.$_POST['inser2'].'");'; |
---|
| 169 | pwg_query($q); |
---|
| 170 | |
---|
| 171 | $template->assign( |
---|
| 172 | array( |
---|
| 173 | 'metaCONTENT' => $_POST['inser'], |
---|
| 174 | 'metaCONTENT2' => $_POST['inser2'], |
---|
| 175 | )); |
---|
| 176 | } |
---|
| 177 | } |
---|
| 178 | |
---|
| 179 | ?> |
---|