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