[9407] | 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', 'title_admin_menu'); |
---|
| 7 | function title_admin_menu($menu) |
---|
| 8 | { |
---|
| 9 | array_push($menu, array( |
---|
| 10 | 'NAME' => 'Title', |
---|
| 11 | 'URL' => get_admin_plugin_menu_link(TITLE_PATH . 'admin/admin.php'))); |
---|
| 12 | return $menu; |
---|
| 13 | } |
---|
| 14 | |
---|
| 15 | |
---|
| 16 | //add prefiltre photo |
---|
| 17 | add_event_handler('loc_begin_admin', 'titlePadminf',60); |
---|
| 18 | add_event_handler('loc_begin_admin', 'titlePadminA',60); |
---|
| 19 | |
---|
| 20 | function titlePadminf() |
---|
| 21 | { |
---|
| 22 | global $template; |
---|
| 23 | $template->set_prefilter('picture_modify', 'titlePadminfT'); |
---|
| 24 | } |
---|
| 25 | |
---|
| 26 | function titlePadminfT($content, &$smarty) |
---|
| 27 | { |
---|
| 28 | $search = '#<form id="associations"#'; |
---|
| 29 | |
---|
| 30 | $replacement = ' |
---|
| 31 | <div> |
---|
| 32 | <form method="post" > |
---|
| 33 | <fieldset> |
---|
| 34 | <br> |
---|
| 35 | <legend>{\'Title - Plugin title\'|@translate}</legend> |
---|
| 36 | {\'title_photo\'|@translate} : <input type="text" name="inser" value="{$titleCONTENT}" size="110" maxlenght="110"> |
---|
| 37 | <br> |
---|
| 38 | <br> |
---|
| 39 | <div style="text-align:center;"> |
---|
| 40 | <input class="submit" name="subtitlephoto" type="submit" value="{\'title_insbase\'|@translate}" {$TAG_INPUT_ENABLED} /> |
---|
| 41 | </div> |
---|
| 42 | </fieldset> |
---|
| 43 | </form> |
---|
| 44 | </div> |
---|
| 45 | <form id="associations"'; |
---|
| 46 | |
---|
| 47 | return preg_replace($search, $replacement, $content); |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | function titlePadminA() |
---|
| 51 | { |
---|
| 52 | load_language('plugin.lang', TITLE_PATH); |
---|
| 53 | if (isset($_GET['image_id'])) |
---|
| 54 | { |
---|
| 55 | global $template, $prefixeTable; |
---|
| 56 | $query = ' |
---|
| 57 | select id,title |
---|
| 58 | FROM ' . TITLE_PHOTO_TABLE . ' |
---|
| 59 | WHERE id = '.$_GET['image_id'].' |
---|
| 60 | ;'; |
---|
| 61 | $result = pwg_query($query); |
---|
| 62 | $row = mysql_fetch_array($result); |
---|
| 63 | $titleP=$row['title']; |
---|
| 64 | |
---|
| 65 | $template->assign( |
---|
| 66 | array( |
---|
| 67 | 'titleCONTENT' => $titleP, |
---|
| 68 | )); |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | if (isset($_POST['subtitlephoto'])) |
---|
| 72 | { |
---|
| 73 | $query = ' |
---|
| 74 | DELETE |
---|
| 75 | FROM ' . TITLE_PHOTO_TABLE . ' |
---|
| 76 | WHERE id = '.$_GET['image_id'].' |
---|
| 77 | ;'; |
---|
| 78 | $result = pwg_query($query); |
---|
| 79 | $q = ' |
---|
| 80 | INSERT INTO ' . $prefixeTable . 'title_photo(id,title)VALUES ('.$_GET['image_id'].',"'.$_POST['inser'].'");'; |
---|
| 81 | pwg_query($q); |
---|
| 82 | |
---|
| 83 | $template->assign( |
---|
| 84 | array( |
---|
| 85 | 'titleCONTENT' => $_POST['inser'], |
---|
| 86 | )); |
---|
| 87 | } |
---|
| 88 | } |
---|
| 89 | |
---|
| 90 | //add prefiltre album |
---|
| 91 | add_event_handler('loc_end_cat_modify', 'titleAadminf', 60); |
---|
| 92 | add_event_handler('loc_end_cat_modify', 'titleAadminA', 60); |
---|
| 93 | |
---|
| 94 | function titleAadminf() |
---|
| 95 | { |
---|
| 96 | global $template; |
---|
| 97 | $template->set_prefilter('categories', 'titleAadminfT'); |
---|
| 98 | } |
---|
| 99 | |
---|
| 100 | function titleAadminfT($content, &$smarty) |
---|
| 101 | { |
---|
[9794] | 102 | $search = '#name="reset"> |
---|
| 103 | </p>#'; |
---|
[9407] | 104 | |
---|
[9794] | 105 | $replacement = 'name="reset"> |
---|
| 106 | </p> |
---|
| 107 | |
---|
| 108 | <div> |
---|
[9407] | 109 | <form method="post" > |
---|
| 110 | <fieldset> |
---|
| 111 | <br> |
---|
| 112 | <legend>{\'Title - Plugin title\'|@translate}</legend> |
---|
| 113 | {\'title_album\'|@translate} : <input type="text" name="inser" value="{$titleCONTENT}" size="110" maxlenght="110"> |
---|
| 114 | <br> |
---|
| 115 | <br> |
---|
| 116 | <div style="text-align:center;"> |
---|
| 117 | <input class="submit" name="subtitlealbum" type="submit" value="{\'title_insbase\'|@translate}" {$TAG_INPUT_ENABLED} /> |
---|
| 118 | </div> |
---|
| 119 | </fieldset> |
---|
| 120 | </form> |
---|
[9794] | 121 | </div> |
---|
[9407] | 122 | '; |
---|
| 123 | |
---|
| 124 | return preg_replace($search, $replacement, $content); |
---|
| 125 | } |
---|
| 126 | |
---|
| 127 | function titleAadminA() |
---|
| 128 | { |
---|
[9547] | 129 | load_language('plugin.lang', TITLE_PATH); |
---|
[9407] | 130 | if (isset($_GET['cat_id'])) |
---|
| 131 | { |
---|
| 132 | global $template, $prefixeTable; |
---|
| 133 | $query = ' |
---|
| 134 | select id,title |
---|
| 135 | FROM ' . TITLE_ALBUM_TABLE . ' |
---|
| 136 | WHERE id = '.$_GET['cat_id'].' |
---|
| 137 | ;'; |
---|
| 138 | $result = pwg_query($query); |
---|
| 139 | $row = mysql_fetch_array($result); |
---|
| 140 | $titleA=$row['title']; |
---|
| 141 | |
---|
| 142 | $template->assign( |
---|
| 143 | array( |
---|
| 144 | 'titleCONTENT' => $titleA, |
---|
| 145 | )); |
---|
| 146 | } |
---|
| 147 | |
---|
| 148 | if (isset($_POST['subtitlealbum'])) |
---|
| 149 | { |
---|
| 150 | $query = ' |
---|
| 151 | DELETE |
---|
| 152 | FROM ' . TITLE_ALBUM_TABLE . ' |
---|
| 153 | WHERE id = '.$_GET['cat_id'].' |
---|
| 154 | ;'; |
---|
| 155 | $result = pwg_query($query); |
---|
| 156 | $q = ' |
---|
| 157 | INSERT INTO ' . $prefixeTable . 'title_album(id,title)VALUES ('.$_GET['cat_id'].',"'.$_POST['inser'].'");'; |
---|
| 158 | pwg_query($q); |
---|
| 159 | |
---|
| 160 | $template->assign( |
---|
| 161 | array( |
---|
| 162 | 'titleCONTENT' => $_POST['inser'], |
---|
| 163 | )); |
---|
| 164 | } |
---|
| 165 | } |
---|
| 166 | |
---|
| 167 | ?> |
---|