[ Index ] |
|
Code source de e107 0.7.8 |
1 //USAGE: {EXTENDED=<field_name>.[text|value|icon|text_value].<user_id>} 2 //EXAMPLE: {EXTENDED=gender.value.5} will show the value of the extended field user_gender for user #5 3 include(e_LANGUAGEDIR.e_LANGUAGE."/lan_user_extended.php"); 4 $parms = explode(".", $parm); 5 global $currentUser, $sql, $tp, $loop_uid, $e107, $sc_style; 6 if(isset($loop_uid) && intval($loop_uid) == 0) { return ""; } 7 $key = $parms[0].".".$parms[1]; 8 $sc_style['USER_EXTENDED']['pre'] = (isset($sc_style['USER_EXTENDED'][$key]['pre']) ? $sc_style['USER_EXTENDED'][$key]['pre'] : ""); 9 $sc_style['USER_EXTENDED']['post'] = (isset($sc_style['USER_EXTENDED'][$key]['post']) ? $sc_style['USER_EXTENDED'][$key]['post'] : ""); 10 include_once(e_HANDLER."user_extended_class.php"); 11 $ueStruct = e107_user_extended::user_extended_getStruct(); 12 13 $uid = intval($parms[2]); 14 if($uid == 0) 15 { 16 if(isset($loop_uid) && intval($loop_uid) > 0) 17 { 18 $uid = $loop_uid; 19 } 20 else 21 { 22 $uid = USERID; 23 } 24 } 25 26 $udata = get_user_data($uid); 27 28 $udata['user_class'] .= ($udata['user_class'] == "" ? "" : ","); 29 $udata['user_class'] .= e_UC_PUBLIC.",".e_UC_MEMBER; 30 if($udata['user_admin'] == 1) 31 { 32 $udata['user_class'].= ",".e_UC_ADMIN; 33 } 34 35 if ( 36 !check_class($ueStruct["user_".$parms[0]]['user_extended_struct_applicable'], $udata['user_class']) 37 || !check_class($ueStruct["user_".$parms[0]]['user_extended_struct_read']) 38 || ($ueStruct["user_".$parms[0]]['user_extended_struct_read'] == e_UC_READONLY && (!ADMIN && $udata['user_id'] != USERID)) 39 || (!ADMIN && substr($ueStruct["user_".$parms[0]]['user_extended_struct_parms'], -1) == 1 40 && strpos($udata['user_hidden_fields'], "^user_".$parms[0]."^") !== FALSE && $uid != USERID) 41 ) 42 { 43 return FALSE; 44 } 45 46 if($parms[1] == 'text_value') 47 { 48 $_value = $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.value}"); 49 if($_value) 50 { 51 $__pre = (isset($sc_style['USER_EXTENDED'][$key]['pre']) ? $sc_style['USER_EXTENDED'][$key]['pre'] : ""); 52 $__post = (isset($sc_style['USER_EXTENDED'][$key]['post']) ? $sc_style['USER_EXTENDED'][$key]['post'] : ""); 53 $_text = $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.text}"); 54 $_mid = (isset($sc_style['USER_EXTENDED'][$key]['mid']) ? $sc_style['USER_EXTENDED'][$key]['mid'] : ""); 55 return $__pre.$_text.$_mid.$_value.$__post; 56 } 57 return false; 58 } 59 60 if ($parms[1] == 'text') 61 { 62 $text_val = $ueStruct["user_".$parms[0]]['user_extended_struct_text']; 63 if($text_val) 64 { 65 return (defined($text_val) ? constant($text_val) : $text_val); 66 } 67 else 68 { 69 return TRUE; 70 } 71 } 72 73 if ($parms[1] == 'icon') 74 { 75 if(defined(strtoupper($parms[0])."_ICON")) 76 { 77 return constant(strtoupper($parms[0])."_ICON"); 78 } 79 elseif(file_exists(e_IMAGE."user_icons/{$parms[0]}.png")) 80 { 81 return "<img src='".e_IMAGE."user_icons/{$parms[0]}.png' style='width:16px; height:16px' alt='' />"; 82 } 83 return ""; 84 } 85 86 if ($parms[1] == 'value') 87 { 88 $uVal = str_replace(chr(1), "", $udata['user_'.$parms[0]]); 89 // check for db_lookup type 90 if($ueStruct["user_".$parms[0]]['user_extended_struct_type'] == '4') 91 { 92 $tmp = explode(",",$ueStruct["user_".$parms[0]]['user_extended_struct_values']); 93 if($sql->db_Select($tmp[0],"{$tmp[1]}, {$tmp[2]}","{$tmp[1]} = '{$uVal}'")) 94 { 95 $row = $sql->db_Fetch(); 96 $ret_data = $row[$tmp[2]]; 97 } 98 else 99 { 100 $ret_data = FALSE; 101 } 102 } 103 else 104 { 105 //check for 0000-00-00 in date field 106 if($ueStruct["user_".$parms[0]]['user_extended_struct_type'] == '7') 107 { 108 if($uVal == "0000-00-00") { $uVal = ""; } 109 } 110 $ret_data = $uVal; 111 } 112 if($ret_data != "") 113 { 114 return $tp->toHTML($ret_data, TRUE, "no_make_clickable", "class:{$udata['user_class']}"); 115 } 116 return FALSE; 117 } 118 return FALSE;
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Apr 1 01:23:32 2007 | par Balluche grâce à PHPXref 0.7 |