Changeset 26879 for extensions
- Timestamp:
- Jan 19, 2014, 9:58:14 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/user_delete_photo/initpicture.php
r26561 r26879 1 1 <?php 2 //Add prefilter 3 add_event_handler('loc_begin_picture', 'udp', 55 ); 4 function udp() 5 { 6 global $template; 7 $template->set_prefilter('picture', 'udpT'); 8 } 2 9 3 4 5 //Ajout du prefiltre 6 add_event_handler('loc_begin_picture', 'udp', 55 ); 7 8 function udp() 9 { 10 global $template; 11 $template->set_prefilter('picture', 'udpT'); 12 } 13 14 function udpT($content, &$smarty) 15 { 16 global $conf; 17 10 function udpT($content, &$smarty) 11 { 12 global $conf; 18 13 $search = '#<div id="'.$conf['udp'].'" class="imageInfo">#'; 19 20 14 $replacement = ' 21 22 15 {if $UDFA} 23 24 25 26 27 28 16 <div id="udp" class="imageInfo"> 17 <form method="post"> 18 <input class="submit" name="submitudpA" type="submit" value="{\'delete photo\'|@translate}"> 19 <label><input type="checkbox" name="confirm_deletionudp" value="1"> {\'Are you sure?\'|@translate}</label> 20 </form> 21 </div> 29 22 {/if} 30 <div id="'.$conf['udp'].'" class="imageInfo">'; 31 23 <div id="'.$conf['udp'].'" class="imageInfo">'; 32 24 return preg_replace($search, $replacement, $content); 33 }25 } 34 26 35 27 add_event_handler('loc_begin_picture', 'udpA'); 36 28 37 function udpA()29 function udpA() 38 30 { 39 global $conf, $page, $template ; 40 load_language('plugin.lang', UDP_PATH); 41 load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) ); 42 43 global $conf, $user, $page; 31 global $conf, $page, $template ; 32 load_language('plugin.lang', UDP_PATH); 33 load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) ); 34 global $conf, $user, $page; 44 35 45 36 $query = ' … … 51 42 $row = pwg_db_fetch_assoc($result); 52 43 $userudp=$row['added_by']; 53 44 54 45 $query = ' 55 46 select '.$conf['user_fields']['username'].' AS username … … 63 54 if (($udp == $user['username'])) 64 55 { 65 $template->assign( array ( 66 'UDFA' => 'udp', 67 ) ); 56 $template->assign( 57 array ( 58 'UDFA' => 'udp', 59 )); 68 60 } 69 61 70 62 if ((isset($_POST['submitudpA']) and ($udp == $user['username']))) 63 { 64 if (!(isset($_POST['confirm_deletionudp']) and 1 == $_POST['confirm_deletionudp'])) 71 65 { 72 73 if (!(isset($_POST['confirm_deletionudp']) and 1 == $_POST['confirm_deletionudp'])) 74 { 75 array_push($page['errors'], l10n('You need to confirm deletion')); 76 } 77 else 78 { 79 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 80 global $page; 81 $deletephotoudp =array($page['image_id']); 82 delete_elements($deletephotoudp, true); 83 invalidate_user_cache(); 84 $redirect_url = get_root_url().'index.php?/category/'.($page['category']['id']); 85 $_SESSION['page_infos'] = array(l10n('Photo deleted')); 86 redirect($redirect_url); 87 } 66 array_push($page['errors'], l10n('You need to confirm deletion')); 88 67 } 68 else 69 { 70 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 71 global $page; 72 $deletephotoudp =array($page['image_id']); 73 delete_elements($deletephotoudp, true); 74 invalidate_user_cache(); 75 if (isset($page['category']['id'])) 76 { 77 $redirect_url = get_root_url().'index.php?/category/'.($page['category']['id']); 78 } 79 else 80 { 81 $redirect_url = get_root_url().'index.php?/'.($page['section']); 82 } 83 $_SESSION['page_infos'] = array(l10n('Photo deleted')); 84 redirect($redirect_url); 85 } 86 } 89 87 } 90 91 92 88 ?>
Note: See TracChangeset
for help on using the changeset viewer.