| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | if($rss_blog = $db->getRow('SELECT id_blog, title, link, rss FROM rss_blog WHERE id=?', array($url_id)) ) |
|---|
| 28 | { |
|---|
| 29 | $ticket = $db->getRow('SELECT id_ticket, title, description, link, date, description, content FROM rss_blog_ticket WHERE id=? ORDER BY date DESC LIMIT 1', array($url_id)); |
|---|
| 30 | $_SMARTY['blog_rss'] = $ticket; |
|---|
| 31 | } |
|---|
| 32 | else |
|---|
| 33 | { |
|---|
| 34 | $blog = $db->getRow('SELECT blog.id as id, id_blog, blog.id_cat,title, chapeau, ticket, date, status, blog_categorie.name as categorie, nb_comments FROM blog LEFT JOIN blog_categorie USING (id,id_cat) WHERE blog.id=? AND blog.status=? ORDER BY date DESC LIMIT 1', array($url_id, 'online') ); |
|---|
| 35 | $_SMARTY['blog'] = $blog; |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | $bookmarks_r = $db->query('SELECT link, comment FROM bookmarks WHERE id=? ORDER BY date DESC LIMIT 0,4', array($url_id)); |
|---|
| 42 | while($bookmark = $bookmarks_r->fetchRow()) |
|---|
| 43 | $bookmarks[] = $bookmark; |
|---|
| 44 | $_SMARTY['bookmarks'] = $bookmarks; |
|---|
| 45 | |
|---|
| 46 | $albums_r = $db->query('SELECT caption,id_image, width, height FROM album WHERE id=? ORDER BY date DESC LIMIT 0,3', array($url_id)); |
|---|
| 47 | while($photo = $albums_r->fetchRow()) |
|---|
| 48 | { |
|---|
| 49 | $photo['thumb_path'] = build_album_thumb_url($url_id, $photo['id_image']); |
|---|
| 50 | $albums[] = $photo; |
|---|
| 51 | } |
|---|
| 52 | $_SMARTY['albums'] = $albums; |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | |
|---|
| 56 | $t_name = 'user_general'; |
|---|
| 57 | $user_access['general'] = get_access_list($url_id, $t_name); |
|---|
| 58 | |
|---|
| 59 | $t_fields = implode(',', array_keys($table_fields[$t_name])); |
|---|
| 60 | $user_general = $db->query('SELECT ! FROM ! WHERE id=?', array($t_fields, $t_name, $url_id) ); |
|---|
| 61 | |
|---|
| 62 | if(!DB::isError($user_general) ) |
|---|
| 63 | { |
|---|
| 64 | $table_info = $user_general->tableInfo(); |
|---|
| 65 | $profile = $user_general->FetchRow(); |
|---|
| 66 | foreach($table_info as $item) |
|---|
| 67 | { |
|---|
| 68 | if( array_key_exists($item['name'], $user_access['general']) && (access_weight($user_access['general'][$item['name']]) <= access_weight($user['relation_type']) ) ) |
|---|
| 69 | continue; |
|---|
| 70 | elseif($profile[$item['name']] == NULL || $profile[$item['name']] == "") |
|---|
| 71 | continue; |
|---|
| 72 | elseif($item['type'] == 'date') |
|---|
| 73 | { |
|---|
| 74 | list($year, $month, $day) = explode('-', $profile[$item['name']]); |
|---|
| 75 | $date = getdate(mktime (0,0,0,$month,$day,$year)); |
|---|
| 76 | $value = $date['mday'].' '._($date['month']).' '.$date['year']; |
|---|
| 77 | } |
|---|
| 78 | elseif(ereg('set', $item['flags'])) |
|---|
| 79 | { |
|---|
| 80 | $translated_thing = array(); |
|---|
| 81 | $things = explode(',', $profile[$item['name']]); |
|---|
| 82 | foreach($things as $thing) |
|---|
| 83 | array_push($translated_thing, _($labels['profile'][$item['name']][$thing])); |
|---|
| 84 | $value = implode(", ", $translated_thing); |
|---|
| 85 | } |
|---|
| 86 | else |
|---|
| 87 | { |
|---|
| 88 | if(array_key_exists( $profile[$item['name']], (array)$labels['profile'][$item['name']]) ) |
|---|
| 89 | $value = _($labels['profile'][$item['name']][$profile[$item['name']]]); |
|---|
| 90 | else |
|---|
| 91 | $value = $profile[$item['name']]; |
|---|
| 92 | |
|---|
| 93 | } |
|---|
| 94 | |
|---|
| 95 | $key = $table_fields['user_general'][$item['name']]; |
|---|
| 96 | $user['general'][$key] = _($value); |
|---|
| 97 | } |
|---|
| 98 | } |
|---|
| 99 | else |
|---|
| 100 | error_log($_SERVER['HTTP_HOST'].' | '.__FILE__.' | '.$user_general->getUserInfo()); |
|---|
| 101 | |
|---|
| 102 | |
|---|
| 103 | $t_name = 'user_interests'; |
|---|
| 104 | $user_access['interests'] = get_access_list($url_id, $t_name); |
|---|
| 105 | |
|---|
| 106 | $t_fields = implode(',', array_keys($table_fields[$t_name])); |
|---|
| 107 | $user_interests = $db->query('SELECT ! FROM ! WHERE id=?', array($t_fields, $t_name, $url_id) ); |
|---|
| 108 | |
|---|
| 109 | if(!DB::isError($user_interests) ) |
|---|
| 110 | { |
|---|
| 111 | $table_info = $user_interests->tableInfo(); |
|---|
| 112 | $profile = $user_interests->FetchRow(); |
|---|
| 113 | foreach($table_info as $item) |
|---|
| 114 | { |
|---|
| 115 | if( isset($user_access['interests']) && array_key_exists($item['name'], $user_access['interests']) && (access_weight($user_access['interests'][$item['name']]) <= access_weight($user['relation_type']) ) ) |
|---|
| 116 | continue; |
|---|
| 117 | elseif($profile[$item['name']] == NULL || $profile[$item['name']] == "") |
|---|
| 118 | continue; |
|---|
| 119 | elseif($item['type'] == 'date') |
|---|
| 120 | { |
|---|
| 121 | list($year, $month, $day) = explode('-', $profile[$item['name']]); |
|---|
| 122 | $date = getdate(mktime (0,0,0,$month,$day,$year)); |
|---|
| 123 | $value = $date['mday'].' '._($date['month']).' '.$date['year']; |
|---|
| 124 | } |
|---|
| 125 | elseif(ereg('set', $item['flags'])) |
|---|
| 126 | { |
|---|
| 127 | $translated_thing = array(); |
|---|
| 128 | $things = explode(',', $profile[$item['name']]); |
|---|
| 129 | foreach($things as $thing) |
|---|
| 130 | array_push($translated_thing, _($labels['profile'][$item['name']][$thing])); |
|---|
| 131 | $value = implode(", ", $translated_thing); |
|---|
| 132 | } |
|---|
| 133 | else |
|---|
| 134 | { |
|---|
| 135 | if(array_key_exists( $profile[$item['name']], (array)$labels['profile'][$item['name']]) ) |
|---|
| 136 | $value = _($labels['profile'][$item['name']][$profile[$item['name']]]); |
|---|
| 137 | else |
|---|
| 138 | $value = $profile[$item['name']]; |
|---|
| 139 | |
|---|
| 140 | } |
|---|
| 141 | |
|---|
| 142 | $key = $table_fields['user_interests'][$item['name']]; |
|---|
| 143 | $user['interests'][$key] = _($value); |
|---|
| 144 | } |
|---|
| 145 | } |
|---|
| 146 | else |
|---|
| 147 | error_log($_SERVER['HTTP_HOST'].' | '.__FILE__.' | '.$user_interests->getUserInfo()); |
|---|
| 148 | |
|---|
| 149 | |
|---|
| 150 | $t_name = 'user_contact'; |
|---|
| 151 | $user_access['contact'] = get_access_list($url_id, $t_name); |
|---|
| 152 | |
|---|
| 153 | $t_fields = implode(',', array_keys($table_fields[$t_name])); |
|---|
| 154 | $user_contact = $db->query('SELECT ! FROM ! WHERE id=?', array($t_fields, $t_name, $url_id) ); |
|---|
| 155 | |
|---|
| 156 | if(!DB::isError($user_contact) ) |
|---|
| 157 | { |
|---|
| 158 | $table_info = $user_contact->tableInfo(); |
|---|
| 159 | $profile = $user_contact->FetchRow(); |
|---|
| 160 | foreach($table_info as $item) |
|---|
| 161 | { |
|---|
| 162 | if( isset($user_access['contact']) && array_key_exists($item['name'], $user_access['contact']) && (access_weight($user_access['contact'][$item['name']]) <= access_weight($user['relation_type']) ) ) |
|---|
| 163 | continue; |
|---|
| 164 | elseif($profile[$item['name']] == NULL || $profile[$item['name']] == "") |
|---|
| 165 | continue; |
|---|
| 166 | elseif($item['type'] == 'date') |
|---|
| 167 | { |
|---|
| 168 | list($year, $month, $day) = explode('-', $profile[$item['name']]); |
|---|
| 169 | $date = getdate(mktime (0,0,0,$month,$day,$year)); |
|---|
| 170 | $value = $date['mday'].' '._($date['month']).' '.$date['year']; |
|---|
| 171 | } |
|---|
| 172 | elseif(ereg('set', $item['flags'])) |
|---|
| 173 | { |
|---|
| 174 | $translated_thing = array(); |
|---|
| 175 | $things = explode(',', $profile[$item['name']]); |
|---|
| 176 | foreach($things as $thing) |
|---|
| 177 | array_push($translated_thing, _($labels['profile'][$item['name']][$thing])); |
|---|
| 178 | $value = implode(", ", $translated_thing); |
|---|
| 179 | } |
|---|
| 180 | else |
|---|
| 181 | { |
|---|
| 182 | if(array_key_exists( $profile[$item['name']], (array)$labels['profile'][$item['name']]) ) |
|---|
| 183 | $value = _($labels['profile'][$item['name']][$profile[$item['name']]]); |
|---|
| 184 | else |
|---|
| 185 | $value = $profile[$item['name']]; |
|---|
| 186 | |
|---|
| 187 | } |
|---|
| 188 | |
|---|
| 189 | $user['contact'][$item['name']]['key'] = $table_fields['user_contact'][$item['name']]; |
|---|
| 190 | $user['contact'][$item['name']]['value'] = $value; |
|---|
| 191 | |
|---|
| 192 | } |
|---|
| 193 | } |
|---|
| 194 | else |
|---|
| 195 | error_log($_SERVER['HTTP_HOST'].' | '.__FILE__.' | '.$user_contact->getUserInfo()); |
|---|
| 196 | |
|---|
| 197 | |
|---|
| 198 | |
|---|
| 199 | $t_name = 'user_professional'; |
|---|
| 200 | $user_access['professional'] = get_access_list($url_id, $t_name); |
|---|
| 201 | |
|---|
| 202 | $t_fields = implode(',', array_keys($table_fields[$t_name])); |
|---|
| 203 | $user_professional = $db->query('SELECT ! FROM ! WHERE id=?', array($t_fields, $t_name, $url_id) ); |
|---|
| 204 | |
|---|
| 205 | if(!DB::isError($user_professional) ) |
|---|
| 206 | { |
|---|
| 207 | $table_info = $user_professional->tableInfo(); |
|---|
| 208 | $profile = $user_professional->FetchRow(); |
|---|
| 209 | foreach($table_info as $item) |
|---|
| 210 | { |
|---|
| 211 | if( array_key_exists($item['name'], $user_access['professional']) && (access_weight($user_access['professional'][$item['name']]) > access_weight($user['relation_type']) ) ) |
|---|
| 212 | continue; |
|---|
| 213 | elseif($profile[$item['name']] == NULL || $profile[$item['name']] == "") |
|---|
| 214 | continue; |
|---|
| 215 | elseif($item['type'] == 'date') |
|---|
| 216 | { |
|---|
| 217 | list($year, $month, $day) = explode('-', $profile[$item['name']]); |
|---|
| 218 | $date = getdate(mktime (0,0,0,$month,$day,$year)); |
|---|
| 219 | $value = $date['mday'].' '._($date['month']).' '.$date['year']; |
|---|
| 220 | } |
|---|
| 221 | elseif(ereg('set', $item['flags'])) |
|---|
| 222 | { |
|---|
| 223 | $translated_thing = array(); |
|---|
| 224 | $things = explode(',', $profile[$item['name']]); |
|---|
| 225 | foreach($things as $thing) |
|---|
| 226 | array_push($translated_thing, _($labels['profile'][$item['name']][$thing])); |
|---|
| 227 | $value = implode(", ", $translated_thing); |
|---|
| 228 | } |
|---|
| 229 | else |
|---|
| 230 | { |
|---|
| 231 | if(array_key_exists( $profile[$item['name']], (array)$labels['profile'][$item['name']]) ) |
|---|
| 232 | $value = _($labels['profile'][$item['name']][$profile[$item['name']]]); |
|---|
| 233 | else |
|---|
| 234 | $value = $profile[$item['name']]; |
|---|
| 235 | |
|---|
| 236 | } |
|---|
| 237 | |
|---|
| 238 | $key = $table_fields['user_professional'][$item['name']]; |
|---|
| 239 | $user['professional'][$key] = _($value); |
|---|
| 240 | } |
|---|
| 241 | } |
|---|
| 242 | else |
|---|
| 243 | error_log($_SERVER['HTTP_HOST'].' | '.__FILE__.' | '.$user_professional->getUserInfo()); |
|---|
| 244 | |
|---|
| 245 | |
|---|
| 246 | $t_name = 'user_personal'; |
|---|
| 247 | $user_access['personal'] = get_access_list($url_id, $t_name); |
|---|
| 248 | |
|---|
| 249 | $t_fields = implode(',', array_keys($table_fields[$t_name])); |
|---|
| 250 | $user_personal = $db->query('SELECT ! FROM ! WHERE id=?', array($t_fields, $t_name, $url_id) ); |
|---|
| 251 | |
|---|
| 252 | if(!DB::isError($user_personal) ) |
|---|
| 253 | { |
|---|
| 254 | $table_info = $user_personal->tableInfo(); |
|---|
| 255 | $profile = $user_personal->FetchRow(); |
|---|
| 256 | foreach($table_info as $item) |
|---|
| 257 | { |
|---|
| 258 | if( array_key_exists($item['name'], $user_access['personal']) && (access_weight($user_access['personal'][$item['name']]) > access_weight($user['relation_type']) ) ) |
|---|
| 259 | continue; |
|---|
| 260 | elseif($profile[$item['name']] == NULL || $profile[$item['name']] == "") |
|---|
| 261 | continue; |
|---|
| 262 | elseif($item['type'] == 'date') |
|---|
| 263 | { |
|---|
| 264 | list($year, $month, $day) = explode('-', $profile[$item['name']]); |
|---|
| 265 | $date = getdate(mktime (0,0,0,$month,$day,$year)); |
|---|
| 266 | $value = $date['mday'].' '._($date['month']).' '.$date['year']; |
|---|
| 267 | } |
|---|
| 268 | elseif(ereg('set', $item['flags'])) |
|---|
| 269 | { |
|---|
| 270 | $translated_thing = array(); |
|---|
| 271 | $things = explode(',', $profile[$item['name']]); |
|---|
| 272 | foreach($things as $thing) |
|---|
| 273 | array_push($translated_thing, _($labels['profile'][$item['name']][$thing])); |
|---|
| 274 | $value = implode(", ", $translated_thing); |
|---|
| 275 | } |
|---|
| 276 | else |
|---|
| 277 | { |
|---|
| 278 | if(array_key_exists( $profile[$item['name']], (array)$labels['profile'][$item['name']]) ) |
|---|
| 279 | $value = _($labels['profile'][$item['name']][$profile[$item['name']]]); |
|---|
| 280 | else |
|---|
| 281 | $value = $profile[$item['name']]; |
|---|
| 282 | |
|---|
| 283 | } |
|---|
| 284 | |
|---|
| 285 | $key = $table_fields['user_personal'][$item['name']]; |
|---|
| 286 | $user['personal'][$key] = _($value); |
|---|
| 287 | } |
|---|
| 288 | } |
|---|
| 289 | else |
|---|
| 290 | error_log($_SERVER['HTTP_HOST'].' | '.__FILE__.' | '.$user_personal->getUserInfo()); |
|---|
| 291 | |
|---|
| 292 | ?> |
|---|