[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 | $search = '#<form id="associations"#'; |
---|
| 30 | |
---|
| 31 | $replacement = ' |
---|
| 32 | <form method="post" > |
---|
| 33 | <fieldset> |
---|
| 34 | <br> |
---|
| 35 | <legend>{\'addinfo_complete\'|@translate}</legend> |
---|
| 36 | {\'addinfo_info1\'|@translate} :<br> |
---|
| 37 | <input type="text" name="inser" value="{$AICONTENT}" size="110" maxlenght="110"> |
---|
| 38 | <br> |
---|
| 39 | <br> |
---|
| 40 | {\'addinfo_info2\'|@translate} :<br> |
---|
| 41 | <input type="text" name="inser2" value="{$AICONTENT2}" size="110" maxlenght="110"> |
---|
| 42 | <br> |
---|
| 43 | <br> |
---|
| 44 | {\'addinfo_info3\'|@translate} :<br> |
---|
| 45 | <input type="text" name="inser3" value="{$AICONTENT3}" size="110" maxlenght="110"> |
---|
| 46 | <br> |
---|
| 47 | <br> |
---|
| 48 | <div style="text-align:center;"> |
---|
[9405] | 49 | <input class="submit" name="subaddinfo" type="submit" value="{\'addinfo_insing\'|@translate}" {$TAG_INPUT_ENABLED} /> |
---|
[9152] | 50 | </div> |
---|
| 51 | </fieldset> |
---|
| 52 | </form> |
---|
| 53 | <form id="associations"'; |
---|
| 54 | |
---|
| 55 | return preg_replace($search, $replacement, $content); |
---|
[9155] | 56 | } |
---|
[9152] | 57 | |
---|
| 58 | function ImodadminA() |
---|
[9405] | 59 | { |
---|
| 60 | |
---|
| 61 | load_language('plugin.lang', ADDINFO_PATH); |
---|
| 62 | load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) ); |
---|
| 63 | |
---|
[9152] | 64 | if (isset($_GET['image_id'])) |
---|
| 65 | { |
---|
| 66 | $query = ' |
---|
| 67 | select id,info1,info2,info3 |
---|
| 68 | FROM ' . ADDINFO_TABLE . ' |
---|
| 69 | WHERE id = '.$_GET['image_id'].' |
---|
| 70 | ;'; |
---|
| 71 | $result = pwg_query($query); |
---|
| 72 | $row = mysql_fetch_array($result); |
---|
| 73 | $idaddinfo=$row['id']; |
---|
| 74 | $info1=$row['info1']; |
---|
| 75 | $info2=$row['info2']; |
---|
| 76 | $info3=$row['info3']; |
---|
[9155] | 77 | |
---|
[9152] | 78 | global $template, $prefixeTable; |
---|
| 79 | |
---|
| 80 | $template->assign( |
---|
| 81 | array( |
---|
| 82 | //'AIVALUE' => $idaddinfo, |
---|
[9260] | 83 | 'AICONTENT' => htmlspecialchars($info1), |
---|
| 84 | 'AICONTENT2' => htmlspecialchars($info2), |
---|
| 85 | 'AICONTENT3' => htmlspecialchars($info3), |
---|
[9152] | 86 | )); |
---|
[9155] | 87 | } |
---|
[9152] | 88 | |
---|
[9405] | 89 | if (isset($_POST['subaddinfo'])) |
---|
[9155] | 90 | { |
---|
[9152] | 91 | $query = ' |
---|
| 92 | DELETE |
---|
| 93 | FROM ' . ADDINFO_TABLE . ' |
---|
| 94 | WHERE id = '.$_GET['image_id'].' |
---|
| 95 | ;'; |
---|
| 96 | $result = pwg_query($query); |
---|
| 97 | $q = ' |
---|
| 98 | INSERT INTO ' . $prefixeTable . 'AddInfo_images(id,info1,info2,info3)VALUES ('.$_GET['image_id'].',"'.$_POST['inser'].'","'.$_POST['inser2'].'","'.$_POST['inser3'].'");'; |
---|
| 99 | pwg_query($q); |
---|
| 100 | |
---|
[9260] | 101 | $query = ' |
---|
| 102 | select id,info1,info2,info3 |
---|
| 103 | FROM ' . ADDINFO_TABLE . ' |
---|
| 104 | WHERE id = '.$_GET['image_id'].' |
---|
| 105 | ;'; |
---|
| 106 | $result = pwg_query($query); |
---|
| 107 | $row = mysql_fetch_array($result); |
---|
| 108 | $idaddinfo=$row['id']; |
---|
| 109 | $info1=$row['info1']; |
---|
| 110 | $info2=$row['info2']; |
---|
| 111 | $info3=$row['info3']; |
---|
| 112 | |
---|
| 113 | $template->assign( |
---|
[9152] | 114 | array( |
---|
[9260] | 115 | //'AIVALUE' => $idaddinfo, |
---|
| 116 | 'AICONTENT' => htmlspecialchars($info1), |
---|
| 117 | 'AICONTENT2' => htmlspecialchars($info2), |
---|
| 118 | 'AICONTENT3' => htmlspecialchars($info3), |
---|
[9152] | 119 | )); |
---|
[9155] | 120 | } |
---|
[9152] | 121 | } |
---|
| 122 | ?> |
---|