Changeset 32135
- Timestamp:
- Apr 28, 2020, 2:37:00 AM (4 years ago)
- Location:
- extensions/manage_properties_photos
- Files:
-
- 4 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/manage_properties_photos/admin.php
r31409 r32135 1 1 <?php 2 2 // +-----------------------------------------------------------------------+ 3 // | Manage Properties Photos plugin for Piwigo 4 // +-----------------------------------------------------------------------+ 5 // | Copyright(C) 20 14-2016ddtddt http://temmii.com/piwigo/ |3 // | Manage Properties Photos plugin for Piwigo by TEMMII | 4 // +-----------------------------------------------------------------------+ 5 // | Copyright(C) 2007-2020 ddtddt http://temmii.com/piwigo/ | 6 6 // +-----------------------------------------------------------------------+ 7 7 // | This program is free software; you can redistribute it and/or modify | … … 33 33 34 34 //-------------------------------------------------------- sections definitions 35 36 $template->assign(array( 37 'ADD_PROP_PHOTO_PATH'=> get_root_url() . ADD_PROP_PHOTO_PATH, 38 )); 39 40 35 41 if (!isset($_GET['tab'])) 36 42 $page['tab'] = 'define_properties'; … … 42 48 $tabsheet = new tabsheet(); 43 49 $tabsheet->add('addip', l10n('Property'), ADD_PROP_PHOTO_ADMIN . '-define_properties'); 50 $tabsheet->add('config', l10n('Configuration'), ADD_PROP_PHOTO_ADMIN . '-config'); 44 51 $tabsheet->select($page['tab']); 45 52 $tabsheet->assign(); … … 67 74 )); 68 75 69 $PAED = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'ExtendedDescription';")); 70 if($PAED['state'] == 'active'){ 76 if (isset($pwg_loaded_plugins['ExtendedDescription'])){ 71 77 add_event_handler('AP_render_content', 'get_user_language_desc'); 72 78 $template->assign('useED',1); … … 78 84 if (pwg_db_num_rows($tab_add_info_one_photo)) { 79 85 while ($info_photos = pwg_db_fetch_assoc($tab_add_info_one_photo)) { 80 81 $d = data_info_photos($id_img, $info_photos['id_prop_pho']); 82 $row = pwg_db_fetch_assoc($d); 83 84 $items = array( 85 'IDPHO' => $_GET['image_id'], 86 'IDINFOPHO' => $info_photos['id_prop_pho'], 87 'AIPWORDING' => trigger_change('AP_render_content',$info_photos['wording']), 88 'AIPDATA' => $row['data'], 89 ); 90 86 if($info_photos['Typ']==2){ 87 $d = data_info_photosdate($id_img, $info_photos['id_prop_pho']); 88 $row = pwg_db_fetch_assoc($d); 89 90 $items = array( 91 'IDPHO' => $_GET['image_id'], 92 'IDINFOPHO' => $info_photos['id_prop_pho'], 93 'AIPWORDING' => trigger_change('AP_render_content',$info_photos['wording']), 94 'AIPDATA' => $row['datadate'], 95 'AIPTYP' => $info_photos['Typ'], 96 ); 97 if($info_photos['wording']=="**delpho**"){ 98 $items['AIPWORDING'] =l10n('Delete photo'); 99 } 100 }else{ 101 $d = data_info_photos($id_img, $info_photos['id_prop_pho']); 102 $row = pwg_db_fetch_assoc($d); 103 104 $items = array( 105 'IDPHO' => $_GET['image_id'], 106 'IDINFOPHO' => $info_photos['id_prop_pho'], 107 'AIPWORDING' => trigger_change('AP_render_content',$info_photos['wording']), 108 'AIPDATA' => $row['data'], 109 'AIPTYP' => $info_photos['Typ'], 110 ); 111 if($info_photos['Typ']==4||$info_photos['Typ']==5){ 112 $items['AIPSELECT']=unserialize($info_photos['dataprop']); 113 foreach ($items['AIPSELECT'] as $key => $dataselect){ 114 $items['AIPSELECTTRANS'][] = trigger_change('AP_render_content',$dataselect); 115 } 116 } 117 } 91 118 $template->append('info_photos', $items); 92 119 } … … 109 136 $query = 'INSERT ' . $prefixeTable . 'add_properties_photos_data(id_img,id_prop_pho,data) VALUES (' . $id_img . ',' . $id_prop_pho . ',"' . $data . '");'; 110 137 pwg_query($query); 111 } 112 138 } 139 } 140 foreach ($_POST['datadate'] AS $id_prop_pho => $data) { 141 $q = 'SELECT 1 FROM ' . ADD_PROP_PHOTO_DATADATE_TABLE . ' WHERE id_img=' . $id_img . ' AND id_prop_pho=' . $id_prop_pho; 142 $test = pwg_query($q); 143 $row = pwg_db_fetch_assoc($test); 144 if (count($row) > 0) { 145 if ($data != '') { 146 $query = 'UPDATE ' . $prefixeTable . 'add_properties_photos_datadate SET datadate="' . $data . '" WHERE id_img=' . $id_img . ' AND id_prop_pho=' . $id_prop_pho; 147 pwg_query($query); 148 } else { 149 $query = 'DELETE FROM ' . $prefixeTable . 'add_properties_photos_datadate WHERE id_img=' . $id_img . ' AND id_prop_pho=' . $id_prop_pho; 150 pwg_query($query); 151 } 152 } else if ($data != '') { 153 $query = 'INSERT ' . $prefixeTable . 'add_properties_photos_datadate(id_img,id_prop_pho,datadate) VALUES (' . $id_img . ',' . $id_prop_pho . ',"' . $data . '");'; 154 pwg_query($query); 155 } 113 156 } 114 157 $redirect_url = ADD_PROP_PHOTO_ADMIN . '-iap&image_id=' . $id_img; … … 122 165 $admin_base_url = ADD_PROP_PHOTO_ADMIN . '-define_properties'; 123 166 $template->assign( 124 'addinfotemplate', array( 125 'addinfo' => l10n('addinfo'), 126 )); 127 128 $PAED = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'ExtendedDescription';")); 129 if($PAED['state'] == 'active'){ 167 'addinfotemplate', array( 168 'addinfo' => l10n('addinfo'), 169 )); 170 $maxfields = (isset($conf['mpp_max_fields'])) ? $conf['mpp_max_fields'] : '5'; 171 $template->assign('MPPMAXFIELD',$maxfields); 172 173 if (isset($pwg_loaded_plugins['ExtendedDescription'])){ 130 174 add_event_handler('AP_render_content', 'get_user_language_desc'); 131 175 $template->assign('useED',1); … … 139 183 if (pwg_db_num_rows($tab_info_photos)) { 140 184 while ($info_photos = pwg_db_fetch_assoc($tab_info_photos)) { 185 $items = array( 186 'IDINFOPHO' => $info_photos['id_prop_pho'], 187 'AIPORDER' => $info_photos['orderprop'], 188 'AIPACTIVE' => $info_photos['active'], 189 'AIPEDIT' => $info_photos['edit'], 190 'U_HIDE' => $admin_base_url . '&hide=' . $info_photos['id_prop_pho'], 191 'U_SHOW' => $admin_base_url . '&show=' . $info_photos['id_prop_pho'] 192 ); 141 193 if($info_photos['id_prop_pho']==1){ 142 $items = array( 143 'IDINFOPHO' => $info_photos['id_prop_pho'], 144 'AIPWORDING' => l10n('Author'), 145 'AIPORDER' => $info_photos['orderprop'], 146 'AIPACTIVE' => $info_photos['active'], 147 'AIPEDIT' => $info_photos['edit'], 148 'U_HIDE' => $admin_base_url . '&hide=' . $info_photos['id_prop_pho'], 149 'U_SHOW' => $admin_base_url . '&show=' . $info_photos['id_prop_pho'], 150 ); 194 $items['AIPWORDING'] = l10n('Author'); 151 195 }else if($info_photos['id_prop_pho']==2){ 152 $items = array( 153 'IDINFOPHO' => $info_photos['id_prop_pho'], 154 'AIPWORDING' => l10n('Created on'), 155 'AIPORDER' => $info_photos['orderprop'], 156 'AIPACTIVE' => $info_photos['active'], 157 'AIPEDIT' => $info_photos['edit'], 158 'U_HIDE' => $admin_base_url . '&hide=' . $info_photos['id_prop_pho'], 159 'U_SHOW' => $admin_base_url . '&show=' . $info_photos['id_prop_pho'], 160 ); 196 $items['AIPWORDING'] = l10n('Created on'); 161 197 }else if($info_photos['id_prop_pho']==3){ 162 $items = array( 163 'IDINFOPHO' => $info_photos['id_prop_pho'], 164 'AIPWORDING' => l10n('Posted on'), 165 'AIPORDER' => $info_photos['orderprop'], 166 'AIPACTIVE' => $info_photos['active'], 167 'AIPEDIT' => $info_photos['edit'], 168 'U_HIDE' => $admin_base_url . '&hide=' . $info_photos['id_prop_pho'], 169 'U_SHOW' => $admin_base_url . '&show=' . $info_photos['id_prop_pho'], 170 ); 198 $items['AIPWORDING'] = l10n('Posted on'); 171 199 }else if($info_photos['id_prop_pho']==4){ 172 $items = array( 173 'IDINFOPHO' => $info_photos['id_prop_pho'], 174 'AIPWORDING' => l10n('Dimensions'), 175 'AIPORDER' => $info_photos['orderprop'], 176 'AIPACTIVE' => $info_photos['active'], 177 'AIPEDIT' => $info_photos['edit'], 178 'U_HIDE' => $admin_base_url . '&hide=' . $info_photos['id_prop_pho'], 179 'U_SHOW' => $admin_base_url . '&show=' . $info_photos['id_prop_pho'], 180 ); 200 $items['AIPWORDING'] = l10n('Dimensions'); 181 201 }else if($info_photos['id_prop_pho']==5){ 182 $items = array( 183 'IDINFOPHO' => $info_photos['id_prop_pho'], 184 'AIPWORDING' => l10n('File'), 185 'AIPORDER' => $info_photos['orderprop'], 186 'AIPACTIVE' => $info_photos['active'], 187 'AIPEDIT' => $info_photos['edit'], 188 'U_HIDE' => $admin_base_url . '&hide=' . $info_photos['id_prop_pho'], 189 'U_SHOW' => $admin_base_url . '&show=' . $info_photos['id_prop_pho'], 190 ); 202 $items['AIPWORDING'] = l10n('File'); 191 203 }else if($info_photos['id_prop_pho']==6){ 192 $items = array( 193 'IDINFOPHO' => $info_photos['id_prop_pho'], 194 'AIPWORDING' => l10n('Filesize'), 195 'AIPORDER' => $info_photos['orderprop'], 196 'AIPACTIVE' => $info_photos['active'], 197 'AIPEDIT' => $info_photos['edit'], 198 'U_HIDE' => $admin_base_url . '&hide=' . $info_photos['id_prop_pho'], 199 'U_SHOW' => $admin_base_url . '&show=' . $info_photos['id_prop_pho'], 200 ); 204 $items['AIPWORDING'] = l10n('Filesize'); 201 205 }else if($info_photos['id_prop_pho']==7){ 202 $items = array( 203 'IDINFOPHO' => $info_photos['id_prop_pho'], 204 'AIPWORDING' => l10n('Tags'), 205 'AIPORDER' => $info_photos['orderprop'], 206 'AIPACTIVE' => $info_photos['active'], 207 'AIPEDIT' => $info_photos['edit'], 208 'U_HIDE' => $admin_base_url . '&hide=' . $info_photos['id_prop_pho'], 209 'U_SHOW' => $admin_base_url . '&show=' . $info_photos['id_prop_pho'], 210 ); 206 $items['AIPWORDING'] = l10n('Tags'); 211 207 }else if($info_photos['id_prop_pho']==8){ 212 $items = array( 213 'IDINFOPHO' => $info_photos['id_prop_pho'], 214 'AIPWORDING' => l10n('Albums'), 215 'AIPORDER' => $info_photos['orderprop'], 216 'AIPACTIVE' => $info_photos['active'], 217 'AIPEDIT' => $info_photos['edit'], 218 'U_HIDE' => $admin_base_url . '&hide=' . $info_photos['id_prop_pho'], 219 'U_SHOW' => $admin_base_url . '&show=' . $info_photos['id_prop_pho'], 220 ); 208 $items['AIPWORDING'] = l10n('Albums'); 221 209 }else if($info_photos['id_prop_pho']==9){ 222 $items = array( 223 'IDINFOPHO' => $info_photos['id_prop_pho'], 224 'AIPWORDING' => l10n('Visits'), 225 'AIPORDER' => $info_photos['orderprop'], 226 'AIPACTIVE' => $info_photos['active'], 227 'AIPEDIT' => $info_photos['edit'], 228 'U_HIDE' => $admin_base_url . '&hide=' . $info_photos['id_prop_pho'], 229 'U_SHOW' => $admin_base_url . '&show=' . $info_photos['id_prop_pho'], 230 ); 210 $items['AIPWORDING'] = l10n('Visits'); 231 211 }else if($info_photos['id_prop_pho']==10){ 232 $items = array( 233 'IDINFOPHO' => $info_photos['id_prop_pho'], 234 'AIPWORDING' => l10n('Average'), 235 'AIPORDER' => $info_photos['orderprop'], 236 'AIPACTIVE' => $info_photos['active'], 237 'AIPEDIT' => $info_photos['edit'], 238 'U_HIDE' => $admin_base_url . '&hide=' . $info_photos['id_prop_pho'], 239 'U_SHOW' => $admin_base_url . '&show=' . $info_photos['id_prop_pho'], 240 ); 212 $items['AIPWORDING'] = l10n('Average'); 241 213 }else if($info_photos['id_prop_pho']==11){ 242 $items = array( 243 'IDINFOPHO' => $info_photos['id_prop_pho'], 244 'AIPWORDING' => l10n('Who can see this photo?'), 245 'AIPORDER' => $info_photos['orderprop'], 246 'AIPACTIVE' => $info_photos['active'], 247 'AIPEDIT' => $info_photos['edit'], 248 'U_HIDE' => $admin_base_url . '&hide=' . $info_photos['id_prop_pho'], 249 'U_SHOW' => $admin_base_url . '&show=' . $info_photos['id_prop_pho'], 250 ); 214 $items['AIPWORDING'] = l10n('Who can see this photo?'); 251 215 }else{ 252 $items = array( 253 'IDINFOPHO' => $info_photos['id_prop_pho'], 254 'AIPWORDING' => trigger_change('AP_render_content',$info_photos['wording']), 255 'AIPWORDING2' => $info_photos['wording'], 256 'AIPORDER' => $info_photos['orderprop'], 257 'AIPACTIVE' => $info_photos['active'], 258 'AIPEDIT' => $info_photos['edit'], 259 'U_DELETE' => $admin_base_url . '&delete=' . $info_photos['id_prop_pho'], 260 'U_HIDE' => $admin_base_url . '&hide=' . $info_photos['id_prop_pho'], 261 'U_SHOW' => $admin_base_url . '&show=' . $info_photos['id_prop_pho'], 262 ); 216 if($info_photos['dataprop']=="DeletePhoto" and $info_photos['wording'] ="**delpho**"){ 217 $items['AIPWORDING'] = l10n('Delete photo'); 218 }else{ 219 $items['AIPWORDING'] = trigger_change('AP_render_content',$info_photos['wording']); 220 } 221 $items['AIPWORDING2'] = $info_photos['wording']; 222 $items['U_DELETE'] = $admin_base_url . '&delete=' . $info_photos['id_prop_pho']; 223 $items['AIPTYP'] = $info_photos['Typ']; 224 if($info_photos['Typ']==4||$info_photos['Typ']==5){ 225 $items['AIPDATAPROP'] = json_encode(unserialize($info_photos['dataprop'])); 226 } 227 if($info_photos['Typ']==3||$info_photos['Typ']==6){ 228 $items['AIPDATAPROP'] = $info_photos['dataprop']; 229 } 263 230 } 264 231 $template->append('info_photos', $items); 265 232 } 233 234 $idexifone = pwg_db_fetch_assoc(pwg_query("SELECT MIN(id) as id FROM " . IMAGES_TABLE .";")); 235 $idexif = (isset($conf['mpp_idexif'])) ? $conf['mpp_idexif'] : $idexifone['id']; 236 $filename = pwg_db_fetch_assoc(pwg_query("SELECT path FROM " . IMAGES_TABLE . " WHERE id = '".$idexif."';")); 237 $exif = exif_read_data($filename['path']); 238 foreach ($exif as $key => $section){ 239 if(is_array($section)){ 240 $i=0; 241 foreach ($section as $name => $value){ 242 if($i==0){ 243 $items['RM_AFF'] = $key; 244 }else{ 245 $items['RM_AFF'] = ''; 246 } 247 $items['RM_SECTION'] = $key; 248 $items['RM_KEY'] = $name; 249 $template->append('rm_exif', $items); 250 $i++; 251 } 252 }else{ 253 $items['RM_SECTION'] = '1'; 254 $items['RM_KEY'] = $key; 255 $items['RM_VALUE'] = $section; 256 $template->append('rm_exif', $items); 257 } 258 } 259 $iptc_result = array(); 260 $imginfo = array(); 261 getimagesize($filename['path'], $imginfo); 262 if (isset ($imginfo['APP13'])){ 263 $iptc = iptcparse($imginfo['APP13']); 264 if (is_array($iptc)){ 265 foreach (array_keys($iptc) as $iptc_key){ 266 if (isset($iptc[$iptc_key][0])){ 267 $iptc_result[$iptc_key] = $value; 268 } 269 } 270 } 271 $keys = array_keys($iptc_result); 272 sort($keys); 273 foreach ($keys as $key){ 274 $items['RM_KEY'] = $key; 275 $template->append('rm_iptc', $items); 276 } 277 } 266 278 } 267 279 … … 283 295 284 296 if (isset($_POST['submitaddAIP'])) { 297 if ($_POST['inserwording'] == '') { 298 $_SESSION['page_errors'] = array(l10n('Wording isn\'t empty')); 299 redirect($admin_base_url); 300 } 301 if ($_POST['typ'] == '4'||$_POST['typ'] == '5') { 302 $select= serialize($_POST['mytext']); 303 } 304 if ($_POST['typ'] == '3') { 305 $select= $_POST['selectexif']; 306 } 307 if ($_POST['typ'] == '6') { 308 $select= $_POST['selectiptc']; 309 } 285 310 if (!isset($_POST['inseractive'])) { 286 311 $_POST['inseractive'] = 0; … … 290 315 $row = pwg_db_fetch_assoc($result); 291 316 $or = ($row['MAX(orderprop)'] + 1); 292 293 $q = ' 294 INSERT INTO ' . $prefixeTable . 'add_properties_photos(wording,orderprop,active,edit)VALUES ("' . $_POST['inserwording'] . '","' . $or . '","' . $_POST['inseractive'] . '",1);'; 295 pwg_query($q); 317 if ($_POST['typ'] == '4'||$_POST['typ'] == '3'||$_POST['typ'] == '5'||$_POST['typ'] == '6') { 318 $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(wording,orderprop,active,edit,Typ,dataprop)VALUES ("' . $_POST['inserwording'] . '","' . $or . '","' . $_POST['inseractive'] . '",1,"' . $_POST['typ'] . '",\''. $select .'\');'; 319 pwg_query($q); 320 }else{ 321 $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(wording,orderprop,active,edit,Typ)VALUES ("' . $_POST['inserwording'] . '","' . $or . '","' . $_POST['inseractive'] . '",1,"' . $_POST['typ'] . '");'; 322 pwg_query($q); 323 } 296 324 $_SESSION['page_infos'] = array(l10n('Property photo add')); 297 325 } else { 298 $q = ' 299 UPDATE ' . $prefixeTable . 'add_properties_photos' 326 if ($_POST['typ'] == '4'||$_POST['typ'] == '3'||$_POST['typ'] == '5'||$_POST['typ'] == '6') { 327 $q = ' 328 UPDATE ' . $prefixeTable . 'add_properties_photos' 329 . ' set wording ="' . $_POST['inserwording'] . '" ' 330 . ' ,active =' . $_POST['inseractive'] 331 . ' ,Typ =' . $_POST['typ'] 332 . ' ,dataprop =\'' . $select . '\' ' 333 . ' WHERE id_prop_pho=' . $_POST['invisibleID'] . ';'; 334 }else{ 335 $q = ' 336 UPDATE ' . $prefixeTable . 'add_properties_photos' 300 337 . ' set wording ="' . $_POST['inserwording'] . '" ' 301 338 . ' ,active=' . $_POST['inseractive'] 339 . ' ,Typ =' . $_POST['typ'] 302 340 . ' WHERE id_prop_pho=' . $_POST['invisibleID'] . ';'; 341 } 303 342 pwg_query($q); 304 343 $_SESSION['page_infos'] = array(l10n('Property photo update')); … … 313 352 $query = 'DELETE FROM ' . ADD_PROP_PHOTO_DATA_TABLE . ' WHERE id_prop_pho = ' . $_GET['delete'] . ';'; 314 353 pwg_query($query); 354 $query = 'DELETE FROM ' . ADD_PROP_PHOTO_DATADATE_TABLE . ' WHERE id_prop_pho = ' . $_GET['delete'] . ';'; 355 pwg_query($query); 315 356 316 357 $_SESSION['page_infos'] = array(l10n('Property delete')); … … 331 372 332 373 break; 374 case 'config': 375 $maxfields = (isset($conf['mpp_max_fields'])) ? $conf['mpp_max_fields'] : '5'; 376 $template->assign('MPPMAXFIELD',$maxfields); 377 $idexif = (isset($conf['mpp_idexif'])) ? $conf['mpp_idexif'] : ''; 378 $template->assign('MPPIDEXIF',$idexif); 379 $admin_base_url = ADD_PROP_PHOTO_ADMIN . '-config'; 380 $template->assign( 381 'mppconfig', array( 382 'a' => 'a', 383 )); 384 385 $delpho = pwg_db_fetch_assoc(pwg_query('SELECT dataprop FROM ' . ADD_PROP_PHOTO_TABLE.' WHERE dataprop="DeletePhoto";')); 386 if(empty($delpho)){ 387 $template->assign( 388 'mppconfig', array( 389 'ADDPHOAC' => 'actiondelphoadd', 390 )); 391 } 392 if (isset($_POST['submitadddelpho'])){ 393 $result = pwg_query('SELECT MAX(orderprop) FROM '. ADD_PROP_PHOTO_TABLE ); 394 $row = pwg_db_fetch_assoc($result); 395 $or = ($row['MAX(orderprop)'] + 1); 396 $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(wording,orderprop,active,edit,Typ,dataprop)VALUES ("**delpho**","' . $or . '","1",1,"2","DeletePhoto");'; 397 pwg_query($q); 398 header('Location:'.ADD_PROP_PHOTO_ADMIN . '-config'); 399 } 400 if (isset($_POST['submitremovedelpho'])){ 401 $iddelpho = pwg_db_fetch_assoc(pwg_query('SELECT id_prop_pho FROM '. ADD_PROP_PHOTO_TABLE.' where dataprop="DeletePhoto";')); 402 pwg_query('DELETE FROM ' . ADD_PROP_PHOTO_TABLE . ' where dataprop ="DeletePhoto";'); 403 $query = 'DELETE FROM ' . ADD_PROP_PHOTO_DATADATE_TABLE . ' WHERE id_prop_pho = ' . $iddelpho['id_prop_pho'] . ';'; 404 pwg_query($query); 405 header('Location:'.ADD_PROP_PHOTO_ADMIN . '-config'); 406 } 407 $descpho = pwg_db_fetch_assoc(pwg_query('SELECT dataprop FROM ' . ADD_PROP_PHOTO_TABLE.' WHERE dataprop="movedescription";')); 408 if(empty($descpho)){ 409 $vars['MOVEDESC']='actionmovedesc'; 410 $template->append('mppconfig', $vars, true); 411 } 412 if (isset($_POST['submitmovedesc'])){ 413 $result = pwg_query('SELECT MAX(orderprop) FROM '. ADD_PROP_PHOTO_TABLE ); 414 $row = pwg_db_fetch_assoc($result); 415 $or = ($row['MAX(orderprop)'] + 1); 416 $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(wording,orderprop,active,edit,Typ,dataprop)VALUES ("Description","' . $or . '","0",0,"1","movedescription");'; 417 pwg_query($q); 418 header('Location:'.ADD_PROP_PHOTO_ADMIN . '-config'); 419 } 420 if (isset($_POST['submitdefaultdesc'])){ 421 pwg_query('DELETE FROM ' . ADD_PROP_PHOTO_TABLE . ' where dataprop ="movedescription";'); 422 header('Location:'.ADD_PROP_PHOTO_ADMIN . '-config'); 423 } 424 if (isset($_POST['submitmppoption'])){ 425 conf_update_param('mpp_max_fields', $_POST['mppmaxfield']); 426 conf_update_param('mpp_idexif', $_POST['mppitidexif']); 427 header('Location:'.ADD_PROP_PHOTO_ADMIN . '-config'); 428 } 429 break; 333 430 } 334 431 -
extensions/manage_properties_photos/admin/admin.tpl
r31406 r32135 1 1 {combine_script id='jquery.ui.sortable' require='jquery.ui' load='footer' path='themes/default/js/ui/minified/jquery.ui.sortable.min.js'} 2 2 {combine_script id='core.scripts' load='async' path='themes/default/js/scripts.js'} 3 {combine_script id='jquery.timepicker' require='jquery.ui.datepicker,jquery.ui.slider' load='footer' path=$ADD_PROP_PHOTO_PATH|@cat:"js/jquery-ui-timepicker-addon.js"} 4 {assign var="datepicker_language" value="themes/default/js/ui/i18n/jquery.ui.datepicker-`$lang_info.code`.js"} 5 {if "PHPWG_ROOT_PATH"|@constant|@cat:$datepicker_language|@file_exists} 6 {combine_script id="jquery.ui.datepicker-$lang_info.code" load='footer' path=$datepicker_language} 7 {/if} 8 9 {combine_script id='jquery.chosen' load='footer' path='themes/default/js/plugins/chosen.jquery.min.js'} 10 {combine_css path="themes/default/js/plugins/chosen.css"} 11 12 {combine_css path="themes/default/js/ui/theme/jquery.ui.datepicker.css"} 13 {combine_css path="themes/default/js/ui/theme/jquery.ui.slider.css"} 14 15 3 16 {footer_script} 4 17 jQuery(document).ready(function(){ 18 19 var x = 1; 20 var max_fields = $("#hideid").data('maxfield'); 21 5 22 jQuery(".drag_button").show(); 6 23 jQuery(".categoryLi").css("cursor","move"); … … 41 58 jQuery('#hideid').val(0); 42 59 jQuery("textarea[name=inserwording]").focus(); 60 jQuery('input[name=typ]').val(['1']); 61 jQuery('#mppselect').hide(); 62 jQuery('#exifselect').hide(); 63 jQuery('#iptcselect').hide(); 64 43 65 }); 44 66 … … 51 73 var lib=$(this).data('lib'); 52 74 var hide=$(this).data('hide'); 75 var typ=$(this).data('typ'); 76 var dataprop=$(this).data('dataprop'); 77 if(typ=='4'){ 78 jQuery('#exifselect').hide(); 79 jQuery('#iptcselect').hide(); 80 jQuery('input[name=typ]').val(['4']); 81 jQuery('#mppselect').show(); 82 jQuery('#mytext5').parent('div').remove(); 83 jQuery('#mytext4').parent('div').remove(); 84 jQuery('#mytext3').parent('div').remove(); 85 jQuery('#mytext2').parent('div').remove(); 86 x = 1 87 for (key in dataprop){ 88 if(key==0){ 89 jQuery('#mytext1').val(dataprop[key]); 90 }else{ 91 x++; //text box increment 92 $(wrapper).append('<div><input type="text" id="mytext'+x+'" name="mytext[]" value="'+dataprop[key]+'"/><a href="#" class="remove_field"><span class="icon-trash"></span></a></div>'); 93 } 94 } 95 }else if(typ=='2'){ 96 jQuery('#iptcselect').hide(); 97 jQuery('#exifselect').hide(); 98 jQuery('input[name=typ]').val(['2']); 99 jQuery('#mppselect').hide(); 100 }else if(typ=='3'){ 101 jQuery('#iptcselect').hide(); 102 jQuery('#exifselect').show(); 103 jQuery('input[name=typ]').val(['3']); 104 jQuery('#mppselect').hide(); 105 jQuery('#selectexif').val(dataprop); 106 }else if(typ=='6'){ 107 jQuery('#iptcselect').show(); 108 jQuery('#exifselect').hide(); 109 jQuery('input[name=typ]').val(['6']); 110 jQuery('#mppselect').hide(); 111 jQuery('#selectiptc').val(dataprop); 112 }else if(typ=='5'){ 113 jQuery('#iptcselect').hide(); 114 jQuery('#exifselect').hide(); 115 jQuery('input[name=typ]').val(['5']); 116 jQuery('#mppselect').show(); 117 jQuery('#mytext5').parent('div').remove(); 118 jQuery('#mytext4').parent('div').remove(); 119 jQuery('#mytext3').parent('div').remove(); 120 jQuery('#mytext2').parent('div').remove(); 121 x = 1 122 for (key in dataprop){ 123 if(key==0){ 124 jQuery('#mytext1').val(dataprop[key]); 125 }else{ 126 x++; //text box increment 127 $(wrapper).append('<div><input type="text" id="mytext'+x+'" name="mytext[]" value="'+dataprop[key]+'"/><a href="#" class="remove_field"><span class="icon-trash"></span></a></div>'); 128 } 129 } 130 }else{ 131 jQuery('input[name=typ]').val(['1']); 132 jQuery('#mppselect').hide(); 133 jQuery('#exifselect').hide(); 134 } 53 135 jQuery("#add_info_edit").show(); 54 136 jQuery("#leg_add").hide(); … … 89 171 }); 90 172 }); 173 jQuery('.radtyp').change(function(){ 174 var typ=$(this).val(); 175 if(typ==1){ 176 jQuery('#mppselect').hide(); 177 jQuery('#exifselect').hide(); 178 jQuery('#wordingta').show(); 179 jQuery('#iptcselect').hide(); 180 } 181 if(typ==4||typ==5){ 182 jQuery('#mppselect').show(); 183 jQuery('#mytext1').val(''); 184 jQuery('#mytext5').parent('div').remove(); 185 jQuery('#mytext4').parent('div').remove(); 186 jQuery('#mytext3').parent('div').remove(); 187 jQuery('#mytext2').parent('div').remove(); 188 x = 1 189 jQuery('#exifselect').hide(); 190 jQuery('#wordingta').show(); 191 jQuery('#iptcselect').hide(); 192 } 193 if(typ==3){ 194 jQuery('#iptcselect').hide(); 195 jQuery('#mppselect').hide(); 196 jQuery('#exifselect').show(); 197 var exifval=jQuery('#selectexif').val(); 198 jQuery('#wordingta').show(); 199 if(jQuery('#aip_add').val()==''){ 200 jQuery('#aip_add').text(exifval); 201 } 202 } 203 if(typ==6){ 204 jQuery('#iptcselect').show(); 205 jQuery('#mppselect').hide(); 206 jQuery('#exifselect').hide(); 207 var iptcval=jQuery('#selectiptc').val(); 208 jQuery('#wordingta').show(); 209 if(jQuery('#aip_add').val()==''){ 210 jQuery('#aip_add').text(iptcval); 211 } 212 } 213 if(typ==2){ 214 jQuery('#iptcselect').hide(); 215 jQuery('#mppselect').hide(); 216 jQuery('#exifselect').hide(); 217 jQuery('#wordingta').show(); 218 } 219 }); 220 221 var exifval2=jQuery('#selectexif').val(); 222 jQuery('#selectexif').change(function(){ 223 var exifval=jQuery('#selectexif').val(); 224 if(jQuery('#aip_add').val()==''||jQuery('#aip_add').val()==exifval2){ 225 jQuery('#aip_add').text(exifval); 226 } 227 exifval2=exifval 228 }); 229 230 var max_fields = $("#hideid").data('maxfield'); 231 var wrapper = $(".input_fields_wrap"); 232 var add_button = $(".add_field_button"); 233 234 $(add_button).click(function(e){ 235 e.preventDefault(); 236 if(x < max_fields){ 237 x++; //text box increment 238 $(wrapper).append('<div><input id="mytext'+x+'" type="text" name="mytext[]"/><a href="#" class="remove_field"><span class="icon-trash"></a></div>'); 239 } 240 }); 241 242 $(wrapper).on("click",".remove_field", function(e){ 243 e.preventDefault(); $(this).parent('div').remove(); x--; 244 }) 245 246 $('.dateSelect').datetimepicker({ 247 numberOfMonths: 1, 248 changeMonth: true, 249 changeYear: true, 250 yearRange: "1900:+1", 251 dateFormat: "yy-mm-dd", 252 timeText: '{'selection'|@translate|escape:javascript}', 253 hourText: '{'Hour'|@translate|escape:javascript}', 254 minuteText: '{'Minute'|@translate|escape:javascript}', 255 currentText: '{'Now'|@translate|escape:javascript}', 256 closeText: '{'Validate'|@translate|escape:javascript}' 257 }); 258 91 259 }); 92 260 {/footer_script} … … 94 262 .mouse:hover{ 95 263 cursor:pointer; 264 } 265 .radtypspan{ 266 margin-right:40px; 96 267 } 97 268 {/html_style} … … 109 280 <fieldset> 110 281 <legend><span id="leg_add">{'Create new Property photo'|@translate}</span><span id="leg_edit">{'Edit Property photo'|@translate}</span></legend> 111 <input id="hideid" type="hidden" name="invisibleID" value="{$addinfo_edit2.AIPID}"> 112 <p class="input"> 282 <input id="hideid" data-maxfield="{$MPPMAXFIELD}" type="hidden" name="invisibleID" value="{$addinfo_edit2.AIPID}"></input> 283 <input class="radtyp" id="radtyptex" type="radio" name="typ" value="1"> <span class="radtypspan">{'Text'|@translate}</span></input> 284 <input class="radtyp" type="radio" name="typ" value="4"><span class="radtypspan"> {'select'|@translate}</span></input> 285 <input class="radtyp" type="radio" name="typ" value="5"><span class="radtypspan"> {'radio'|@translate}</span></input> 286 <input class="radtyp" type="radio" name="typ" value="2"><span class="radtypspan"> {'date'|@translate}</span></input> 287 <input class="radtyp" type="radio" name="typ" value="3"><span class="radtypspan"> {'exif'|@translate}</span></input> 288 <input class="radtyp" type="radio" name="typ" value="6"><span class="radtypspan"> {'IPTC'|@translate}</span></input> 289 290 291 <p id="wordingta" class="input"> 113 292 <label for="inserwording">{'Wording'|@translate}</label><br /> 114 293 <textarea {if $useED==1}placeholder="{'Use Extended Description tags...'|@translate}"{/if} style="margin-left:50px" rows="5" cols="50" class="description" name="inserwording" id="aip_add">{$addinfo_edit2.AIPDESC}</textarea> … … 120 299 <label for="inseractive">{'Hide'|@translate}</label> 121 300 <input id="aip_hide" type="checkbox" name="inseractive" {if {$addinfo_edit2.AIPACTIF}==1}checked{/if} value="1"> 122 <p class="actionButtons"> 301 </p> 302 <div id="mppselect" class="input_fields_wrap"> 303 <Span class="selectlabel">{'Option List'|@translate}</span><br> 304 <button class="add_field_button">{'Add Field'|@translate}</button> 305 <div><input type="text" id="mytext1" name="mytext[]"></div> 306 </div> 307 <div id="exifselect" class="exifselect"> 308 <select name="selectexif" id="selectexif"> 309 <option value="">-----</option> 310 {foreach from=$rm_exif item=rm} 311 {if isset($rm.RM_AFF) and $rm.RM_AFF!='1' and $rm.RM_AFF!=''}<optgroup label="{$rm.RM_AFF}"></optgroup>{/if} 312 <option value="{if isset ($rm.RM_SECTION) and ($rm.RM_SECTION)!='1'}{$rm.RM_SECTION}:{/if}{$rm.RM_KEY}">{if isset ($rm.RM_SECTION) and ($rm.RM_SECTION)!='1'} {/if}{$rm.RM_KEY}</option> 313 {/foreach} 314 </select>{if empty ($rm_exif)}<span style="margin: 0 0 0 20px">{'The reference photo doesn\'t have exif'|@translate}{/if} 315 </div> 316 <div id="iptcselect" class="iptcselect"> 317 <select name="selectiptc" id="selectiptc"> 318 <option value="">-----</option> 319 {foreach from=$rm_iptc item=rm} 320 <option value="{$rm.RM_KEY}">{$rm.RM_KEY}</option> 321 {/foreach} 322 </select>{if empty ($rm_iptc)}<span style="margin: 0 0 0 20px">{'The reference photo doesn\'t have IPTC'|@translate}{/if} 323 </div> 324 <p class="actionButtons"> 123 325 <input class="submit" name="submitaddAIP" type="submit" value="{'Submit'|@translate}" /> 124 326 <a href="#" id="addinfoClose">{'Cancel'|@translate}</a> … … 145 347 <span id="ppshow{$infophoto.IDINFOPHO}" {if ($infophoto.AIPACTIVE==0)}style="display: none"{/if}class="graphicalCheckbox icon-check mouse ppshow" data-id="{$infophoto.IDINFOPHO}" data-link2="{$infophoto.U_SHOW}">{'Hide'|@translate}</span> 146 348 {if ($infophoto.AIPEDIT==1)} 147 | <span class="edit_libinfo mouse icon-pencil" data-id="{$infophoto.IDINFOPHO}" data-lib="{$infophoto.AIPWORDING2}" data-hide="{$infophoto.AIPACTIVE}" />{'Edit'|@translate}</span>349 | <span class="edit_libinfo mouse icon-pencil" data-id="{$infophoto.IDINFOPHO}" data-lib="{$infophoto.AIPWORDING2}" data-hide="{$infophoto.AIPACTIVE}" data-typ="{$infophoto.AIPTYP}" data-dataprop='{$infophoto.AIPDATAPROP}' />{'Edit'|@translate}</span> 148 350 | <a href="{$infophoto.U_DELETE}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');"><span class="icon-trash"></span>{'delete'|@translate}</a> 149 351 {/if} … … 155 357 </fieldset> 156 358 </form> 359 {if $useED==1} 360 <a href="{$ROOT_URL}admin/popuphelp.php?page=extended_desc" onclick="popuphelp(this.href); return false;" title="{'Use Extended Description tags...'|translate}" style="vertical-align: middle; border: 0; margin: 0.5em;"><img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/help.png" class="button" alt="{'Use Extended Description tags...'|translate}'"></a> 361 {/if} 157 362 {/if} 158 363 {if isset ($gestionD)} … … 165 370 <tr> 166 371 <td style="width: 100px;"><span style="font-weight: bold; text-align: right;" >{$infophoto.AIPWORDING}</span></td> 167 <td><input type="text" size="150" maxlength="250" {if $useED==1}placeholder="{'Use Extended Description tags...'|@translate}"{/if} name="data[{$infophoto.IDINFOPHO}]" value="{$infophoto.AIPDATA}" /></td> 168 </tr> 372 {if $infophoto.AIPTYP==1} 373 <td><input data-typ="{$infophoto.AIPTYP}" type="text" size="150" maxlength="250" {if $useED==1}placeholder="{'Use Extended Description tags...'|@translate}"{/if} name="data[{$infophoto.IDINFOPHO}]" value="{$infophoto.AIPDATA}" /></td> 374 {/if} 375 {if $infophoto.AIPTYP==2} 376 <td><input type="text" class="dateSelect" id="dateSelect[{$infophoto.IDINFOPHO}]" name="datadate[{$infophoto.IDINFOPHO}]" style="width:120px;" value="{$infophoto.AIPDATA}"></td> 377 {/if} 378 {if $infophoto.AIPTYP==4} 379 <td>{html_options name="data[{$infophoto.IDINFOPHO}]" values=$infophoto.AIPSELECT output=$infophoto.AIPSELECTTRANS selected="{$infophoto.AIPDATA}"}</td> 380 {/if} 381 {if $infophoto.AIPTYP==5} 382 <td>{html_radios name="data[{$infophoto.IDINFOPHO}]" values=$infophoto.AIPSELECT output=$infophoto.AIPSELECTTRANS selected="{$infophoto.AIPDATA}" separator='<span style="margin: 0 0 0 10px"></span>'}</td> 383 {/if} 384 </tr> 169 385 {/foreach} 170 386 <tr style="text-align: right;"> … … 185 401 </div> 186 402 {/if} 403 404 {if isset($mppconfig)} 405 <fieldset> 406 <div style="text-align:left"> 407 <form method="post"> 408 {if isset($mppconfig.ADDPHOAC)} 409 <span style="margin: 0 0 0 20px"><input class="submit" name="submitadddelpho" type="submit" value="{'Add field for automatic deletion\'s photos on a given date'|@translate}" /> 410 {else} 411 <span style="margin: 0 0 0 20px"><input class="submit" name="submitremovedelpho" type="submit" value="{'Remove Field for automatic deletion\'s photos on a given date and all date save'|@translate}" /> 412 {/if} 413 <br> 414 <br> 415 {if isset($mppconfig.MOVEDESC)} 416 <span style="margin: 0 0 0 20px"><input class="submit" name="submitmovedesc" type="submit" value="{'Move description in info table'|@translate}" /> 417 {else} 418 <span style="margin: 0 0 0 20px"><input class="submit" name="submitdefaultdesc" type="submit" value="{'Return description in default location'|@translate}" /> 419 {/if} 420 <br> 421 </div> 422 </form> 423 <form method="post"> 424 <br> 425 <span style="margin: 0 0 0 20px">{'Max field for select or ratio option'|@translate} :<br> 426 <span style="margin: 0 0 0 20px"><input type="number" name="mppmaxfield" value="{$MPPMAXFIELD}" > 427 <br> 428 <br> 429 <br> 430 <span style="margin: 0 0 0 20px">{'The reference photo for exif and IPTC'|@translate} :<br> 431 <span style="margin: 0 0 0 20px"><input type="number" name="mppitidexif" value="{$MPPIDEXIF}" > 432 <br> 433 <p> 434 <input class="submit" type="submit" name="submitmppoption" value="{'Submit'|@translate}"> 435 </p> 436 </form> 437 </fieldset> 438 {/if} -
extensions/manage_properties_photos/admin/index.php
r30631 r32135 1 1 <?php 2 2 // +-----------------------------------------------------------------------+ 3 // | Piwigo - a PHP based picture gallery | 4 // +-----------------------------------------------------------------------+ 5 // | Copyright(C) 2008-2014 Piwigo Team http://piwigo.org | 6 // | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | 7 // | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | 8 // +-----------------------------------------------------------------------+ 9 // | This program is free software; you can redistribute it and/or modify | 10 // | it under the terms of the GNU General Public License as published by | 11 // | the Free Software Foundation | 3 // | This file is part of Piwigo. | 12 4 // | | 13 // | This program is distributed in the hope that it will be useful, but | 14 // | WITHOUT ANY WARRANTY; without even the implied warranty of | 15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 // | General Public License for more details. | 17 // | | 18 // | You should have received a copy of the GNU General Public License | 19 // | along with this program; if not, write to the Free Software | 20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | 21 // | USA. | 5 // | For copyright and license information, please view the COPYING.txt | 6 // | file that was distributed with this source code. | 22 7 // +-----------------------------------------------------------------------+ 23 8 -
extensions/manage_properties_photos/include/function.aip.inc.php
r31409 r32135 2 2 3 3 // +-----------------------------------------------------------------------+ 4 // | Manage Properties Photos plugin for Piwigo 4 // | Manage Properties Photos plugin for Piwigo by TEMMII | 5 5 // +-----------------------------------------------------------------------+ 6 // | Copyright(C) 20 14-2016ddtddt http://temmii.com/piwigo/ |6 // | Copyright(C) 2007-2020 ddtddt http://temmii.com/piwigo/ | 7 7 // +-----------------------------------------------------------------------+ 8 8 // | This program is free software; you can redistribute it and/or modify | … … 24 24 function tab_add_info_one_photo($id_img){ 25 25 $query = ' 26 SELECT aip.id_prop_pho,aip.wording,aipd.data,aip.orderprop 26 SELECT aip.id_prop_pho,aip.wording,aipd.data,aip.orderprop,aip.Typ 27 27 FROM ' . ADD_PROP_PHOTO_TABLE . ' AS aip 28 28 LEFT JOIN ' . ADD_PROP_PHOTO_DATA_TABLE . ' AS aipd ON aip.id_prop_pho=aipd.id_prop_pho … … 51 51 function tab_add_info_by_photo(){ 52 52 $query = ' 53 SELECT id_prop_pho,wording 53 SELECT id_prop_pho,wording,Typ,dataprop 54 54 FROM ' . ADD_PROP_PHOTO_TABLE . ' 55 WHERE active = 0 56 AND edit = 1 55 WHERE edit = 1 56 AND typ != 3 57 AND typ != 6 57 58 ORDER BY orderprop ASC 58 59 ;'; … … 64 65 function tab_add_info_by_photo_show(){ 65 66 $query = ' 66 SELECT id_prop_pho,wording,orderprop 67 SELECT id_prop_pho,wording,orderprop,Typ,dataprop 67 68 FROM ' . ADD_PROP_PHOTO_TABLE . ' 68 69 WHERE active = 0 … … 88 89 } 89 90 91 function data_info_photosdate($id_img=null,$id_prop_pho=NULL){ 92 $query = ' 93 SELECT datadate 94 FROM ' . ADD_PROP_PHOTO_DATADATE_TABLE; 95 $wa='WHERE'; 96 if($id_img!=null){ 97 $query .=' '.$wa.' id_img='.$id_img;$wa='AND'; 98 } 99 if($id_prop_pho!=null){ 100 $query .=' '.$wa.' id_prop_pho='.$id_prop_pho;$wa='AND'; 101 } 102 $query .= ';'; 103 return pwg_query($query); 104 } 105 90 106 /*Admin*/ 91 107 function tab_info_photos($id_prop_pho=NULL){ 92 108 $query = ' 93 SELECT id_prop_pho,wording,orderprop,active,edit 109 SELECT id_prop_pho,wording,orderprop,active,edit,Typ,dataprop 94 110 FROM ' . ADD_PROP_PHOTO_TABLE; 95 111 if($id_prop_pho!=null){ -
extensions/manage_properties_photos/index.php
r30631 r32135 1 1 <?php 2 2 // +-----------------------------------------------------------------------+ 3 // | Piwigo - a PHP based picture gallery | 4 // +-----------------------------------------------------------------------+ 5 // | Copyright(C) 2008-2014 Piwigo Team http://piwigo.org | 6 // | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | 7 // | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | 8 // +-----------------------------------------------------------------------+ 9 // | This program is free software; you can redistribute it and/or modify | 10 // | it under the terms of the GNU General Public License as published by | 11 // | the Free Software Foundation | 3 // | This file is part of Piwigo. | 12 4 // | | 13 // | This program is distributed in the hope that it will be useful, but | 14 // | WITHOUT ANY WARRANTY; without even the implied warranty of | 15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 // | General Public License for more details. | 17 // | | 18 // | You should have received a copy of the GNU General Public License | 19 // | along with this program; if not, write to the Free Software | 20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | 21 // | USA. | 5 // | For copyright and license information, please view the COPYING.txt | 6 // | file that was distributed with this source code. | 22 7 // +-----------------------------------------------------------------------+ 23 8 -
extensions/manage_properties_photos/initadmin.php
r31554 r32135 1 1 <?php 2 2 // +-----------------------------------------------------------------------+ 3 // | Manage Properties Photos plugin for Piwigo 3 // | Manage Properties Photos plugin for Piwigo by TEMMII | 4 4 // +-----------------------------------------------------------------------+ 5 // | Copyright(C) 20 14-2016ddtddt http://temmii.com/piwigo/ |5 // | Copyright(C) 2007-2020 ddtddt http://temmii.com/piwigo/ | 6 6 // +-----------------------------------------------------------------------+ 7 7 // | This program is free software; you can redistribute it and/or modify | … … 52 52 function MPP_loc_end_element_set_global(){ 53 53 global $template; 54 55 $template->assign(array( 56 'ADD_PROP_PHOTO_PATH'=> get_root_url() . ADD_PROP_PHOTO_PATH, 57 )); 58 54 59 $q = 'SELECT 1 FROM ' . ADD_PROP_PHOTO_TABLE . ' WHERE edit=1'; 55 60 $test = pwg_query($q); … … 65 70 $template->assign('useED',0); 66 71 } 72 while ($info_select = pwg_db_fetch_assoc($propertieslist2)){ 73 $items = array( 74 'IDINFOPHO' => $info_select['id_prop_pho'], 75 'AIPWORDING' => trigger_change('AP_render_content',$info_select['wording']), 76 'AIPTYP' => $info_select['Typ'], 77 ); 78 if($info_select['Typ']==4||$info_select['Typ']==5){ 79 $items['AIPDATAPROP'] = json_encode(unserialize($info_select['dataprop'])); 80 } 81 if($info_select['wording']=="**delpho**"){ 82 $items['AIPWORDING'] =l10n('Delete photo'); 83 } 84 $template->append('info_select', $items); 85 } 86 /* $propertieslist[]="------"; 67 87 while ($row = pwg_db_fetch_assoc($propertieslist2)){ 68 $propertieslist[$row['id_prop_pho']] = trigger_change('AP_render_content', $row['wording']); 69 } 88 $propertieslist[$row['Typ']][$row['id_prop_pho']]=trigger_change('AP_render_content', $row['wording']); 89 }*/ 90 70 91 $template->set_filename('MMPP', realpath(ADD_PROP_PHOTO_PATH.'mmp.tpl')); 71 92 $template->assign('propertieslist', $propertieslist); … … 82 103 global $page,$template,$prefixeTable; 83 104 $id_prop_pho= $_POST['IDMPP']; 84 $data= $_POST['dataglob']; 105 $Typ=$_POST['invisibleTyp']; 106 if($Typ==2){ 107 $data= $_POST['datadate']; 108 }else if($Typ==4){ 109 $data= $_POST['dataselect']; 110 }else if($Typ==5){ 111 $data= $_POST['radioselect']; 112 }else{ 113 $data= $_POST['dataglob']; 114 } 115 116 if($Typ==2){ 117 if (!empty($_POST['check_MPP'])){ 118 foreach ($collection as $image_id){ 119 $query = 'DELETE FROM ' . $prefixeTable . 'add_properties_photos_datadate WHERE id_img=' . $image_id . ' AND id_prop_pho=' . $id_prop_pho; 120 pwg_query($query); 121 } 122 }else{ 123 foreach ($collection as $image_id){ 124 $q = 'SELECT 1 FROM ' . ADD_PROP_PHOTO_DATADATE_TABLE . ' WHERE id_img=' . $image_id . ' AND id_prop_pho=' . $id_prop_pho; 125 $test = pwg_query($q); 126 $row = pwg_db_fetch_assoc($test); 127 if (!empty($row)) { 128 if ($data != '') { 129 $query = 'UPDATE ' . $prefixeTable . 'add_properties_photos_datadate SET datadate="' . $data . '" WHERE id_img=' . $image_id . ' AND id_prop_pho=' . $id_prop_pho; 130 pwg_query($query); 131 }else{ 132 $query = 'DELETE FROM ' . $prefixeTable . 'add_properties_photos_datadate WHERE id_img=' . $image_id . ' AND id_prop_pho=' . $id_prop_pho; 133 pwg_query($query); 134 } 135 }else if ($data != ''){ 136 $query = 'INSERT ' . $prefixeTable . 'add_properties_photos_datadate(id_img,id_prop_pho,datadate) VALUES (' . $image_id . ',' . $id_prop_pho . ',"' . $data . '");'; 137 pwg_query($query); 138 } 139 } 140 } 141 }else{ 85 142 if (!empty($_POST['check_MPP'])){ 86 143 foreach ($collection as $image_id){ … … 90 147 }else{ 91 148 foreach ($collection as $image_id){ 92 $q = 'SELECT 1FROM ' . ADD_PROP_PHOTO_DATA_TABLE . ' WHERE id_img=' . $image_id . ' AND id_prop_pho=' . $id_prop_pho;149 $q = 'SELECT id_img FROM ' . ADD_PROP_PHOTO_DATA_TABLE . ' WHERE id_img=' . $image_id . ' AND id_prop_pho=' . $id_prop_pho; 93 150 $test = pwg_query($q); 94 151 $row = pwg_db_fetch_assoc($test); 95 if ( count($row) > 0) {152 if (!empty($row)) { 96 153 if ($data != '') { 97 154 $query = 'UPDATE ' . $prefixeTable . 'add_properties_photos_data SET data="' . $data . '" WHERE id_img=' . $image_id . ' AND id_prop_pho=' . $id_prop_pho; … … 107 164 } 108 165 } 166 } 109 167 } 110 168 } -
extensions/manage_properties_photos/initpicture.php
r31553 r32135 1 1 <?php 2 2 // +-----------------------------------------------------------------------+ 3 // | Manage Properties Photos plugin for Piwigo 3 // | Manage Properties Photos plugin for Piwigo by TEMMII | 4 4 // +-----------------------------------------------------------------------+ 5 // | Copyright(C) 20 14-2016ddtddt http://temmii.com/piwigo/ |5 // | Copyright(C) 2007-2020 ddtddt http://temmii.com/piwigo/ | 6 6 // +-----------------------------------------------------------------------+ 7 7 // | This program is free software; you can redistribute it and/or modify | … … 30 30 function add_info_photo_preT($content, &$smarty) { 31 31 32 global $conf; 33 34 $search = '/(<dl id="standard" class="imageInfoTable">).*({if isset\(\$metadata\)})/is'; 35 36 $repla='<dl id="standard" class="imageInfoTable">{strip} 32 global $conf, $user; 33 34 $repla1='<dl id="standard" class="imageInfoTable">{strip}'; 35 $repla=' 37 36 {foreach from=$add_info_photos item=addinfophotos} 38 37 {if $addinfophotos.AIPID == 1 and isset($INFO_AUTHOR)} 39 38 <div id="Author" class="imageInfo"> 40 39 <dt>{\'Author\'|@translate}</dt> 41 40 <dd>{$INFO_AUTHOR}</dd> 42 41 </div> 43 42 {else if $addinfophotos.AIPID == 2 and isset($INFO_CREATION_DATE)} 44 43 <div id="datecreate" class="imageInfo"> 45 44 <dt>{\'Created on\'|@translate}</dt> 46 45 <dd>{$INFO_CREATION_DATE}</dd> … … 193 192 {/if} 194 193 {/foreach} 195 {/strip} 194 '; 195 $repla2='{/strip} 196 196 </dl> 197 {if isset($metadata)}'; 198 199 $repladarkroomcards=' 200 <div id="infopanel-left" class="col-lg-6 col-12"> 201 <!-- Picture infos --> 202 <div id="card-informations" class="card mb-2"> 203 <div class="card-body"> 204 <h5 class="card-title">{\'Information\'|@translate}</h5> 205 <div id="info-content" class="d-flex flex-column"> 206 '.$repla.' 207 </div></div></div></div> 208 {if isset($metadata) || (isset($comment_add) || $COMMENT_COUNT > 0)} 209 <div id="infopanel-right" class="col-lg-6 col-12"> 210 <!-- metadata --> 197 211 {if isset($metadata)} 198 '; 199 200 return preg_replace($search, $repla , $content); 201 212 {if isset($loaded_plugins[\'exif_view\'])} 213 {assign var="exif_make" value="{\'exif_field_Make\'|@translate}"} 214 {assign var="exif_model" value="{\'exif_field_Model\'|@translate}"} 215 {assign var="exif_lens" value="{\'exif_field_UndefinedTag:0xA434\'|@translate}"} 216 {assign var="exif_fnumber" value="{\'exif_field_FNumber\'|@translate}"} 217 {assign var="exif_iso" value="{\'exif_field_ISOSpeedRatings\'|@translate}"} 218 {assign var="exif_focal_length" value="{\'exif_field_FocalLength\'|@translate}"} 219 {assign var="exif_flash" value="{\'exif_field_Flash\'|@translate}"} 220 {assign var="exif_exposure_time" value="{\'exif_field_ExposureTime\'|@translate}"} 221 {assign var="exif_exposure_bias" value="{\'exif_field_ExposureBiasValue\'|@translate}"} 222 {else} 223 {assign var="exif_make" value="Make"} 224 {assign var="exif_model" value="Model"} 225 {assign var="exif_lens" value="UndefinedTag:0xA434"} 226 {assign var="exif_fnumber" value="FNumber"} 227 {assign var="exif_iso" value="ISOSpeedRatings"} 228 {assign var="exif_focal_length" value="FocalLength"} 229 {assign var="exif_flash" value="Flash"} 230 {assign var="exif_exposure_time" value="ExposureTime"} 231 {assign var="exif_exposure_bias" value="ExposureBiasValue"} 232 {/if} 233 234 <div id="card-metadata" class="card mb-2"> 235 <div class="card-body"> 236 <h5 class="card-title">{\'EXIF Metadata\'|@translate}</h5> 237 <div id="metadata"> 238 {if is_array($metadata.0.lines) && (array_key_exists("{$exif_make}", $metadata.0.lines) || array_key_exists("{$exif_model}", $metadata.0.lines))} 239 <div class="row" style="line-height: 40px"> 240 <div class="col-12"> 241 <span class="camera-compact fa-3x mr-3" title="{$exif_make} & {$exif_model}"></span> 242 {if is_array($metadata.0.lines) && (array_key_exists("{$exif_make}", $metadata.0.lines))}{$metadata.0.lines[{$exif_make}]}{/if} 243 {if is_array($metadata.0.lines) && (array_key_exists("{$exif_model}", $metadata.0.lines))}{$metadata.0.lines[{$exif_model}]}{/if} 244 </div> 245 </div> 246 {/if} 247 {if is_array($metadata.0.lines) && (array_key_exists("{$exif_lens}", $metadata.0.lines))} 248 <div class="row" style="line-height: 40px"> 249 <div class="col-12"> 250 <span class="camera-lens-h fa-3x mr-3" title="{$exif_lens}"></span> 251 {$metadata.0.lines[{$exif_lens}]} 252 </div> 253 </div> 254 {/if} 255 <div class="row"> 256 <div class="col-12{if $theme_config->fluid_width} col-xl-10{/if}"> 257 <div class="row"> 258 {if is_array($metadata.0.lines) && (array_key_exists("{$exif_fnumber}", $metadata.0.lines))} 259 <div class="col-6 col-sm-4"> 260 <span class="camera-aperture fa-2x pr-2" title="{$exif_fnumber}"></span> f/{$metadata.0.lines[{$exif_fnumber}]} 261 </div> 262 {/if} 263 {if is_array($metadata.0.lines) && (array_key_exists("{$exif_focal_length}", $metadata.0.lines))} 264 <div class="col-6 col-sm-4"> 265 <span class="camera-focal-length fa-2x pr-2" title="{$exif_focal_length}"></span> {$metadata.0.lines[{$exif_focal_length}]} 266 </div> 267 {/if} 268 {if is_array($metadata.0.lines) && (array_key_exists("{$exif_exposure_time}", $metadata.0.lines))} 269 <div class="col-6 col-sm-4"> 270 <span class="camera-shutter-speed fa-2x pr-2" title="{$exif_exposure_time}"></span> {$metadata.0.lines[{$exif_exposure_time}]} 271 </div> 272 {/if} 273 {if is_array($metadata.0.lines) && (array_key_exists("{$exif_iso}", $metadata.0.lines))} 274 <div class="col-6 col-sm-4"> 275 <span class="camera-iso fa-2x pr-2" title="{$exif_iso}"></span> {$metadata.0.lines[{$exif_iso}]} 276 </div> 277 {/if} 278 {if is_array($metadata.0.lines) && (array_key_exists("{$exif_exposure_bias}", $metadata.0.lines))} 279 <div class="col-6 col-sm-4"> 280 <span class="camera-exposure fa-2x pr-2" title="{$exif_exposure_bias}"></span> {$metadata.0.lines[{$exif_exposure_bias}]} 281 </div> 282 {/if} 283 {if is_array($metadata.0.lines) && (array_key_exists("{$exif_flash}", $metadata.0.lines))} 284 <div class="col-6 col-sm-4"> 285 <span class="camera-flash fa-2x pr-2 float-left h-100" title="{$exif_flash}"></span><div> {$metadata.0.lines[{$exif_flash}]}</div> 286 </div> 287 {/if} 288 </div> 289 </div> 290 </div> 291 </div> 292 <button id="show_exif_data" class="btn btn-primary btn-raised mt-1" style="text-transform: none;"><i class="fas fa-info mr-1"></i> {\'Show EXIF data\'|@translate}</button> 293 {footer_script require=\'jquery\'} 294 $(\'#show_exif_data\').on(\'click\', function() { 295 if ($(\'#full_exif_data\').hasClass(\'d-none\')) { 296 $(\'#full_exif_data\').addClass(\'d-flex\').removeClass(\'d-none\'); 297 $(\'#show_exif_data\').html(\'<i class="fas fa-info mr-1"></i> {"Hide EXIF data"|@translate}\'); 298 } else { 299 $(\'#full_exif_data\').addClass(\'d-none\').removeClass(\'d-flex\'); 300 $(\'#show_exif_data\').html(\'<i class="fas fa-info mr-1"></i> {"Show EXIF data"|@translate}\'); 301 } 302 }); 303 {/footer_script} 304 <div id="full_exif_data" class="d-none flex-column mt-2"> 305 {foreach from=$metadata item=meta} 306 {foreach from=$meta.lines item=value key=label} 307 <div> 308 <dl class="row mb-0"> 309 <dt class="col-sm-6">{$label}</dt> 310 <dd class="col-sm-6">{$value}</td> 311 </tr> 312 </dl> 313 </div> 314 {/foreach} 315 {/foreach} 316 </div> 317 </div> 318 </div> 319 {/if} 320 <div id="card-comments" class="ml-2"> 321 {include file=\'picture_info_comments.tpl\'} 322 </div> 323 </div> 324 {/if} 325 '; 326 327 $repladarkroomtabs=' 328 <div id="infopanel" class="col-lg-8 col-md-10 col-12 mx-auto"> 329 <!-- Nav tabs --> 330 <ul class="nav nav-tabs nav-justified flex-column flex-sm-row" role="tablist"> 331 {if $theme_config->picture_info == \'tabs\' || (get_device() != \'desktop\' && $theme_config->picture_info != \'disabled\')} 332 <li class="nav-item"><a class="flex-sm-fill text-sm-center nav-link active" href="#tab_info" aria-controls="tab_info" role="tab" data-toggle="tab">{\'Information\'|@translate}</a></li> 333 {if isset($metadata)} 334 <li class="nav-item"><a class="flex-sm-fill text-sm-center nav-link" href="#tab_metadata" aria-controls="tab_metadata" role="tab" data-toggle="tab">{\'EXIF Metadata\'|@translate}</a></li> 335 {/if} 336 {/if} 337 {if isset($comment_add) || $COMMENT_COUNT > 0} 338 <li class="nav-item{if $theme_config->picture_info == \'disabled\' || ($theme_config->picture_info != \'tabs\' && get_device() == \'desktop\')} active{/if}"><a class="flex-sm-fill text-sm-center nav-link" href="#tab_comments" aria-controls="tab_comments" role="tab" data-toggle="tab">{\'Comments\'|@translate} <span class="badge badge-secondary">{$COMMENT_COUNT}</span></a></li> 339 {/if} 340 </ul> 341 342 <!-- Tab panes --> 343 <div class="tab-content d-flex justify-content-center"> 344 {if $theme_config->picture_info === \'tabs\' || (get_device() != \'desktop\' && $theme_config->picture_info != \'disabled\')} 345 <div role="tabpanel" class="tab-pane active" id="tab_info"> 346 <div id="info-content" class="info"> 347 <div class="table-responsive"> 348 <table class="table table-sm"> 349 <colgroup> 350 <col class="w-50"> 351 <col class="w-50"> 352 </colgroup> 353 <tbody> 354 <!--mpp --> 355 {foreach from=$add_info_photos item=addinfophotos} 356 {if $addinfophotos.AIPID == 1 and isset($INFO_AUTHOR)} 357 <div id="Author" class="imageInfo"> 358 <tr> 359 <th scope="row">{\'Author\'|@translate}</th> 360 <td>{$INFO_AUTHOR}</td> 361 </tr> 362 </div> 363 {else if $addinfophotos.AIPID == 2 and isset($INFO_CREATION_DATE)} 364 <div id="datecreate" class="imageInfo"> 365 <tr> 366 <th scope="row">{\'Created on\'|@translate}</th> 367 <td>{$INFO_CREATION_DATE}</td> 368 </tr> 369 </div> 370 {else if $addinfophotos.AIPID == 3 and isset($INFO_POSTED_DATE)} 371 <div id="datepost" class="imageInfo"> 372 <tr> 373 <th scope="row">{\'Posted on\'|@translate}</th> 374 <td>{$INFO_POSTED_DATE}</td> 375 </tr> 376 </div> 377 {else if $addinfophotos.AIPID == 4 and isset($INFO_DIMENSIONS)} 378 <div id="Dimensions" class="imageInfo"> 379 <tr> 380 <th scope="row">{\'Dimensions\'|@translate}</th> 381 <td>{$INFO_DIMENSIONS}</td> 382 </tr> 383 </div> 384 {else if $addinfophotos.AIPID == 5} 385 <div id="File" class="imageInfo"> 386 <tr> 387 <th scope="row">{\'File\'|@translate}</th> 388 <td>{$INFO_FILE}</td> 389 </tr> 390 </div> 391 {else if $addinfophotos.AIPID == 6 and isset($INFO_FILESIZE)} 392 <div id="Filesize" class="imageInfo"> 393 <tr> 394 <th scope="row">{\'Filesize\'|@translate}</th> 395 <td>{$INFO_FILESIZE}</td> 396 </tr> 397 </div> 398 {else if $addinfophotos.AIPID == 7 and isset($related_tags)} 399 <div id="Tags" class="imageInfo"> 400 <tr> 401 <th scope="row">{\'Tags\'|@translate}</th> 402 <td> 403 {foreach from=$related_tags item=tag name=tag_loop}{if !$smarty.foreach.tag_loop.first}, {/if}<a href="{$tag.URL}">{$tag.name}</a>{/foreach} 404 </td> 405 </tr> 406 </div> 407 {else if $addinfophotos.AIPID == 8 and isset($related_categories)} 408 <div id="Categories" class="imageInfo"> 409 <tr> 410 <th scope="row">{\'Albums\'|@translate}</th> 411 <td> 412 <ul> 413 {foreach from=$related_categories item=cat} 414 <li>{$cat}</li> 415 {/foreach} 416 </ul> 417 </td> 418 </tr> 419 </div> 420 {else if $addinfophotos.AIPID == 9} 421 <div id="Visits" class="imageInfo"> 422 <tr> 423 <th scope="row">{\'Visits\'|@translate}</th> 424 <td>{$INFO_VISITS}</td> 425 </tr> 426 </div> 427 {else if $addinfophotos.AIPID == 10 and isset($rate_summary)} 428 <div id="Average" class="imageInfo"> 429 <tr> 430 <th scope="row">{\'Rating score\'|@translate}</th> 431 <td> 432 {if $rate_summary.count} 433 <span id="ratingScore">{$rate_summary.score}</span> <span id="ratingCount">({$rate_summary.count|@translate_dec:\'%d rate\':\'%d rates\'})</span> 434 {else} 435 <span id="ratingScore">{\'no rate\'|@translate}</span> <span id="ratingCount"></span> 436 {/if} 437 </td> 438 </tr> 439 </div> 440 {if isset($rating)} 441 <div id="rating" class="imageInfo"> 442 <tr> 443 <th scope="row"> 444 <span id="updateRate">{if isset($rating.USER_RATE)}{\'Update your rating\'|@translate}{else}{\'Rate this photo\'|@translate}{/if}</span> 445 </th> 446 <td> 447 <form action="{$rating.F_ACTION}" method="post" id="rateForm" style="margin:0;"> 448 <div> 449 {foreach from=$rating.marks item=mark name=rate_loop} 450 {if isset($rating.USER_RATE) && $mark==$rating.USER_RATE} 451 <input type="button" name="rate" value="{$mark}" class="rateButtonSelected" title="{$mark}"> 452 {else} 453 <input type="submit" name="rate" value="{$mark}" class="rateButton" title="{$mark}"> 454 {/if} 455 {/foreach} 456 {strip}{combine_script id=\'core.scripts\' load=\'async\' path=\'themes/default/js/scripts.js\'} 457 {combine_script id=\'rating\' load=\'async\' require=\'core.scripts\' path=\'themes/default/js/rating.js\'} 458 {footer_script} 459 var _pwgRatingAutoQueue = _pwgRatingAutoQueue||[]; 460 _pwgRatingAutoQueue.push( {ldelim}rootUrl: \'{$ROOT_URL}\', image_id: {$current.id}, 461 onSuccess : function(rating) {ldelim} 462 var e = document.getElementById("updateRate"); 463 if (e) e.innerHTML = "{\'Update your rating\'|@translate|@escape:\'javascript\'}"; 464 e = document.getElementById("ratingScore"); 465 if (e) e.innerHTML = rating.score; 466 e = document.getElementById("ratingCount"); 467 if (e) {ldelim} 468 if (rating.count == 1) {ldelim} 469 e.innerHTML = "({\'%d rate\'|@translate|@escape:\'javascript\'})".replace( "%d", rating.count); 470 } else {ldelim} 471 e.innerHTML = "({\'%d rates\'|@translate|@escape:\'javascript\'})".replace( "%d", rating.count); 472 } 473 {rdelim} 474 {rdelim}{rdelim} ); 475 {/footer_script} 476 {/strip} 477 </div> 478 </form> 479 </td> 480 </tr> 481 </div> 482 {/if} 483 {else if $addinfophotos.AIPID == 11 and $display_info.privacy_level and isset($available_permission_levels)} 484 <div id="Privacy" class="imageInfo"> 485 <tr> 486 <th scope="row">{\'Who can see this photo?\'|@translate}</th> 487 <td> 488 <div> 489 <a id="privacyLevelLink" href>{$available_permission_levels[$current.level]}</a> 490 </div> 491 {combine_script id=\'core.scripts\' load=\'async\' path=\'themes/default/js/scripts.js\'} 492 {footer_script require=\'jquery\'}{strip} 493 function setPrivacyLevel(id, level){ 494 (new PwgWS(\'{$ROOT_URL}\')).callService( 495 "pwg.images.setPrivacyLevel", { image_id:id, level:level}, 496 { 497 method: "POST", 498 onFailure: function(num, text) { alert(num + " " + text); }, 499 onSuccess: function(result) { 500 jQuery(\'#privacyLevelBox .switchCheck\').css(\'visibility\',\'hidden\'); 501 jQuery(\'#switchLevel\'+level).prev(\'.switchCheck\').css(\'visibility\',\'visible\'); 502 jQuery(\'#privacyLevelLink\').text(jQuery(\'#switchLevel\'+level).text()); 503 } 504 } 505 ); 202 506 } 507 (SwitchBox=window.SwitchBox||[]).push("#privacyLevelLink", "#privacyLevelBox"); 508 {/strip}{/footer_script} 509 <div id="privacyLevelBox" class="switchBox" style="display:none"> 510 {foreach from=$available_permission_levels item=label key=level} 511 <span class="switchCheck"{if $level != $current.level} style="visibility:hidden"{/if}>✔ </span> 512 <a id="switchLevel{$level}" href="javascript:setPrivacyLevel({$current.id},{$level})">{$label}</a><br> 513 {/foreach} 514 </div> 515 </td> 516 </tr> 517 </div> 518 {else if $addinfophotos.AIPWORDING == \'Description\' and isset($COMMENT_IMG)} 519 <div id="Description" class="imageInfo"> 520 <tr> 521 <th scope="row">{\'Description\'|@translate}</th> 522 <td> 523 {$COMMENT_IMG} 524 </td> 525 </tr> 526 </div> 527 {footer_script} 528 jQuery(document).ready(function(){ 529 jQuery(".imageComment").hide(); 530 }); 531 {/footer_script} 532 {else if $addinfophotos.AIPDATA} 533 <div id="add_info" class="imageInfo"> 534 <tr> 535 <th scope="row label">{$addinfophotos.AIPWORDING}</th> 536 <td class="value">{$addinfophotos.AIPDATA}</td> 537 </tr> 538 </div> 539 {/if} 540 {/foreach} 541 <!--and mpp --> 542 </tbody> 543 </table> 544 </div> 545 </div> 546 </div> 547 <!-- metadata --> 548 {if isset($metadata)} 549 <div role="tabpanel" class="tab-pane" id="tab_metadata"> 550 <div id="metadata" class="info"> 551 <div class="table-responsive"> 552 <table class="table table-sm"> 553 <colgroup> 554 <col class="w-50"> 555 <col class="w-50"> 556 </colgroup> 557 <tbody> 558 {foreach from=$metadata item=meta} 559 {foreach from=$meta.lines item=value key=label} 560 <tr> 561 <th scope="row">{$label}</th> 562 <td>{$value}</td> 563 </tr> 564 {/foreach} 565 {/foreach} 566 </tbody> 567 </table> 568 </div> 569 </div> 570 </div> 571 {/if} 572 {/if} 573 574 <!-- comments --> 575 {if isset($comment_add) || $COMMENT_COUNT > 0} 576 <div role="tabpanel" class="tab-pane" id="tab_comments"> 577 {include file=\'picture_info_comments.tpl\'} 578 </div> 579 {/if} 580 </div> 581 </div> 582 583 '; 584 585 $replasmart=' 586 <ul data-role="listview" data-inset="true" id="PictureInfo"> 587 {strip} 588 <!--mpp --> 589 {foreach from=$add_info_photos item=addinfophotos} 590 {if $addinfophotos.AIPID == 1 and isset($INFO_AUTHOR)} 591 <li id="Author" class="imageInfo"> 592 <dt>{\'Author\'|@translate}</dt> 593 <dd>{$INFO_AUTHOR}</dd> 594 </li> 595 {else if $addinfophotos.AIPID == 2 and isset($INFO_CREATION_DATE)} 596 <li id="datecreate" class="imageInfo"> 597 <dt>{\'Created on\'|@translate}</dt> 598 <dd>{$INFO_CREATION_DATE}</dd> 599 </li> 600 {else if $addinfophotos.AIPID == 3 and isset($INFO_POSTED_DATE)} 601 <li id="datepost" class="imageInfo"> 602 <dt>{\'Posted on\'|@translate}</dt> 603 <dd>{$INFO_POSTED_DATE}</dd> 604 </li> 605 {else if $addinfophotos.AIPID == 4 and isset($INFO_DIMENSIONS)} 606 <li id="Dimensions" class="imageInfo"> 607 <dt>{\'Dimensions\'|@translate}</dt> 608 <dd>{$INFO_DIMENSIONS}</dd> 609 </li> 610 {else if $addinfophotos.AIPID == 5} 611 <li id="File" class="imageInfo"> 612 <dt>{\'File\'|@translate}</dt> 613 <dd>{$INFO_FILE}</dd> 614 </li> 615 {else if $addinfophotos.AIPID == 6 and isset($INFO_FILESIZE)} 616 <li id="Filesize" class="imageInfo"> 617 <dt>{\'Filesize\'|@translate}</dt> 618 <dd>{$INFO_FILESIZE}</dd> 619 </li> 620 {else if $addinfophotos.AIPID == 7 and isset($related_tags)} 621 <li id="Tags" class="imageInfo"> 622 <dt>{\'Tags\'|@translate}</dt> 623 <dd> 624 {foreach from=$related_tags item=tag name=tag_loop}{if !$smarty.foreach.tag_loop.first}, {/if}<a href="{$tag.URL}">{$tag.name}</a>{/foreach} 625 </dd> 626 </li> 627 {else if $addinfophotos.AIPID == 8 and isset($related_categories)} 628 <li id="Categories" class="imageInfo"> 629 <dt>{\'Albums\'|@translate}</dt> 630 <dd> 631 <ul> 632 {foreach from=$related_categories item=cat} 633 <li>{$cat}</li> 634 {/foreach} 635 </ul> 636 </dd> 637 </li> 638 {else if $addinfophotos.AIPID == 9} 639 <li id="Visits" class="imageInfo"> 640 <dt>{\'Visits\'|@translate}</dt> 641 <dd>{$INFO_VISITS}</dd> 642 </li> 643 {else if $addinfophotos.AIPID == 10 and isset($rate_summary)} 644 <li id="Average" class="imageInfo"> 645 <dt>{\'Rating score\'|@translate}</dt> 646 <dd> 647 {if $rate_summary.count} 648 <span id="ratingScore">{$rate_summary.score}</span> <span id="ratingCount">({$rate_summary.count|@translate_dec:\'%d rate\':\'%d rates\'})</span> 649 {else} 650 <span id="ratingScore">{\'no rate\'|@translate}</span> <span id="ratingCount"></span> 651 {/if} 652 </dd> 653 </li> 654 {if isset($rating)} 655 <li id="rating" class="imageInfo"> 656 <dt> 657 <span id="updateRate">{if isset($rating.USER_RATE)}{\'Update your rating\'|@translate}{else}{\'Rate this photo\'|@translate}{/if}</span> 658 </dt> 659 <dd> 660 <form action="{$rating.F_ACTION}" method="post" id="rateForm" style="margin:0;"> 661 <div> 662 {foreach from=$rating.marks item=mark name=rate_loop} 663 {if isset($rating.USER_RATE) && $mark==$rating.USER_RATE} 664 <input type="button" name="rate" value="{$mark}" class="rateButtonSelected" title="{$mark}"> 665 {else} 666 <input type="submit" name="rate" value="{$mark}" class="rateButton" title="{$mark}"> 667 {/if} 668 {/foreach} 669 {strip}{combine_script id=\'core.scripts\' load=\'async\' path=\'themes/default/js/scripts.js\'} 670 {combine_script id=\'rating\' load=\'async\' require=\'core.scripts\' path=\'themes/default/js/rating.js\'} 671 {footer_script} 672 var _pwgRatingAutoQueue = _pwgRatingAutoQueue||[]; 673 _pwgRatingAutoQueue.push( {ldelim}rootUrl: \'{$ROOT_URL}\', image_id: {$current.id}, 674 onSuccess : function(rating) {ldelim} 675 var e = document.getElementById("updateRate"); 676 if (e) e.innerHTML = "{\'Update your rating\'|@translate|@escape:\'javascript\'}"; 677 e = document.getElementById("ratingScore"); 678 if (e) e.innerHTML = rating.score; 679 e = document.getElementById("ratingCount"); 680 if (e) {ldelim} 681 if (rating.count == 1) {ldelim} 682 e.innerHTML = "({\'%d rate\'|@translate|@escape:\'javascript\'})".replace( "%d", rating.count); 683 } else {ldelim} 684 e.innerHTML = "({\'%d rates\'|@translate|@escape:\'javascript\'})".replace( "%d", rating.count); 685 } 686 {rdelim} 687 {rdelim}{rdelim} ); 688 {/footer_script} 689 {/strip} 690 </div> 691 </form> 692 </dd> 693 </li> 694 {/if} 695 {else if $addinfophotos.AIPID == 11 and $display_info.privacy_level and isset($available_permission_levels)} 696 <li id="Privacy" class="imageInfo"> 697 <dt>{\'Who can see this photo?\'|@translate}</dt> 698 <dd> 699 <div> 700 <a id="privacyLevelLink" href>{$available_permission_levels[$current.level]}</a> 701 </div> 702 {combine_script id=\'core.scripts\' load=\'async\' path=\'themes/default/js/scripts.js\'} 703 {footer_script require=\'jquery\'}{strip} 704 function setPrivacyLevel(id, level){ 705 (new PwgWS(\'{$ROOT_URL}\')).callService( 706 "pwg.images.setPrivacyLevel", { image_id:id, level:level}, 707 { 708 method: "POST", 709 onFailure: function(num, text) { alert(num + " " + text); }, 710 onSuccess: function(result) { 711 jQuery(\'#privacyLevelBox .switchCheck\').css(\'visibility\',\'hidden\'); 712 jQuery(\'#switchLevel\'+level).prev(\'.switchCheck\').css(\'visibility\',\'visible\'); 713 jQuery(\'#privacyLevelLink\').text(jQuery(\'#switchLevel\'+level).text()); 714 } 715 } 716 ); 717 } 718 (SwitchBox=window.SwitchBox||[]).push("#privacyLevelLink", "#privacyLevelBox"); 719 {/strip}{/footer_script} 720 <div id="privacyLevelBox" class="switchBox" style="display:none"> 721 {foreach from=$available_permission_levels item=label key=level} 722 <span class="switchCheck"{if $level != $current.level} style="visibility:hidden"{/if}>✔ </span> 723 <a id="switchLevel{$level}" href="javascript:setPrivacyLevel({$current.id},{$level})">{$label}</a><br> 724 {/foreach} 725 </div> 726 </dd> 727 </li> 728 {else if $addinfophotos.AIPWORDING == \'Description\' and isset($COMMENT_IMG)} 729 <li id="Description" class="imageInfo"> 730 <dt>{\'Description\'|@translate}</dt> 731 <dd> 732 {$COMMENT_IMG} 733 </dd> 734 </li> 735 {footer_script} 736 jQuery(document).ready(function(){ 737 jQuery(".imageComment").hide(); 738 }); 739 {/footer_script} 740 {else if $addinfophotos.AIPDATA} 741 <li id="add_info" class="imageInfo"> 742 <dt class="label">{$addinfophotos.AIPWORDING}</dt> 743 <dd class="value">{$addinfophotos.AIPDATA}</dd> 744 </li> 745 {/if} 746 {/foreach} 747 <!--and mpp --> 748 {if isset($metadata)} 749 '; 750 751 $replastandard=$repla1.$repla.$repla2; 752 753 $repladarkroom='<div id="theImageInfos" class="row justify-content-center"> 754 {if $theme_config->picture_info == \'cards\'}' 755 .$repladarkroomcards.' 756 {elseif $theme_config->picture_info == \'tabs\'}' 757 .$repladarkroomtabs.' 758 {elseif $theme_config->picture_info == \'sidebar\' || $theme_config->picture_info == \'disabled\'} 759 <div class="col-lg-8 col-md-10 col-12 mx-auto"> 760 {include file=\'picture_info_comments.tpl\'} 761 </div> 762 {/if} 763 </div> 764 765 {if !empty($PLUGIN_PICTURE_AFTER)}{$PLUGIN_PICTURE_AFTER}{/if} 766 '; 767 if ($user['theme'] == 'bootstrap_darkroom'){ 768 $themeconfig = new \BootstrapDarkroom\Config(); 769 if($themeconfig->picture_info=='sidebar'){ 770 $search = '/(<dl id="standard" class="imageInfoTable">).*({if isset\(\$metadata\)})/is'; 771 return preg_replace($search, $replastandard , $content); 772 }else{ 773 $search = '/(<div id="theImageInfos" class="row justify-content-center">).*({if \!empty\(\$PLUGIN_PICTURE_AFTER\)}{\$PLUGIN_PICTURE_AFTER}{\/if})/is'; 774 return preg_replace($search, $repladarkroom , $content); 775 } 776 }else if ($user['theme'] == 'smartpocket'){ 777 $search = '/(<ul data-role="listview" data-inset="true" id="PictureInfo">).*({if isset\(\$metadata\)})/is'; 778 return preg_replace($search, $replasmart , $content); 779 }else{ 780 $search = '/(<dl id="standard" class="imageInfoTable">).*({if isset\(\$metadata\)})/is'; 781 return preg_replace($search, $replastandard , $content); 782 } 783 } 203 784 204 785 add_event_handler('loc_begin_picture', 'add_InfoT'); 205 786 206 787 function add_InfoT() { 207 global $conf, $page, $template ;788 global $conf, $page, $template, $lang, $pwg_loaded_plugins; 208 789 209 790 if (!empty($page['image_id'])) { 210 $PAED = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'ExtendedDescription';")); 211 if ($PAED['state'] == 'active') 212 add_event_handler('AP_render_content', 'get_user_language_desc'); 213 791 if (isset($pwg_loaded_plugins['ExtendedDescription'])){add_event_handler('AP_render_content', 'get_user_language_desc');} 792 214 793 $tab_add_info_one_photo = tab_add_info_by_photo_show(); 215 794 795 $query = 'select path FROM ' . IMAGES_TABLE . ' WHERE id = \''.$page['image_id'].'\';'; 796 $result = pwg_query($query); 797 $row = pwg_db_fetch_assoc($result); 798 $filename=$row['path']; 799 $exif = exif_read_data($filename); 800 $imginfo = array(); 801 getimagesize($filename, $imginfo); 802 if (isset ($imginfo['APP13'])){$iptc = iptcparse($imginfo['APP13']);} 216 803 if (pwg_db_num_rows($tab_add_info_one_photo)) { 217 804 while ($info_photos = pwg_db_fetch_assoc($tab_add_info_one_photo)) { 218 219 $d = data_info_photos($page['image_id'], $info_photos['id_prop_pho']); 220 $row = pwg_db_fetch_assoc($d); 221 805 if($info_photos['Typ']==2){ 806 $d = data_info_photosdate($page['image_id'], $info_photos['id_prop_pho']); 807 }else{ 808 $d = data_info_photos($page['image_id'], $info_photos['id_prop_pho']); 809 } 810 $row = pwg_db_fetch_assoc($d); 222 811 $items = array( 223 812 'AIPID' => $info_photos['id_prop_pho'], 224 813 'AIPORDER' => $info_photos['orderprop'], 225 814 'AIPWORDING' => trigger_change('AP_render_content', $info_photos['wording']), 226 'AIPDATA' => trigger_change('AP_render_content', $row['data']),227 815 ); 816 if($info_photos['Typ']==2){ 817 $items['AIPDATA']=$row['datadate']; 818 if($info_photos['wording']=="**delpho**"){ 819 $items['AIPWORDING'] =l10n('Delete photo'); 820 } 821 }else if($info_photos['Typ']==3){ 822 if(strpos($info_photos['dataprop'],':')!==false){ 823 $exiftab = explode(':', $info_photos['dataprop']); 824 if (isset($exif[$exiftab[0]][$exiftab[1]])){ 825 if (isset($pwg_loaded_plugins['exif_view'])){ 826 $items['AIPDATA']=exif_key_translation($exif[$exiftab[0]][$exiftab[1]], $exif[$exiftab[0]][$exiftab[1]]); 827 }else{ 828 $items['AIPDATA']= $exif[$exiftab[0]][$exiftab[1]]; 829 } 830 if ($info_photos['wording']!=$info_photos['dataprop']){ 831 }else if (isset($lang['exif_field_'.$exiftab[1]])){ 832 $items['AIPWORDING']= $lang['exif_field_'.$exiftab[1]]; 833 }else{ 834 $items['AIPWORDING']= $exiftab[1]; 835 } 836 } 837 }else{ 838 if (isset($exif[$info_photos['dataprop']])){ 839 if (isset($pwg_loaded_plugins['exif_view'])){ 840 $items['AIPDATA']=exif_key_translation($info_photos['dataprop'], $exif[$info_photos['dataprop']]); 841 }else{ 842 $items['AIPDATA']= $exif[$info_photos['dataprop']]; 843 } 844 if ($info_photos['wording']!=$info_photos['dataprop']){ 845 }else if (isset($lang['exif_field_'.$info_photos['dataprop']])){ 846 $items['AIPWORDING']= $lang['exif_field_'.$info_photos['dataprop']]; 847 }else{ 848 $items['AIPWORDING']= $info_photos['dataprop']; 849 } 850 } 851 } 852 }else if($info_photos['Typ']==6){ 853 $items['AIPWORDING']=trigger_change('AP_render_content', $info_photos['wording']); 854 if (isset($iptc[$info_photos['dataprop']])){ 855 $items['AIPDATA']=implode(", ", $iptc[$info_photos['dataprop']]); 856 } 857 }else{ 858 $items['AIPDATA']=trigger_change('AP_render_content', $row['data']); 859 860 } 861 228 862 229 863 $template->append('add_info_photos', $items); -
extensions/manage_properties_photos/language/el_GR/index.php
r30816 r32135 1 1 <?php 2 // +-----------------------------------------------------------------------+ 3 // | This file is part of Piwigo. | 4 // | | 5 // | For copyright and license information, please view the COPYING.txt | 6 // | file that was distributed with this source code. | 7 // +-----------------------------------------------------------------------+ 8 9 // Recursive call 2 10 $url = '../'; 3 11 header( 'Request-URI: '.$url ); -
extensions/manage_properties_photos/language/en_UK/index.php
r30631 r32135 1 1 <?php 2 2 // +-----------------------------------------------------------------------+ 3 // | Piwigo - a PHP based picture gallery | 4 // +-----------------------------------------------------------------------+ 5 // | Copyright(C) 2008-2014 Piwigo Team http://piwigo.org | 6 // | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | 7 // | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | 8 // +-----------------------------------------------------------------------+ 9 // | This program is free software; you can redistribute it and/or modify | 10 // | it under the terms of the GNU General Public License as published by | 11 // | the Free Software Foundation | 3 // | This file is part of Piwigo. | 12 4 // | | 13 // | This program is distributed in the hope that it will be useful, but | 14 // | WITHOUT ANY WARRANTY; without even the implied warranty of | 15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 // | General Public License for more details. | 17 // | | 18 // | You should have received a copy of the GNU General Public License | 19 // | along with this program; if not, write to the Free Software | 20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | 21 // | USA. | 5 // | For copyright and license information, please view the COPYING.txt | 6 // | file that was distributed with this source code. | 22 7 // +-----------------------------------------------------------------------+ 23 8 -
extensions/manage_properties_photos/language/en_UK/plugin.lang.php
r31409 r32135 1 1 <?php 2 2 // +-----------------------------------------------------------------------+ 3 // | Manage Properties Photos plugin for Piwigo 3 // | Manage Properties Photos plugin for Piwigo by TEMMII | 4 4 // +-----------------------------------------------------------------------+ 5 // | Copyright(C) 20 14-2016ddtddt http://temmii.com/piwigo/ |5 // | Copyright(C) 2007-2020 ddtddt http://temmii.com/piwigo/ | 6 6 // +-----------------------------------------------------------------------+ 7 7 // | This program is free software; you can redistribute it and/or modify | … … 36 36 $lang['delete data this property'] = 'delete data this property'; 37 37 $lang['Choose a property'] = 'Choose a property'; 38 39 $lang['Text'] = 'Text'; 40 $lang['select'] = 'select'; 41 $lang['exif'] = 'exif'; 42 $lang['date'] = 'date'; 43 $lang['radio'] = 'radio'; 44 $lang['IPTC'] = 'IPTC'; 45 46 $lang['Option List'] = 'Option List'; 47 $lang['Add Field'] = 'Add Field'; 48 $lang['Add field for automatic deletion\'s photos on a given date'] = 'Add field for automatic deletion\'s photos on a given date'; 49 $lang['Remove Field for automatic deletion\'s photos on a given date and all date save'] = 'Remove Field for automatic deletion\'s photos on a given date and all date save'; 50 $lang['Move description in info table'] = 'Move description in info table'; 51 $lang['Return description in default location'] = 'Return description in default location'; 52 $lang['Max field for select or ratio option'] = 'Max field for select or ratio option'; 53 $lang['The reference photo for exif and IPTC'] = 'The reference photo for exif and IPTC'; 54 $lang['The reference photo doesn\'t have exif'] = 'The reference photo doesn\'t have exif'; 55 $lang['The reference photo doesn\'t have IPTC'] = 'The reference photo doesn\'t have IPTC'; -
extensions/manage_properties_photos/language/fr_FR/index.php
r30720 r32135 1 1 <?php 2 // +-----------------------------------------------------------------------+ 3 // | This file is part of Piwigo. | 4 // | | 5 // | For copyright and license information, please view the COPYING.txt | 6 // | file that was distributed with this source code. | 7 // +-----------------------------------------------------------------------+ 8 9 // Recursive call 2 10 $url = '../'; 3 11 header( 'Request-URI: '.$url ); -
extensions/manage_properties_photos/language/fr_FR/plugin.lang.php
r31409 r32135 1 1 <?php 2 2 // +-----------------------------------------------------------------------+ 3 // | Manage Properties Photos plugin for Piwigo 3 // | Manage Properties Photos plugin for Piwigo by TEMMII | 4 4 // +-----------------------------------------------------------------------+ 5 // | Copyright(C) 20 14-2016ddtddt http://temmii.com/piwigo/ |5 // | Copyright(C) 2007-2020 ddtddt http://temmii.com/piwigo/ | 6 6 // +-----------------------------------------------------------------------+ 7 7 // | This program is free software; you can redistribute it and/or modify | … … 34 34 $lang['delete data this property'] = 'supprimer des données de la propriété'; 35 35 $lang['Choose a property'] = 'Choisir une propriété'; 36 37 $lang['Text'] = 'Text'; 38 $lang['select'] = 'select'; 39 $lang['exif'] = 'exif'; 40 $lang['date'] = 'date'; 41 $lang['radio'] = 'radio'; 42 $lang['IPTC'] = 'IPTC'; 43 44 $lang['Option List'] = 'Liste des options'; 45 $lang['Add Field'] = 'Ajouter un champs'; 46 $lang['Add field for automatic deletion\'s photos on a given date'] = 'Ajoutez un champs pour supprimer automatiquement les photos à une date'; 47 $lang['Remove Field for automatic deletion\'s photos on a given date and all date save'] = 'Supprimer le champs pour de suppression automatiquement des photos et les dates programmées'; 48 $lang['Move description in info table'] = 'Déplacer la description dans la table des propriétées'; 49 $lang['Return description in default location'] = 'Remettre la description à la place par défaut'; 50 $lang['Max field for select or ratio option'] = 'Maximum de champs pour les balises "select" et les boutons "ratio'; 51 $lang['The reference photo for exif and IPTC'] = 'La photo de référence pour les exifs et IPTC'; 52 $lang['The reference photo doesn\'t have exif'] = 'La photo de référence ne possède pas d\'exif'; 53 $lang['The reference photo doesn\'t have IPTC'] = 'La photo de référence ne possède pas IPTC'; -
extensions/manage_properties_photos/language/index.php
r30631 r32135 1 1 <?php 2 2 // +-----------------------------------------------------------------------+ 3 // | Piwigo - a PHP based picture gallery | 4 // +-----------------------------------------------------------------------+ 5 // | Copyright(C) 2008-2014 Piwigo Team http://piwigo.org | 6 // | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | 7 // | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | 8 // +-----------------------------------------------------------------------+ 9 // | This program is free software; you can redistribute it and/or modify | 10 // | it under the terms of the GNU General Public License as published by | 11 // | the Free Software Foundation | 3 // | This file is part of Piwigo. | 12 4 // | | 13 // | This program is distributed in the hope that it will be useful, but | 14 // | WITHOUT ANY WARRANTY; without even the implied warranty of | 15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 // | General Public License for more details. | 17 // | | 18 // | You should have received a copy of the GNU General Public License | 19 // | along with this program; if not, write to the Free Software | 20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | 21 // | USA. | 5 // | For copyright and license information, please view the COPYING.txt | 6 // | file that was distributed with this source code. | 22 7 // +-----------------------------------------------------------------------+ 23 8 -
extensions/manage_properties_photos/main.inc.php
r31553 r32135 10 10 11 11 // +-----------------------------------------------------------------------+ 12 // | Manage Properties Photos plugin for Piwigo 12 // | Manage Properties Photos plugin for Piwigo by TEMMII | 13 13 // +-----------------------------------------------------------------------+ 14 // | Copyright(C) 20 14-2016ddtddt http://temmii.com/piwigo/ |14 // | Copyright(C) 2007-2020 ddtddt http://temmii.com/piwigo/ | 15 15 // +-----------------------------------------------------------------------+ 16 16 // | This program is free software; you can redistribute it and/or modify | … … 38 38 if (!defined('ADD_PROP_PHOTO_TABLE')) define('ADD_PROP_PHOTO_TABLE', $prefixeTable.'add_properties_photos'); 39 39 if (!defined('ADD_PROP_PHOTO_DATA_TABLE')) define('ADD_PROP_PHOTO_DATA_TABLE', $prefixeTable.'add_properties_photos_data'); 40 if (!defined('ADD_PROP_PHOTO_DATADATE_TABLE')) define('ADD_PROP_PHOTO_DATADATE_TABLE', $prefixeTable.'add_properties_photos_datadate'); 40 41 define('ADD_PROP_PHOTO_ADMIN',get_root_url().'admin.php?page=plugin-'.ADD_PROP_PHOTO_DIR); 41 42 … … 57 58 } 58 59 60 /*delete photo*/ 61 $datedelete = pwg_db_fetch_assoc(pwg_query("SELECT id_prop_pho FROM " . ADD_PROP_PHOTO_TABLE . " WHERE dataprop = 'DeletetePhoto' AND Typ = 2 LIMIT 1;")); 62 if ($datedelete != NULL){ 63 $photodelete = pwg_query(' 64 SELECT id_img 65 FROM '.ADD_PROP_PHOTO_DATADATE_TABLE.' 66 WHERE datadate <= NOW() 67 AND id_prop_pho = '.$datedelete['id_prop_pho'].' 68 ;'); 69 if (pwg_db_num_rows($photodelete)) { 70 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 71 while ($delete_photos = pwg_db_fetch_assoc($photodelete)) { 72 $tab_delete_photos[]=$delete_photos['id_img']; 73 } 74 delete_elements($tab_delete_photos, true); 75 pwg_query('DELETE FROM '.ADD_PROP_PHOTO_DATA_TABLE.' WHERE id_img IN ('.implode(',', $tab_delete_photos).');'); 76 pwg_query('DELETE FROM '.ADD_PROP_PHOTO_DATADATE_TABLE.' WHERE id_img IN ('.implode(',', $tab_delete_photos).');'); 77 invalidate_user_cache(); 78 } 79 80 } 81 82 /*end delete photo*/ 83 59 84 ?> -
extensions/manage_properties_photos/maintain.class.php
r31741 r32135 1 1 <?php 2 2 // +-----------------------------------------------------------------------+ 3 // | Manage Properties Photos plugin for Piwigo 3 // | Manage Properties Photos plugin for Piwigo by TEMMII | 4 4 // +-----------------------------------------------------------------------+ 5 // | Copyright(C) 20 14-2016ddtddt http://temmii.com/piwigo/ |5 // | Copyright(C) 2007-2020 ddtddt http://temmii.com/piwigo/ | 6 6 // +-----------------------------------------------------------------------+ 7 7 // | This program is free software; you can redistribute it and/or modify | … … 21 21 22 22 defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); 23 24 /* definie Typ 25 0 : default piwigo properties 26 1 : properties texte 27 2 : properties date 28 3 : properties exif 29 4 : properties select 30 5 : properties ratio 31 32 $conf['mpp_idexif'] ** picture id for list exif 33 $conf['mpp_max_fields'] ** max fileds for select and ratio default 5 34 */ 35 23 36 24 37 class manage_properties_photos_maintain extends PluginMaintain … … 40 53 active SMALLINT(5) UNSIGNED NOT NULL , 41 54 edit SMALLINT(5) UNSIGNED NOT NULL , 55 Typ SMALLINT(5) DEFAULT 1, 56 dataprop VARCHAR(255), 42 57 PRIMARY KEY (id_prop_pho))DEFAULT CHARSET=utf8;"; 43 58 $result = pwg_query($query); … … 50 65 PRIMARY KEY (id_img,id_prop_pho))DEFAULT CHARSET=utf8;"; 51 66 $result = pwg_query($query); 67 68 if (!defined('ADD_PROP_PHOTO_DATADATE_TABLE')) define('ADD_PROP_PHOTO_DATADATE_TABLE', $prefixeTable.'add_properties_photos_datadate'); 69 $query = "CREATE TABLE IF NOT EXISTS ". ADD_PROP_PHOTO_DATADATE_TABLE ." ( 70 id_img SMALLINT(5) UNSIGNED NOT NULL , 71 id_prop_pho SMALLINT(5) UNSIGNED NOT NULL , 72 datadate datetime , 73 PRIMARY KEY (id_img,id_prop_pho))DEFAULT CHARSET=utf8;"; 74 $result = pwg_query($query); 75 76 77 52 78 $activ=unserialize($conf['picture_informations']); 53 79 if($activ['author']==true){$activauteur=0;}else{$activauteur=1;} … … 62 88 if($activ['rating_score']==true){$activrs=0;}else{$activrs=1;} 63 89 if($activ['privacy_level']==true){$activpl=0;}else{$activpl=1;} 64 $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit)VALUES 65 (1,"author",1,'.$activauteur.',0), 66 (2,"Created on",2,'.$activco.',0), 67 (3,"Posted on",3,'.$activpo.',0), 68 (4,"Dimensions",4,'.$activdim.',0), 69 (5,"File",5,'.$activfile.',0), 70 (6,"Filesize",6,'.$activfilesize.',0), 71 (7,"Tags",7,'.$activtags.',0), 72 (8,"Albums",8,'.$activcategories.',0), 73 (9,"Visits",9,'.$activvisits.',0), 74 (10,"Average",10,'.$activrs.',0), 75 (11,"Who can see this photo?",11,'.$activpl.',0), 76 (12,"Description",12,1,0) 90 $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit,Typ)VALUES 91 (1,"author",1,'.$activauteur.',0,0), 92 (2,"Created on",2,'.$activco.',0,0), 93 (3,"Posted on",3,'.$activpo.',0,0), 94 (4,"Dimensions",4,'.$activdim.',0,0), 95 (5,"File",5,'.$activfile.',0,0), 96 (6,"Filesize",6,'.$activfilesize.',0,0), 97 (7,"Tags",7,'.$activtags.',0,0), 98 (8,"Albums",8,'.$activcategories.',0,0), 99 (9,"Visits",9,'.$activvisits.',0,0), 100 (10,"Average",10,'.$activrs.',0,0), 101 (11,"Who can see this photo?",11,'.$activpl.',0,0) 77 102 ;'; 78 103 pwg_query($q); 79 104 105 if (!defined('ADD_PROP_PHOTO_DATADATE_TABLE')) define('ADD_PROP_PHOTO_DATADATE_TABLE', $prefixeTable.'add_properties_photos_datadate'); 106 $query = "CREATE TABLE IF NOT EXISTS ". ADD_PROP_PHOTO_DATADATE_TABLE ." ( 107 id_img SMALLINT(5) UNSIGNED NOT NULL , 108 id_prop_pho SMALLINT(5) UNSIGNED NOT NULL , 109 datadate datetime , 110 PRIMARY KEY (id_img,id_prop_pho))DEFAULT CHARSET=utf8;"; 111 $result = pwg_query($query); 112 80 113 } 81 114 … … 86 119 function update($old_version, $new_version, &$errors=array()){ 87 120 global $prefixeTable; 88 if (!defined('ADD_PROP_PHOTO_TABLE')) define('ADD_PROP_PHOTO_TABLE', $prefixeTable.'add_properties_photos'); 89 $desc = pwg_db_fetch_assoc(pwg_query("SELECT wording FROM " . ADD_PROP_PHOTO_TABLE . " WHERE wording = 'Description' LIMIT 1;")); 90 if ($desc == NULL){ 91 $order=pwg_db_fetch_assoc(pwg_query('SELECT orderprop FROM ' . ADD_PROP_PHOTO_TABLE . ' ORDER BY orderprop DESC LIMIT 1;')); 92 $order=$order['orderprop']+1; 93 $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(wording,orderprop,active,edit)VALUES ("Description",'.$order.',1,0);'; 121 if (!defined('ADD_PROP_PHOTO_TABLE')) define('ADD_PROP_PHOTO_TABLE', $prefixeTable.'add_properties_photos'); 122 /*Update to manage Typ select date*/ 123 $col = pwg_db_fetch_assoc(pwg_query("SHOW COLUMNS FROM " . ADD_PROP_PHOTO_TABLE . " LIKE 'Typ';")); 124 if ($col == NULL){ 125 $q = 'ALTER TABLE '. ADD_PROP_PHOTO_TABLE.' ADD COLUMN `Typ` SMALLINT(5) DEFAULT 1;'; 94 126 pwg_query($q); 95 } 96 127 $q = 'ALTER TABLE '. ADD_PROP_PHOTO_TABLE.' ADD COLUMN `dataprop` VARCHAR(255);'; 128 pwg_query($q); 129 $q = 'UPDATE '. ADD_PROP_PHOTO_TABLE.' set Typ = 0 where edit =0;'; 130 pwg_query($q); 131 } 132 133 /*Update for manage date*/ 134 if (!defined('ADD_PROP_PHOTO_DATADATE_TABLE')) define('ADD_PROP_PHOTO_DATADATE_TABLE', $prefixeTable.'add_properties_photos_datadate'); 135 $datatable= pwg_db_fetch_assoc(pwg_query("SHOW TABLES LIKE '" . ADD_PROP_PHOTO_DATADATE_TABLE . "';")); 136 if ($datatable == NULL){ 137 $query = "CREATE TABLE IF NOT EXISTS ". ADD_PROP_PHOTO_DATADATE_TABLE ." ( 138 id_img SMALLINT(5) UNSIGNED NOT NULL , 139 id_prop_pho SMALLINT(5) UNSIGNED NOT NULL , 140 datadate datetime , 141 PRIMARY KEY (id_img,id_prop_pho))DEFAULT CHARSET=utf8;"; 142 $result = pwg_query($query); 143 } 144 97 145 } 98 146 … … 102 150 function uninstall(){ 103 151 global $prefixeTable; 104 $q = 'DROP TABLE ' . $prefixeTable . 'add_properties_photos;'; 105 pwg_query($q); 106 $q = 'DROP TABLE ' . $prefixeTable . 'add_properties_photos_data;'; 107 pwg_query($q); 152 pwg_query('DROP TABLE ' . $prefixeTable . 'add_properties_photos;'); 153 pwg_query('DROP TABLE ' . $prefixeTable . 'add_properties_photos_data;'); 154 pwg_query('DROP TABLE ' . $prefixeTable . 'add_properties_photos_datadate;'); 108 155 } 109 156 } -
extensions/manage_properties_photos/mmp.tpl
r31406 r32135 1 {combine_script id='jquery.ui.sortable' require='jquery.ui' load='footer' path='themes/default/js/ui/minified/jquery.ui.sortable.min.js'} 2 {combine_script id='core.scripts' load='async' path='themes/default/js/scripts.js'} 3 {combine_script id='jquery.timepicker' require='jquery.ui.datepicker,jquery.ui.slider' load='footer' path=$ADD_PROP_PHOTO_PATH|@cat:"js/jquery-ui-timepicker-addon.js"} 4 {assign var="datepicker_language" value="themes/default/js/ui/i18n/jquery.ui.datepicker-`$lang_info.code`.js"} 5 {if "PHPWG_ROOT_PATH"|@constant|@cat:$datepicker_language|@file_exists} 6 {combine_script id="jquery.ui.datepicker-$lang_info.code" load='footer' path=$datepicker_language} 7 {/if} 8 9 {combine_script id='jquery.chosen' load='footer' path='themes/default/js/plugins/chosen.jquery.min.js'} 10 {combine_css path="themes/default/js/plugins/chosen.css"} 11 12 {combine_css path="themes/default/js/ui/theme/jquery.ui.datepicker.css"} 13 {combine_css path="themes/default/js/ui/theme/jquery.ui.slider.css"} 14 1 15 {footer_script} 2 16 jQuery(document).ready(function(){ 3 17 $("input[name=check_MPP]").change(function(){ 4 18 if($(this).is(':checked')){ 5 $('#changepro').hide(); 19 $('#changeselect').hide(); 20 $('#changepro').hide(); 21 $('#changeproda').hide(); 6 22 }else{ 7 $('# changepro').show();23 $('#selectMPP').val(0).change(); 8 24 } 9 25 }); 26 27 $('#selectMPP') 28 .change(function () { 29 $("input[name=check_MPP]").attr('checked', false); 30 $('#dataselect').children().remove() 31 var selected = $(':selected', this); 32 var typ=$(':selected', this).data('typ'); 33 var dataprop=$(':selected', this).data('dataprop'); 34 $('#hidetyp').val(typ); 35 if(typ=='4'){ 36 $('#changeselect').show(); 37 $('#changepro').hide(); 38 $('#changeproda').hide(); 39 for (key in dataprop){ 40 $('#dataselect').append(new Option(dataprop[key])); 41 } 42 $('#changeradio').hide(); 43 $('#changeradio').empty(); 44 }else if(typ=='2'){ 45 $('#changepro').hide(); 46 $('#changeproda').show(); 47 $('#changeselect').hide(); 48 $('#changeradio').hide(); 49 $('#changeradio').empty(); 50 }else if(typ=='5'){ 51 $('#changeselect').hide(); 52 $('#changepro').hide(); 53 $('#changeproda').hide(); 54 $('#changeradio').empty(); 55 for (key in dataprop){ 56 $('<input type="radio" name="radioselect" value="'+dataprop[key]+'">'+dataprop[key]+'</input><span style="margin: 0 0 0 10px">').appendTo('#changeradio'); 57 } 58 $('#changeradio').show(); 59 }else if(typ=='1'){ 60 $('#changeselect').hide(); 61 $('#changepro').show(); 62 $('#changeproda').hide(); 63 $('#changeradio').hide(); 64 $('#changeradio').empty(); 65 }else{ 66 $('#changeselect').hide(); 67 $('#changepro').hide(); 68 $('#changeproda').hide(); 69 $('#changeradio').hide(); 70 $('#changeradio').empty(); 71 } 72 }) 73 .change(); 74 75 $('.dateSelect').datetimepicker({ 76 numberOfMonths: 1, 77 changeMonth: true, 78 changeYear: true, 79 yearRange: "1900:+1", 80 dateFormat: "yy-mm-dd", 81 timeText: '{'selection'|@translate|escape:javascript}', 82 hourText: '{'Hour'|@translate|escape:javascript}', 83 minuteText: '{'Minute'|@translate|escape:javascript}', 84 currentText: '{'Now'|@translate|escape:javascript}', 85 closeText: '{'Validate'|@translate|escape:javascript}' 86 }); 87 10 88 }); 11 89 {/footer_script} 12 90 <span id="persompp"> 13 91 {'Choose a property'|@translate} 14 <br /> 15 {html_options name="IDMPP" options=$propertieslist selected=$SELECTEDMPP} 16 <br /> 17 <br /> 92 <br> 93 <br> 94 <select name="IDMPP" id="selectMPP"> 95 96 {foreach from=$info_select item=infoselect} 97 <option value="{$infoselect.IDINFOPHO}" data-typ="{$infoselect.AIPTYP}" data-dataprop='{$infoselect.AIPDATAPROP}' id="selectMPP{$infoselect.IDINFOPHO}">{$infoselect.AIPWORDING}</option> 98 {/foreach} 99 </select> 100 <br> 101 <br> 18 102 <input id="check_MPP" type="checkbox" name="check_MPP"> {'delete data this property'|@translate}<br /> 19 <div id="changepro"> 20 <form method="post" > 21 <textarea rows="3" cols="100" {if $useED==1}placeholder="{'Use Extended Description tags...'|@translate}"{/if} name="dataglob">{$PLUG_MPP}</textarea> 22 </form> 103 <input id="hidetyp" type="hidden" name="invisibleTyp" value=""> 104 <div id="changepro" style="display: none;" > 105 <textarea rows="3" cols="100" {if $useED==1}placeholder="{'Use Extended Description tags...'|@translate}"{/if} name="dataglob">{$PLUG_MPP}</textarea> 106 </div> 107 <div id="changeproda" style="display: none;" > 108 <input type="text" class="dateSelect" id="dateSelect" name="datadate" style="width:120px;" value=""> 109 </div> 110 <div id="changeselect" style="display: none;" > 111 <select name="dataselect" id="dataselect"> 112 </select> 113 </div> 114 <div id="changeradio" style="display: none;" > 23 115 </div> 24 116 </span>
Note: See TracChangeset
for help on using the changeset viewer.