Changeset 31553
- Timestamp:
- Apr 17, 2016, 10:06:37 PM (8 years ago)
- Location:
- extensions/manage_properties_photos
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/manage_properties_photos/initadmin.php
r31409 r31553 23 23 add_event_handler('get_admin_plugin_menu_links', 'add_info_photo_admin_menu'); 24 24 25 function add_info_photo_admin_menu($menu) 25 function add_info_photo_admin_menu($menu){ 26 26 load_language('plugin.lang', ADD_PROP_PHOTO_PATH); 27 27 $menu[] = array( … … 35 35 EVENT_HANDLER_PRIORITY_NEUTRAL); 36 36 37 function aip_tabsheet_before_select($sheets, $id) 38 { 39 global $template, $page; 40 if ($id == 'photo') 41 { 37 function aip_tabsheet_before_select($sheets, $id){ 38 global $template, $page; 39 if ($id == 'photo'){ 42 40 $sheets['iap'] = array( 43 41 'caption' => l10n('Properties additionals'), … … 52 50 add_event_handler('element_set_global_action', 'MPP_element_set_global_action', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); 53 51 54 function MPP_loc_end_element_set_global() 55 { 56 load_language('plugin.lang', ADD_PROP_PHOTO_PATH); 57 global $template; 58 59 $q = 'SELECT 1 FROM ' . ADD_PROP_PHOTO_TABLE . ' WHERE edit=1'; 60 $test = pwg_query($q); 61 $row = pwg_db_fetch_assoc($test); 62 if (count($row) > 0) { 63 64 $propertieslist = array(); 65 $propertieslist2 = tab_add_info_by_photo(); 66 67 $PAED = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'ExtendedDescription';")); 68 if($PAED['state'] == 'active'){ 52 function MPP_loc_end_element_set_global(){ 53 global $template; 54 $q = 'SELECT 1 FROM ' . ADD_PROP_PHOTO_TABLE . ' WHERE edit=1'; 55 $test = pwg_query($q); 56 $row = pwg_db_fetch_assoc($test); 57 if (count($row) > 0){ 58 $propertieslist = array(); 59 $propertieslist2 = tab_add_info_by_photo(); 60 $PAED = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'ExtendedDescription';")); 61 if($PAED['state'] == 'active'){ 69 62 add_event_handler('AP_render_content', 'get_user_language_desc'); 70 63 $template->assign('useED',1); 71 }else{64 }else{ 72 65 $template->assign('useED',0); 73 } 74 75 while ($row = pwg_db_fetch_assoc($propertieslist2)) 76 { 77 $propertieslist[$row['id_prop_pho']] = trigger_change('AP_render_content', $row['wording']); 66 } 67 while ($row = pwg_db_fetch_assoc($propertieslist2)){ 68 $propertieslist[$row['id_prop_pho']] = trigger_change('AP_render_content', $row['wording']); 69 } 70 $template->set_filename('MMPP', realpath(ADD_PROP_PHOTO_PATH.'mmp.tpl')); 71 $template->assign('propertieslist', $propertieslist); 72 $template->append('element_set_global_plugins_actions', array( 73 'ID' => 'MPP', 74 'NAME' => l10n('Change photos properties'), 75 'CONTENT' => $template->parse('MMPP', true) 76 )); 78 77 } 79 $template->set_filename('MMPP', realpath(ADD_PROP_PHOTO_PATH.'mmp.tpl')); 80 $template->assign('propertieslist', $propertieslist); 81 $template->append('element_set_global_plugins_actions', array( 82 'ID' => 'MPP', 83 'NAME' => l10n('Change photos properties'), 84 'CONTENT' => $template->parse('MMPP', true) 85 )); 86 } 87 } 78 } 88 79 89 function MPP_element_set_global_action($action, $collection) 90 { 91 load_language('plugin.lang', ADD_PROP_PHOTO_PATH); 92 if ($action == 'MPP') 93 { 94 global $page,$template,$prefixeTable; 95 96 $id_prop_pho= $_POST['IDMPP']; 80 function MPP_element_set_global_action($action, $collection){ 81 if ($action == 'MPP'){ 82 global $page,$template,$prefixeTable; 83 $id_prop_pho= $_POST['IDMPP']; 97 84 $data= $_POST['dataglob']; 98 99 if (!empty($_POST['check_MPP'])) 100 { 101 foreach ($collection as $image_id) 102 { 85 if (!empty($_POST['check_MPP'])){ 86 foreach ($collection as $image_id){ 103 87 $query = 'DELETE FROM ' . $prefixeTable . 'add_properties_photos_data WHERE id_img=' . $image_id . ' AND id_prop_pho=' . $id_prop_pho; 104 88 pwg_query($query); 105 89 } 106 } 107 else 108 { 109 foreach ($collection as $image_id) 110 { 90 }else{ 91 foreach ($collection as $image_id){ 111 92 $q = 'SELECT 1 FROM ' . ADD_PROP_PHOTO_DATA_TABLE . ' WHERE id_img=' . $image_id . ' AND id_prop_pho=' . $id_prop_pho; 112 93 $test = pwg_query($q); 113 94 $row = pwg_db_fetch_assoc($test); 114 95 if (count($row) > 0) { 115 116 117 118 } else{119 120 121 122 } else if ($data != ''){96 if ($data != '') { 97 $query = 'UPDATE ' . $prefixeTable . 'add_properties_photos_data SET data="' . $data . '" WHERE id_img=' . $image_id . ' AND id_prop_pho=' . $id_prop_pho; 98 pwg_query($query); 99 }else{ 100 $query = 'DELETE FROM ' . $prefixeTable . 'add_properties_photos_data WHERE id_img=' . $image_id . ' AND id_prop_pho=' . $id_prop_pho; 101 pwg_query($query); 102 } 103 }else if ($data != ''){ 123 104 $query = 'INSERT ' . $prefixeTable . 'add_properties_photos_data(id_img,id_prop_pho,data) VALUES (' . $image_id . ',' . $id_prop_pho . ',"' . $data . '");'; 124 105 pwg_query($query); … … 127 108 } 128 109 } 129 110 } 130 111 131 112 add_event_handler('loc_begin_admin_page', 'mpp_change_admin_show'); 113 function mpp_change_admin_show(){ 114 global $template; 115 $template->set_prefilter('config', 'mpp_change_admin_show_prefilter'); 116 } 117 118 function mpp_change_admin_show_prefilter($content, &$smarty){ 119 $search = '#(<fieldset id="pictureInfoConf">).*</fieldset>#ms'; 120 return preg_replace($search, ' 121 <fieldset id="pictureInfoConf"> 122 <legend>{\'Photo Properties\'|@translate}</legend> 123 <a href="'.ADD_PROP_PHOTO_ADMIN.'">{\'Manage properties photos\'|@translate}</a> 124 </fieldset> 125 ', $content); 126 } -
extensions/manage_properties_photos/initpicture.php
r31409 r31553 36 36 $repla='<dl id="standard" class="imageInfoTable">{strip} 37 37 {foreach from=$add_info_photos item=addinfophotos} 38 {if $addinfophotos.AIPID == 1 and $display_info.author andisset($INFO_AUTHOR)}38 {if $addinfophotos.AIPID == 1 and isset($INFO_AUTHOR)} 39 39 <div id="Author" class="imageInfo"> 40 40 <dt>{\'Author\'|@translate}</dt> 41 41 <dd>{$INFO_AUTHOR}</dd> 42 42 </div> 43 {else if $addinfophotos.AIPID == 2 and $display_info.created_on andisset($INFO_CREATION_DATE)}43 {else if $addinfophotos.AIPID == 2 and isset($INFO_CREATION_DATE)} 44 44 <div id="datecreate" class="imageInfo"> 45 45 <dt>{\'Created on\'|@translate}</dt> 46 46 <dd>{$INFO_CREATION_DATE}</dd> 47 47 </div> 48 {else if $addinfophotos.AIPID == 3 and $display_info.posted_on andisset($INFO_POSTED_DATE)}48 {else if $addinfophotos.AIPID == 3 and isset($INFO_POSTED_DATE)} 49 49 <div id="datepost" class="imageInfo"> 50 50 <dt>{\'Posted on\'|@translate}</dt> 51 51 <dd>{$INFO_POSTED_DATE}</dd> 52 52 </div> 53 {else if $addinfophotos.AIPID == 4 and $display_info.dimensions andisset($INFO_DIMENSIONS)}53 {else if $addinfophotos.AIPID == 4 and isset($INFO_DIMENSIONS)} 54 54 <div id="Dimensions" class="imageInfo"> 55 55 <dt>{\'Dimensions\'|@translate}</dt> 56 56 <dd>{$INFO_DIMENSIONS}</dd> 57 57 </div> 58 {else if $addinfophotos.AIPID == 5 and $display_info.file}58 {else if $addinfophotos.AIPID == 5} 59 59 <div id="File" class="imageInfo"> 60 60 <dt>{\'File\'|@translate}</dt> 61 61 <dd>{$INFO_FILE}</dd> 62 62 </div> 63 {else if $addinfophotos.AIPID == 6 and $display_info.filesize andisset($INFO_FILESIZE)}63 {else if $addinfophotos.AIPID == 6 and isset($INFO_FILESIZE)} 64 64 <div id="Filesize" class="imageInfo"> 65 65 <dt>{\'Filesize\'|@translate}</dt> 66 66 <dd>{$INFO_FILESIZE}</dd> 67 67 </div> 68 {else if $addinfophotos.AIPID == 7 and $display_info.tags andisset($related_tags)}68 {else if $addinfophotos.AIPID == 7 and isset($related_tags)} 69 69 <div id="Tags" class="imageInfo"> 70 70 <dt>{\'Tags\'|@translate}</dt> … … 73 73 </dd> 74 74 </div> 75 {else if $addinfophotos.AIPID == 8 and $display_info.categories andisset($related_categories)}75 {else if $addinfophotos.AIPID == 8 and isset($related_categories)} 76 76 <div id="Categories" class="imageInfo"> 77 77 <dt>{\'Albums\'|@translate}</dt> … … 84 84 </dd> 85 85 </div> 86 {else if $addinfophotos.AIPID == 9 and $display_info.visits}86 {else if $addinfophotos.AIPID == 9} 87 87 <div id="Visits" class="imageInfo"> 88 88 <dt>{\'Visits\'|@translate}</dt> 89 89 <dd>{$INFO_VISITS}</dd> 90 90 </div> 91 {else if $addinfophotos.AIPID == 10 and $display_info.rating_score andisset($rate_summary)}91 {else if $addinfophotos.AIPID == 10 and isset($rate_summary)} 92 92 <div id="Average" class="imageInfo"> 93 93 <dt>{\'Rating score\'|@translate}</dt> -
extensions/manage_properties_photos/main.inc.php
r31409 r31553 42 42 include_once(ADD_PROP_PHOTO_PATH . 'include/function.aip.inc.php'); 43 43 44 add_event_handler('loading_lang', 'manage_properties_photos_loading_lang'); 45 function manage_properties_photos_loading_lang(){ 46 load_language('plugin.lang', ADD_PROP_PHOTO_PATH); 47 } 48 44 49 // Plugin on picture page 45 if (script_basename() == 'picture') 46 { 50 if (script_basename() == 'picture'){ 47 51 include_once(dirname(__FILE__).'/initpicture.php'); 48 52 } 49 53 50 51 54 // Plugin for admin 52 if (script_basename() == 'admin') 53 { 55 if (script_basename() == 'admin'){ 54 56 include_once(dirname(__FILE__).'/initadmin.php'); 55 57 } -
extensions/manage_properties_photos/maintain.class.php
r31409 r31553 31 31 32 32 function install($plugin_version, &$errors=array()){ 33 global $prefixeTable ;33 global $prefixeTable, $conf; 34 34 35 35 if (!defined('ADD_PROP_PHOTO_TABLE')) define('ADD_PROP_PHOTO_TABLE', $prefixeTable.'add_properties_photos'); … … 50 50 PRIMARY KEY (id_img,id_prop_pho))DEFAULT CHARSET=utf8;"; 51 51 $result = pwg_query($query); 52 53 $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit)VALUES (1,"author",1,0,0);'; 54 pwg_query($q); 55 $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit)VALUES (2,"Created on",2,0,0);'; 56 pwg_query($q); 57 $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit)VALUES (3,"Posted on",3,0,0);'; 58 pwg_query($q); 59 $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit)VALUES (4,"Dimensions",4,0,0);'; 60 pwg_query($q); 61 $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit)VALUES (5,"File",5,0,0);'; 62 pwg_query($q); 63 $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit)VALUES (6,"Filesize",6,0,0);'; 64 pwg_query($q); 65 $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit)VALUES (7,"Tags",7,0,0);'; 66 pwg_query($q); 67 $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit)VALUES (8,"Albums",8,0,0);'; 68 pwg_query($q); 69 $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit)VALUES (9,"Visits",9,0,0);'; 70 pwg_query($q); 71 $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit)VALUES (10,"Average",10,0,0);'; 72 pwg_query($q); 73 $q = 'INSERT INTO ' . $prefixeTable . 'add_properties_photos(id_prop_pho,wording,orderprop,active,edit)VALUES (11,"Who can see this photo?",11,0,0);'; 74 pwg_query($q); 52 $activ=unserialize($conf['picture_informations']); 53 if($activ['author']==true){$activauteur=0;}else{$activauteur=1;} 54 if($activ['created_on']==true){$activco=0;}else{$activco=1;} 55 if($activ['posted_on']==true){$activpo=0;}else{$activpo=1;} 56 if($activ['dimensions']==true){$activdim=0;}else{$activdim=1;} 57 if($activ['file']==true){$activfile=0;}else{$activfile=1;} 58 if($activ['filesize']==true){$activfilesize=0;}else{$activfilesize=1;} 59 if($activ['tags']==true){$activtags=0;}else{$activtags=1;} 60 if($activ['categories']==true){$activcategories=0;}else{$activcategories=1;} 61 if($activ['visits']==true){$activvisits=0;}else{$activvisits=1;} 62 if($activ['rating_score']==true){$activrs=0;}else{$activrs=1;} 63 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 ;'; 77 pwg_query($q); 75 78 76 79 }
Note: See TracChangeset
for help on using the changeset viewer.