[9152] | 1 | <?php |
---|
| 2 | |
---|
| 3 | //Ajout du menu admin |
---|
| 4 | add_event_handler('get_admin_plugin_menu_links', 'addinfo_admin_menu'); |
---|
[9155] | 5 | |
---|
[9152] | 6 | function addinfo_admin_menu($menu) |
---|
[9155] | 7 | { |
---|
[9152] | 8 | array_push($menu, array( |
---|
| 9 | 'NAME' => 'AddInfo', |
---|
| 10 | 'URL' => get_admin_plugin_menu_link(ADDINFO_PATH . 'admin/admin.php'))); |
---|
| 11 | return $menu; |
---|
[9155] | 12 | } |
---|
[9152] | 13 | |
---|
| 14 | //Ajout du prefiltre image |
---|
| 15 | |
---|
| 16 | add_event_handler('loc_begin_admin', 'Imodadminf',55); |
---|
| 17 | add_event_handler('loc_begin_admin', 'ImodadminA',55); |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | function Imodadminf() |
---|
[9155] | 21 | { |
---|
[9152] | 22 | global $template; |
---|
| 23 | $template->set_prefilter('picture_modify', 'ImodadminfT'); |
---|
[9155] | 24 | } |
---|
[9152] | 25 | |
---|
| 26 | function ImodadminfT($content, &$smarty) |
---|
[9155] | 27 | { |
---|
[9152] | 28 | |
---|
| 29 | load_language('plugin.lang', ADDINFO_PATH); |
---|
[9155] | 30 | load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) ); |
---|
[9152] | 31 | |
---|
| 32 | $search = '#<form id="associations"#'; |
---|
| 33 | |
---|
| 34 | $replacement = ' |
---|
| 35 | <form method="post" > |
---|
| 36 | <fieldset> |
---|
| 37 | <br> |
---|
| 38 | <legend>{\'addinfo_complete\'|@translate}</legend> |
---|
| 39 | {\'addinfo_info1\'|@translate} :<br> |
---|
| 40 | <input type="text" name="inser" value="{$AICONTENT}" size="110" maxlenght="110"> |
---|
| 41 | <br> |
---|
| 42 | <br> |
---|
| 43 | {\'addinfo_info2\'|@translate} :<br> |
---|
| 44 | <input type="text" name="inser2" value="{$AICONTENT2}" size="110" maxlenght="110"> |
---|
| 45 | <br> |
---|
| 46 | <br> |
---|
| 47 | {\'addinfo_info3\'|@translate} :<br> |
---|
| 48 | <input type="text" name="inser3" value="{$AICONTENT3}" size="110" maxlenght="110"> |
---|
| 49 | <br> |
---|
| 50 | <br> |
---|
| 51 | <div style="text-align:center;"> |
---|
| 52 | <input class="submit" name="submitinsimg" type="submit" value="{\'addinfo_insing\'|@translate}" {$TAG_INPUT_ENABLED} /> |
---|
| 53 | </div> |
---|
| 54 | </fieldset> |
---|
| 55 | </form> |
---|
| 56 | <form id="associations"'; |
---|
| 57 | |
---|
| 58 | return preg_replace($search, $replacement, $content); |
---|
[9155] | 59 | } |
---|
[9152] | 60 | |
---|
| 61 | function ImodadminA() |
---|
[9155] | 62 | { |
---|
[9152] | 63 | if (isset($_GET['image_id'])) |
---|
| 64 | { |
---|
| 65 | $query = ' |
---|
| 66 | select id,info1,info2,info3 |
---|
| 67 | FROM ' . ADDINFO_TABLE . ' |
---|
| 68 | WHERE id = '.$_GET['image_id'].' |
---|
| 69 | ;'; |
---|
| 70 | $result = pwg_query($query); |
---|
| 71 | $row = mysql_fetch_array($result); |
---|
| 72 | $idaddinfo=$row['id']; |
---|
| 73 | $info1=$row['info1']; |
---|
| 74 | $info2=$row['info2']; |
---|
| 75 | $info3=$row['info3']; |
---|
[9155] | 76 | |
---|
[9152] | 77 | global $template, $prefixeTable; |
---|
| 78 | |
---|
| 79 | $template->assign( |
---|
| 80 | array( |
---|
| 81 | //'AIVALUE' => $idaddinfo, |
---|
| 82 | 'AICONTENT' => $info1, |
---|
| 83 | 'AICONTENT2' => $info2, |
---|
| 84 | 'AICONTENT3' => $info3, |
---|
| 85 | )); |
---|
[9155] | 86 | } |
---|
[9152] | 87 | |
---|
| 88 | if (isset($_POST['submitinsimg'])) |
---|
[9155] | 89 | { |
---|
[9152] | 90 | $query = ' |
---|
| 91 | DELETE |
---|
| 92 | FROM ' . ADDINFO_TABLE . ' |
---|
| 93 | WHERE id = '.$_GET['image_id'].' |
---|
| 94 | ;'; |
---|
| 95 | $result = pwg_query($query); |
---|
| 96 | $q = ' |
---|
| 97 | INSERT INTO ' . $prefixeTable . 'AddInfo_images(id,info1,info2,info3)VALUES ('.$_GET['image_id'].',"'.$_POST['inser'].'","'.$_POST['inser2'].'","'.$_POST['inser3'].'");'; |
---|
| 98 | pwg_query($q); |
---|
| 99 | |
---|
| 100 | $template->assign( |
---|
| 101 | array( |
---|
| 102 | 'AICONTENT' => $_POST['inser'], |
---|
| 103 | 'AICONTENT2' => $_POST['inser2'], |
---|
| 104 | 'AICONTENT3' => $_POST['inser3'], |
---|
| 105 | )); |
---|
[9155] | 106 | } |
---|
[9152] | 107 | } |
---|
| 108 | ?> |
---|