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