Changeset 27458 for extensions/Photo_add_by
- Timestamp:
- Feb 23, 2014, 9:08:38 AM (10 years ago)
- Location:
- extensions/Photo_add_by
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Photo_add_by/admin/admin.php
r21231 r27458 45 45 $options['Average'] = l10n('Rating score'); 46 46 47 48 49 47 $template->assign( 50 48 'gestionA', 51 49 array( 52 50 'OPTIONS' => $options, 53 'SELECTED' => $selected 51 'SELECTED' => $selected, 54 52 )); 55 56 53 57 if (isset($_POST['infopab'])) 54 $PASPBY = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'see_photos_by_user';")); 55 if($PASPBY['state'] == 'active') 56 { 57 $PABS2T = array( 58 l10n('No'), 59 l10n('Yes'), 60 ); 61 62 $PABS2 = array( 63 '0', 64 '1', 65 ); 66 67 $template->assign( 68 'gestionB', 69 array( 70 'TOTO' => 'toto', 71 )); 72 global $conf; 73 $template->assign('pabs2', $PABS2); 74 $template->assign('pabs2t', $PABS2T); 75 $template->assign('PABS', $conf['Photo_add_by_show']); 76 77 } 78 79 if (isset($_POST['submitpab'])) 58 80 { 59 81 conf_update_param('Photo_add_by', $_POST['infopab']); 82 if($PASPBY['state'] == 'active') 83 { 84 conf_update_param('Photo_add_by_show', $_POST['inspabs2']); 85 $template->assign( 86 'gestionB', 87 array( 88 'TOTO' => 'toto', 89 )); 90 $template->assign('PABS', $_POST['inspabs2']); 91 } 60 92 $template->delete_compiled_templates(); 61 93 array_push($page['infos'], l10n('Your configuration settings are saved')); … … 66 98 array( 67 99 'OPTIONS' => $options, 68 'SELECTED' => $selected 100 'SELECTED' => $selected, 69 101 )); 70 71 72 73 102 } 74 103 break; -
extensions/Photo_add_by/admin/admin.tpl
r21231 r27458 3 3 </div> 4 4 {if isset ($gestionA)} 5 <div> 6 <form method="post" > 7 <fieldset> 8 <legend>{'Add information before'|@translate}</legend> 9 {html_options name="infopab" options=$gestionA.OPTIONS selected=$gestionA.SELECTED} 10 <br> 11 <br> 12 <div style="text-align:center;"> 13 <input class="submit" name="submitpab" type="submit" value="{'Save Settings'|@translate}"> 14 </div> 15 </fieldset> 16 </form> 17 </div> 5 <div> 6 <form method="post" > 7 <fieldset> 8 <legend></legend> 9 <p> 10 <strong>{'Add information before'|@translate}</strong> 11 {html_options name="infopab" options=$gestionA.OPTIONS selected=$gestionA.SELECTED} 12 </p> 13 {if isset ($gestionB)} 14 <p> 15 <strong>{'Link on users'|@translate}</strong> 16 {html_options name="inspabs2" values=$pabs2 output=$pabs2t selected="{$PABS}"} 17 ({'parameter show from the plugin'|@translate} "{'See photos by user'|@translate}") 18 </p> 18 19 {/if} 20 <p> 21 <div style="text-align:center;"> 22 <input class="submit" name="submitpab" type="submit" value="{'Save Settings'|@translate}"> 23 </div> 24 </p> 25 </fieldset> 26 </form> 27 </div> 28 {/if} -
extensions/Photo_add_by/initpicture.php
r26560 r27458 17 17 18 18 $search = '#<div id="'.$conf['Photo_add_by'].'" class="imageInfo">#'; 19 19 20 20 $replacement = ' 21 21 {if $PAB} … … 49 49 $row = pwg_db_fetch_assoc($result); 50 50 $userab=$row['added_by']; 51 51 52 52 $query = ' 53 53 select '.$conf['user_fields']['username'].' AS username … … 59 59 $pab=$row['username']; 60 60 61 $PASPBY = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'see_photos_by_user';")); 62 $showpab = $conf['Photo_add_by_show']; 63 if($showpab == 1 and $PASPBY['state'] == 'active') 64 { 65 $query2 = ' 66 SELECT UT.id, UT.username, COUNT(DISTINCT(IT.id)) AS PBU, IT.id 67 FROM ' . USERS_TABLE . ' as UT 68 INNER JOIN '.IMAGES_TABLE.' AS IT ON IT.added_by = UT.id 69 INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON IT.id = ic.image_id 70 '.get_sql_condition_FandF 71 ( 72 array 73 ( 74 'forbidden_categories' => 'category_id', 75 'visible_categories' => 'category_id', 76 'visible_images' => 'id' 77 ), 78 'WHERE' 79 ).' 80 GROUP BY IT.added_by 81 HAVING PBU >'.$conf['see_photos_by_user_nbphotos'].' 82 ORDER BY '.$conf['see_photos_by_user_order'].' 83 LIMIT '.$conf['see_photos_by_user_limit'].';'; 61 84 62 // Envoi des données au template 63 $template->assign ( 64 array ( 65 'PAB' => $pab, 66 ) ); 85 $result2 = pwg_query($query2); 86 87 $userok = array(); 88 while ($row2 = pwg_db_fetch_assoc($result2)) 89 { 90 $userok[] = $row2['username']; 91 } 92 if(in_array($pab, $userok) and $showpab == 1 and $PASPBY['state'] == 'active') 93 { 94 $urlpab = get_root_url().'index.php?/user-'.($pab); 95 $pab2 ='<a href="'.$urlpab.'">'.$pab.'</a>'; 96 } 97 else 98 { 99 $pab2=$pab; 100 } 101 } 102 else 103 { 104 $pab2=$pab; 105 } 106 $template->assign(array('PAB' => $pab2,)); 107 67 108 } 68 109 } -
extensions/Photo_add_by/language/en_UK/plugin.lang.php
r21231 r27458 2 2 $lang['Photo added by'] = 'Photo added by'; 3 3 $lang['Add information before'] = 'Add information before'; 4 $lang['Link on users'] = 'Link on users'; 5 $lang['parameter show from the plugin'] = 'parameter show from the plugin'; 4 6 ?> -
extensions/Photo_add_by/language/fr_FR/plugin.lang.php
r22050 r27458 2 2 $lang['Photo added by'] = 'Photo Ajoutée par'; 3 3 $lang['Add information before'] = 'Ajouter l\'information avant'; 4 $lang['Link on users'] = 'Liens sur les utilisateurs'; 5 $lang['parameter show from the plugin'] = 'Parametre d\'affichage issus du plugin'; 4 6 ?> -
extensions/Photo_add_by/main.inc.php
r21222 r27458 26 26 function PAB_admin_menu($menu) 27 27 { 28 load_language('plugin.lang', PAB_PATH); 28 29 array_push($menu, array( 29 'NAME' => 'Photo added by',30 'NAME' => l10n('Photo added by'), 30 31 'URL' => get_admin_plugin_menu_link(PAB_PATH . 'admin/admin.php'))); 31 32 return $menu; -
extensions/Photo_add_by/maintain.inc.php
r21630 r27458 6 6 function plugin_install() 7 7 { 8 $query = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) VALUES ("Photo_add_by","datecreate","Photo_add_by");'; 9 pwg_query($query); 8 10 9 } 11 10 … … 13 12 { 14 13 global $conf; 15 if (empty($conf['Photo_add_by'])) 16 { 17 $query = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) VALUES ("Photo_add_by","datecreate","Photo_add_by");'; 18 pwg_query($query); 19 } 14 if (!isset($conf['Photo_add_by'])) 15 { 16 conf_update_param('Photo_add_by', 'datecreate'); 17 } 18 if (!isset($conf['Photo_add_by_show'])) 19 { 20 conf_update_param('Photo_add_by_show', '0'); 21 } 22 23 20 24 } 21 25 … … 23 27 function plugin_uninstall() 24 28 { 25 $q = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param="Photo_add_by" LIMIT 1;'; 26 pwg_query($q); 29 conf_delete_param('Photo_add_by_show','Photo_add_by'); 27 30 } 28 31 ?>
Note: See TracChangeset
for help on using the changeset viewer.