[26635] | 1 | <?php |
---|
| 2 | global $page, $conf, $user, $template; |
---|
[27391] | 3 | |
---|
[30403] | 4 | /*test URL*/ |
---|
[27391] | 5 | |
---|
[30403] | 6 | $testa = explode('user-', $_SERVER['REQUEST_URI']); |
---|
| 7 | if(!empty($testa[1])){ |
---|
| 8 | $testd = explode('-', $testa[1]); |
---|
| 9 | if(is_numeric($testd[0])){ |
---|
| 10 | |
---|
| 11 | $username= see_username($testd[0]); |
---|
| 12 | |
---|
| 13 | |
---|
| 14 | $me = 'user-' . $testd[0].'-'.$username; |
---|
| 15 | |
---|
| 16 | $page['section'] = $me; |
---|
| 17 | $page['section_title'] = '<a href="' . get_absolute_root_url() . '">' . l10n('Home') . '</a>' . $conf['level_separator'] . '<a href="' . get_absolute_root_url() . 'index.php?/user-">' . l10n('Users').'</a>'. $conf['level_separator'] . '<a href="' . get_absolute_root_url() . 'index.php?/' . $me . '">'.$username. '</a>'; |
---|
[27391] | 18 | |
---|
[30403] | 19 | $template->assign( |
---|
| 20 | 'gestionB', array( |
---|
| 21 | 'USERUSBU' => $username, |
---|
| 22 | )); |
---|
| 23 | |
---|
| 24 | $query = ' |
---|
| 25 | SELECT DISTINCT(id) |
---|
| 26 | FROM ' . IMAGES_TABLE . ' |
---|
| 27 | INNER JOIN ' . IMAGE_CATEGORY_TABLE . ' AS ic ON id = ic.image_id |
---|
| 28 | ' . get_sql_condition_FandF |
---|
| 29 | ( |
---|
| 30 | array |
---|
| 31 | ( |
---|
| 32 | 'forbidden_categories' => 'category_id', |
---|
| 33 | 'visible_categories' => 'category_id', |
---|
| 34 | 'visible_images' => 'id' |
---|
| 35 | ), 'WHERE' |
---|
| 36 | ) . ' |
---|
| 37 | AND added_by = \'' . $testd[0] . '\' |
---|
| 38 | ' . $conf['order_by'] . ' |
---|
| 39 | ;'; |
---|
| 40 | $page = array_merge |
---|
| 41 | ( |
---|
| 42 | $page, array |
---|
| 43 | ( |
---|
| 44 | 'title' => '<a href="' . duplicate_index_url(array('start' => 0)) . '">' . $me . '</a>', |
---|
| 45 | 'items' => array_from_query($query, 'id'), |
---|
| 46 | ) |
---|
| 47 | ); |
---|
| 48 | }else{ |
---|
[30415] | 49 | show_users_home(); |
---|
[30403] | 50 | } |
---|
| 51 | }else{ |
---|
[30415] | 52 | show_users_home(); |
---|
[27391] | 53 | } |
---|
[30415] | 54 | |
---|
[30403] | 55 | /*fin gestion URL*/ |
---|
[27428] | 56 | |
---|
[30415] | 57 | function show_users_home(){ |
---|
| 58 | |
---|
[30403] | 59 | /*users cloud*/ |
---|
| 60 | // template vars |
---|
| 61 | global $page, $conf, $user, $template; |
---|
[30415] | 62 | |
---|
[30403] | 63 | $me = 'user-'; |
---|
| 64 | $page['section'] = $me; |
---|
| 65 | $page['section_title'] = '<a href="' . get_absolute_root_url() . '">' . l10n('Home') . '</a>' . $conf['level_separator'] . '<a href="' . get_absolute_root_url() . 'index.php?/' . $me . '">' . l10n('Users') . '</a>'; |
---|
| 66 | |
---|
[30415] | 67 | $userslistecloud1 = see_userlist_nb_photo(); |
---|
| 68 | $level=see_nb_photo(); |
---|
| 69 | |
---|
[30403] | 70 | if (pwg_db_num_rows($userslistecloud1)) { |
---|
| 71 | while ($userslistecloud = pwg_db_fetch_assoc($userslistecloud1)) { |
---|
[30415] | 72 | if($userslistecloud['PBU']>$level*4/5){$wheight=5;} |
---|
| 73 | else if($userslistecloud['PBU']>$level*3/5){$wheight=4;} |
---|
| 74 | else if($userslistecloud['PBU']>$level*2/5){$wheight=3;} |
---|
| 75 | else if($userslistecloud['PBU']>$level*1/5){$wheight=2;} |
---|
| 76 | else{$wheight=1;} |
---|
| 77 | |
---|
[30403] | 78 | $items = array( |
---|
| 79 | 'USERSSPBYLID' => $userslistecloud['id'], |
---|
| 80 | 'USERSSPBYL' => $userslistecloud['username'], |
---|
| 81 | 'USERSSPBYLC' => $userslistecloud['PBU'], |
---|
[30415] | 82 | 'USERSSPBYWEIGHT' => $wheight, |
---|
[30403] | 83 | ); |
---|
[26635] | 84 | |
---|
[30403] | 85 | $template->append('userslistecloud1', $items); |
---|
| 86 | } |
---|
| 87 | } |
---|
[30415] | 88 | |
---|
| 89 | |
---|
[30403] | 90 | $linkusersliste = get_root_url() . 'index.php?/user-'; |
---|
[30430] | 91 | $template->assign(array( |
---|
| 92 | 'USERSSPBY'=> $linkusersliste, |
---|
| 93 | 'USERSSPBYCOLOR' => $conf['see_photos_by_user_color'], |
---|
| 94 | 'USERSSPBYSHAPE' => $conf['see_photos_by_user_shape'], |
---|
| 95 | )); |
---|
[30415] | 96 | |
---|
| 97 | |
---|
| 98 | if($conf['see_photos_by_user_show_user_home']==1){ |
---|
| 99 | $template->assign( |
---|
| 100 | 'gestionD', array( |
---|
| 101 | 'SPBA_PATH'=> get_root_url() . SPBA_PATH, |
---|
| 102 | )); |
---|
| 103 | }else if($conf['see_photos_by_user_show_user_home']==2){ |
---|
| 104 | $template->assign( |
---|
| 105 | 'gestionC', array( |
---|
| 106 | 'SPBA_PATH'=> get_root_url() . SPBA_PATH, |
---|
| 107 | )); |
---|
| 108 | |
---|
| 109 | }else if($conf['see_photos_by_user_show_user_home']==3){ |
---|
| 110 | $groups = array(); |
---|
| 111 | $result = see_userlist_nb_photo(); |
---|
| 112 | while ($row = pwg_db_fetch_assoc($result)) { |
---|
| 113 | $groups[$row['id']] = $row['username'] . ' (' . $row['PBU'] . ')'; |
---|
| 114 | } |
---|
| 115 | $selected = 0; |
---|
| 116 | if (empty($testd[0])) { |
---|
| 117 | $options['b'] = l10n('select user'); |
---|
| 118 | } else { |
---|
| 119 | $options['b'] = l10n('select other user'); |
---|
| 120 | } |
---|
| 121 | $options['a'] = '----------------------'; |
---|
[30403] | 122 | |
---|
[30415] | 123 | foreach ($groups as $metalist => $metalist2) { |
---|
| 124 | $options[$metalist] = $metalist2; |
---|
| 125 | } |
---|
| 126 | $template->assign( |
---|
| 127 | 'gestionA', array( |
---|
| 128 | 'OPTIONS' => $options, |
---|
| 129 | 'SELECTED' => $selected |
---|
| 130 | )); |
---|
| 131 | if (isset($_POST['submitchoixauteur'])) { |
---|
| 132 | $redirect_url = get_root_url() . 'index.php?/user-'; |
---|
| 133 | if(is_numeric($_POST['metalist'])){ |
---|
| 134 | $query = ' |
---|
| 135 | SELECT id, username |
---|
| 136 | FROM ' . USERS_TABLE . ' |
---|
| 137 | WHERE id = \'' . $_POST['metalist'] . '\' |
---|
| 138 | ;'; |
---|
| 139 | $result = pwg_query($query); |
---|
| 140 | $row = pwg_db_fetch_assoc($result); |
---|
| 141 | $username = $row['username']; |
---|
[26635] | 142 | |
---|
[30415] | 143 | $redirect_url .=($_POST['metalist']).'-'.$username; |
---|
| 144 | } |
---|
| 145 | redirect($redirect_url); |
---|
| 146 | } |
---|
| 147 | }else{} |
---|
[26635] | 148 | |
---|
[30403] | 149 | |
---|
[30415] | 150 | } |
---|
[30403] | 151 | |
---|
| 152 | |
---|
[26635] | 153 | ?> |
---|