[9407] | 1 | <?php |
---|
[31456] | 2 | // +-----------------------------------------------------------------------+ |
---|
[32302] | 3 | // | Title plugin for piwigo by TEMMII | |
---|
[31456] | 4 | // +-----------------------------------------------------------------------+ |
---|
[32908] | 5 | // | Copyright(C) 2011 - 2023 ddtddt http://temmii.com/piwigo/ | |
---|
[31456] | 6 | // +-----------------------------------------------------------------------+ |
---|
| 7 | // | This program is free software; you can redistribute it and/or modify | |
---|
| 8 | // | it under the terms of the GNU General Public License as published by | |
---|
| 9 | // | the Free Software Foundation | |
---|
| 10 | // | | |
---|
| 11 | // | This program is distributed in the hope that it will be useful, but | |
---|
| 12 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
| 13 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
| 14 | // | General Public License for more details. | |
---|
| 15 | // | | |
---|
| 16 | // | You should have received a copy of the GNU General Public License | |
---|
| 17 | // | along with this program; if not, write to the Free Software | |
---|
| 18 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
| 19 | // | USA. | |
---|
| 20 | // +-----------------------------------------------------------------------+ |
---|
| 21 | |
---|
[9407] | 22 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 23 | |
---|
| 24 | //add prefiltre photo |
---|
| 25 | add_event_handler('loc_begin_admin', 'titlePadminf',60); |
---|
[14975] | 26 | add_event_handler('loc_begin_admin_page', 'titlePadminA',60); |
---|
[9407] | 27 | |
---|
[32302] | 28 | function titlePadminf(){ |
---|
| 29 | global $template; |
---|
| 30 | $template->set_prefilter('picture_modify', 'titlePadminfT'); |
---|
| 31 | } |
---|
[9407] | 32 | |
---|
[32649] | 33 | function titlePadminfT($content){ |
---|
[32420] | 34 | $search = '#<input type="hidden" name="pwg_token"#'; |
---|
[9407] | 35 | $replacement = ' |
---|
[31456] | 36 | <p> |
---|
| 37 | <strong>{\'title_photo\'|@translate}</strong> |
---|
| 38 | <br> |
---|
[31795] | 39 | <textarea rows="4" cols="80" {if $useED==1}placeholder="{\'Use Extended Description tags...\'|@translate}"{/if} name="insertitleP" id="insertitleP" class="insertitleP">{$titleICONTENT}</textarea> |
---|
[31456] | 40 | </p> |
---|
| 41 | |
---|
[32420] | 42 | <input type="hidden" name="pwg_token"'; |
---|
[9407] | 43 | |
---|
| 44 | return preg_replace($search, $replacement, $content); |
---|
[32302] | 45 | } |
---|
[9407] | 46 | |
---|
[31456] | 47 | function titlePadminA(){ |
---|
| 48 | if (isset($_GET['image_id'])){ |
---|
[32302] | 49 | global $template, $prefixeTable, $pwg_loaded_plugins; |
---|
[31456] | 50 | $query = 'select id,title FROM ' . TITLE_PHOTO_TABLE . ' WHERE id = '.$_GET['image_id'].';'; |
---|
| 51 | $result = pwg_query($query); |
---|
| 52 | $row = pwg_db_fetch_assoc($result); |
---|
[32704] | 53 | if (isset($row['title'])){ |
---|
| 54 | $titleP=$row['title']; |
---|
| 55 | $template->assign( |
---|
| 56 | array( |
---|
| 57 | 'titleICONTENT' => $titleP, |
---|
| 58 | )); |
---|
[32908] | 59 | }else{ |
---|
| 60 | $template->assign( |
---|
| 61 | array( |
---|
| 62 | 'titleICONTENT' => "", |
---|
| 63 | )); |
---|
[32704] | 64 | } |
---|
[32302] | 65 | if (isset($pwg_loaded_plugins['ExtendedDescription'])){ |
---|
[31456] | 66 | $template->assign('useED',1); |
---|
| 67 | }else{ |
---|
| 68 | $template->assign('useED',0); |
---|
| 69 | } |
---|
[32704] | 70 | |
---|
[9407] | 71 | } |
---|
[31456] | 72 | if (isset($_POST['insertitleP'])){ |
---|
| 73 | $query = 'DELETE FROM ' . TITLE_PHOTO_TABLE . ' WHERE id = '.$_GET['image_id'].';'; |
---|
| 74 | $result = pwg_query($query); |
---|
| 75 | $q = 'INSERT INTO ' . $prefixeTable . 'title_photo(id,title)VALUES ('.$_GET['image_id'].',"'.$_POST['insertitleP'].'");'; |
---|
| 76 | pwg_query($q); |
---|
| 77 | $template->assign( |
---|
| 78 | array( |
---|
[31795] | 79 | 'titleICONTENT' => $_POST['insertitleP'], |
---|
[31456] | 80 | )); |
---|
| 81 | } |
---|
| 82 | } |
---|
[32994] | 83 | /* |
---|
[9407] | 84 | //add prefiltre album |
---|
[31456] | 85 | add_event_handler('loc_begin_admin', 'titleAadminf', 60); |
---|
| 86 | add_event_handler('loc_begin_admin_page', 'titleAadminA', 60); |
---|
[9407] | 87 | |
---|
| 88 | function titleAadminf() |
---|
| 89 | { |
---|
| 90 | global $template; |
---|
[14975] | 91 | $template->set_prefilter('album_properties', 'titleAadminfT'); |
---|
[9407] | 92 | } |
---|
| 93 | |
---|
[32649] | 94 | function titleAadminfT($content) |
---|
[9407] | 95 | { |
---|
[31456] | 96 | $search = '#<p style="margin:0">#'; |
---|
[9407] | 97 | |
---|
[14975] | 98 | $replacement = ' |
---|
[31456] | 99 | <p> |
---|
| 100 | <strong>{\'title_album\'|@translate}</strong> |
---|
| 101 | <br> |
---|
| 102 | <textarea rows="4" cols="80" {if $useED==1}placeholder="{\'Use Extended Description tags...\'|@translate}"{/if} name="insertitleA" id="insertitleA" class="insertitleA">{$titleCONTENT}</textarea> |
---|
| 103 | </p> |
---|
| 104 | |
---|
| 105 | |
---|
| 106 | <p style="margin:0">'; |
---|
[9407] | 107 | |
---|
| 108 | return preg_replace($search, $replacement, $content); |
---|
| 109 | } |
---|
| 110 | |
---|
[31456] | 111 | function titleAadminA(){ |
---|
| 112 | if (isset($_GET['cat_id'])){ |
---|
[32302] | 113 | global $template, $prefixeTable, $pwg_loaded_plugins; |
---|
[31456] | 114 | $query = 'select id,title FROM ' . TITLE_ALBUM_TABLE . ' WHERE id = '.$_GET['cat_id'].';'; |
---|
| 115 | $result = pwg_query($query); |
---|
| 116 | $row = pwg_db_fetch_assoc($result); |
---|
[32704] | 117 | if (isset($row['title'])){ |
---|
| 118 | $titleA=$row['title']; |
---|
| 119 | $template->assign( |
---|
| 120 | array( |
---|
| 121 | 'titleCONTENT' => $titleA, |
---|
| 122 | )); |
---|
[32908] | 123 | }else{ |
---|
| 124 | $template->assign( |
---|
| 125 | array( |
---|
| 126 | 'titleCONTENT' => "", |
---|
| 127 | )); |
---|
[32704] | 128 | } |
---|
[32302] | 129 | if (isset($pwg_loaded_plugins['ExtendedDescription'])){ |
---|
[31456] | 130 | $template->assign('useED',1); |
---|
| 131 | }else{ |
---|
| 132 | $template->assign('useED',0); |
---|
| 133 | } |
---|
[32704] | 134 | |
---|
[31456] | 135 | } |
---|
| 136 | if (isset($_POST['insertitleA'])){ |
---|
| 137 | $query = 'DELETE FROM ' . TITLE_ALBUM_TABLE . ' WHERE id = '.$_GET['cat_id'].';'; |
---|
| 138 | $result = pwg_query($query); |
---|
| 139 | $q = 'INSERT INTO ' . $prefixeTable . 'title_album(id,title)VALUES ('.$_GET['cat_id'].',"'.$_POST['insertitleA'].'");'; |
---|
[9407] | 140 | pwg_query($q); |
---|
[31456] | 141 | $template->assign( |
---|
| 142 | array( |
---|
| 143 | 'titleCONTENT' => $_POST['insertitleA'], |
---|
| 144 | )); |
---|
[9407] | 145 | } |
---|
[31456] | 146 | } |
---|
[32994] | 147 | */ |
---|
[9407] | 148 | ?> |
---|