| 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 | $t_name = 'user_general'; |
|---|
| 27 | $user_access['general'] = get_access_list($url_id, $t_name); |
|---|
| 28 | |
|---|
| 29 | $t_fields = implode(',', array_keys($table_fields[$t_name])); |
|---|
| 30 | $user_general = $db->query('SELECT ! FROM ! WHERE id=?', array($t_fields, $t_name, $url_id) ); |
|---|
| 31 | |
|---|
| 32 | if(!DB::isError($user_general) ) |
|---|
| 33 | { |
|---|
| 34 | $table_info = $user_general->tableInfo(); |
|---|
| 35 | $profile = $user_general->FetchRow(); |
|---|
| 36 | foreach($table_info as $item) |
|---|
| 37 | { |
|---|
| 38 | if( array_key_exists($item['name'], $user_access['general']) && (access_weight($user_access['general'][$item['name']]) <= access_weight($user['relation_type']) ) ) |
|---|
| 39 | continue; |
|---|
| 40 | elseif($profile[$item['name']] == NULL || $profile[$item['name']] == "") |
|---|
| 41 | continue; |
|---|
| 42 | elseif($item['type'] == 'date') |
|---|
| 43 | { |
|---|
| 44 | list($year, $month, $day) = explode('-', $profile[$item['name']]); |
|---|
| 45 | $date = getdate(mktime (0,0,0,$month,$day,$year)); |
|---|
| 46 | $value = $date['mday'].' '._($date['month']).' '.$date['year']; |
|---|
| 47 | } |
|---|
| 48 | elseif(ereg('set', $item['flags'])) |
|---|
| 49 | { |
|---|
| 50 | $translated_thing = array(); |
|---|
| 51 | $things = explode(',', $profile[$item['name']]); |
|---|
| 52 | foreach($things as $thing) |
|---|
| 53 | array_push($translated_thing, _($labels['profile'][$item['name']][$thing])); |
|---|
| 54 | $value = implode(", ", $translated_thing); |
|---|
| 55 | } |
|---|
| 56 | else |
|---|
| 57 | { |
|---|
| 58 | if(array_key_exists( $profile[$item['name']], (array)$labels['profile'][$item['name']]) ) |
|---|
| 59 | $value = _($labels['profile'][$item['name']][$profile[$item['name']]]); |
|---|
| 60 | else |
|---|
| 61 | $value = $profile[$item['name']]; |
|---|
| 62 | |
|---|
| 63 | } |
|---|
| 64 | |
|---|
| 65 | $key = $table_fields['user_general'][$item['name']]; |
|---|
| 66 | $user['general'][$key] = _($value); |
|---|
| 67 | } |
|---|
| 68 | } |
|---|
| 69 | else |
|---|
| 70 | error_log($_SERVER['HTTP_HOST'].' | '.__FILE__.' | '.$user_general->getUserInfo()); |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | $t_name = 'user_interests'; |
|---|
| 74 | $user_access['interests'] = get_access_list($url_id, $t_name); |
|---|
| 75 | |
|---|
| 76 | $t_fields = implode(',', array_keys($table_fields[$t_name])); |
|---|
| 77 | $user_interests = $db->query('SELECT ! FROM ! WHERE id=?', array($t_fields, $t_name, $url_id) ); |
|---|
| 78 | |
|---|
| 79 | if(!DB::isError($user_interests) ) |
|---|
| 80 | { |
|---|
| 81 | $table_info = $user_interests->tableInfo(); |
|---|
| 82 | $profile = $user_interests->FetchRow(); |
|---|
| 83 | foreach($table_info as $item) |
|---|
| 84 | { |
|---|
| 85 | 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']) ) ) |
|---|
| 86 | continue; |
|---|
| 87 | elseif($profile[$item['name']] == NULL || $profile[$item['name']] == "") |
|---|
| 88 | continue; |
|---|
| 89 | elseif($item['type'] == 'date') |
|---|
| 90 | { |
|---|
| 91 | list($year, $month, $day) = explode('-', $profile[$item['name']]); |
|---|
| 92 | $date = getdate(mktime (0,0,0,$month,$day,$year)); |
|---|
| 93 | $value = $date['mday'].' '._($date['month']).' '.$date['year']; |
|---|
| 94 | } |
|---|
| 95 | elseif(ereg('set', $item['flags'])) |
|---|
| 96 | { |
|---|
| 97 | $translated_thing = array(); |
|---|
| 98 | $things = explode(',', $profile[$item['name']]); |
|---|
| 99 | foreach($things as $thing) |
|---|
| 100 | array_push($translated_thing, _($labels['profile'][$item['name']][$thing])); |
|---|
| 101 | $value = implode(", ", $translated_thing); |
|---|
| 102 | } |
|---|
| 103 | else |
|---|
| 104 | { |
|---|
| 105 | if(array_key_exists( $profile[$item['name']], (array)$labels['profile'][$item['name']]) ) |
|---|
| 106 | $value = _($labels['profile'][$item['name']][$profile[$item['name']]]); |
|---|
| 107 | else |
|---|
| 108 | $value = $profile[$item['name']]; |
|---|
| 109 | |
|---|
| 110 | } |
|---|
| 111 | |
|---|
| 112 | $key = $table_fields['user_interests'][$item['name']]; |
|---|
| 113 | $user['interests'][$key] = _($value); |
|---|
| 114 | } |
|---|
| 115 | } |
|---|
| 116 | else |
|---|
| 117 | error_log($_SERVER['HTTP_HOST'].' | '.__FILE__.' | '.$user_interests->getUserInfo()); |
|---|
| 118 | |
|---|
| 119 | |
|---|
| 120 | $t_name = 'user_contact'; |
|---|
| 121 | $user_access['contact'] = get_access_list($url_id, $t_name); |
|---|
| 122 | |
|---|
| 123 | $t_fields = implode(',', array_keys($table_fields[$t_name])); |
|---|
| 124 | $user_contact = $db->query('SELECT ! FROM ! WHERE id=?', array($t_fields, $t_name, $url_id) ); |
|---|
| 125 | |
|---|
| 126 | if(!DB::isError($user_contact) ) |
|---|
| 127 | { |
|---|
| 128 | $table_info = $user_contact->tableInfo(); |
|---|
| 129 | $profile = $user_contact->FetchRow(); |
|---|
| 130 | foreach($table_info as $item) |
|---|
| 131 | { |
|---|
| 132 | 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']) ) ) |
|---|
| 133 | continue; |
|---|
| 134 | elseif($profile[$item['name']] == NULL || $profile[$item['name']] == "") |
|---|
| 135 | continue; |
|---|
| 136 | elseif($item['type'] == 'date') |
|---|
| 137 | { |
|---|
| 138 | list($year, $month, $day) = explode('-', $profile[$item['name']]); |
|---|
| 139 | $date = getdate(mktime (0,0,0,$month,$day,$year)); |
|---|
| 140 | $value = $date['mday'].' '._($date['month']).' '.$date['year']; |
|---|
| 141 | } |
|---|
| 142 | elseif(ereg('set', $item['flags'])) |
|---|
| 143 | { |
|---|
| 144 | $translated_thing = array(); |
|---|
| 145 | $things = explode(',', $profile[$item['name']]); |
|---|
| 146 | foreach($things as $thing) |
|---|
| 147 | array_push($translated_thing, _($labels['profile'][$item['name']][$thing])); |
|---|
| 148 | $value = implode(", ", $translated_thing); |
|---|
| 149 | } |
|---|
| 150 | else |
|---|
| 151 | { |
|---|
| 152 | if(array_key_exists( $profile[$item['name']], (array)$labels['profile'][$item['name']]) ) |
|---|
| 153 | $value = _($labels['profile'][$item['name']][$profile[$item['name']]]); |
|---|
| 154 | else |
|---|
| 155 | $value = $profile[$item['name']]; |
|---|
| 156 | |
|---|
| 157 | } |
|---|
| 158 | |
|---|
| 159 | $user['contact'][$item['name']]['key'] = $table_fields['user_contact'][$item['name']]; |
|---|
| 160 | $user['contact'][$item['name']]['value'] = $value; |
|---|
| 161 | |
|---|
| 162 | } |
|---|
| 163 | } |
|---|
| 164 | else |
|---|
| 165 | error_log($_SERVER['HTTP_HOST'].' | '.__FILE__.' | '.$user_contact->getUserInfo()); |
|---|
| 166 | ?> |
|---|