00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 if (file_exists("$setup_folder/profile_options.php"))
00017 include "$setup_folder/profile_options.php";
00018
00019 if( !is_array( $profile_options ) || !array_key_exists( "tiny_width", $profile_options ) )
00020 {
00021 $profile_options = array(
00022 "profiles_view" => "0",
00023 "profiles_contact" => "2",
00024 "profiles_menu" => "100",
00025 "profiles_mypage" => "4",
00026 "avatar_maxwidth" => 800,
00027 "avatar_maxheight" => 600,
00028 "thumbnail_width" => 120,
00029 "thumbnail_height" => 120,
00030 "thumbnail_disable" => "",
00031 "tiny_width" => 16,
00032 "tiny_height" => 16,
00033 "contact_fields" => array(
00034 "MSN" => array(
00035 "name" => "MSN",
00036 "description" => "MSN Messenger",
00037 "image" => "msn.gif",
00038 "url" => "http://www.msn.com/",
00039 "regexp" => ".+@.+\..+."),
00040 "ICQ" => array(
00041 "name" => "ICQ",
00042 "description" => "I Seek U",
00043 "image" => "icq.gif",
00044 "url" => "http://wwp.icq.com/scripts/search.dll?to=$$",
00045 "regexp" => ".*"),
00046 "Y!" => array(
00047 "name" => "Y!",
00048 "description" => "Yahoo! Messenger",
00049 "image" => "yahoo.gif",
00050 "url" => "http://edit.yahoo.com/config/send_webmesg?.target=$$&.src=pg",
00051 "regexp" => ".*"),
00052 "AIM" => array(
00053 "name" => "AIM",
00054 "description" => "AOL Instant Messenger",
00055 "image" => "aim.gif",
00056 "url" => "aim:goim%3Fscreenname=$$&message=Hello+Are+you+there%3F",
00057 "regexp" => ".*"),
00058 "Jabber" => array(
00059 "name" => "Jabber",
00060 "description" => "Jabber XMPP Based Instant Messenger",
00061 "image" => "jabber.gif",
00062 "url" => "http://www.jabber.org/",
00063 "regexp" => ".+@.+\..+."),
00064 "Google Talk" => array(
00065 "name" => "Google Talk",
00066 "description" => "Google's voice-chat enabled Jabber-based Instant Messenger",
00067 "image" => "gtalk.gif",
00068 "url" => "http://www.google.com/talk/",
00069 "regexp" => ".+@gmail\.com"),
00070 "Skype" => array(
00071 "name" => "Skype",
00072 "description" => "Skype Internet Telephony",
00073 "image" => "skype.gif",
00074 "url" => "skype:$$?call",
00075 "regexp" => ".*"),
00076 "WWW" => array(
00077 "name" => "WWW",
00078 "description" => "Homepage address (remember http://)",
00079 "image" => "www.gif",
00080 "url" => "$$",
00081 "regexp" => ".*")
00082 )
00083 );
00084 saveProfileOptions();
00085 }
00086
00090 function saveProfileOptions()
00091 {
00092 global $setup_folder, $profile_options;
00093 unlink( "$setup_folder/profile_options.php" );
00094 file_put_contents( "$setup_folder/profile_options.php", array_export( $profile_options, "profile_options" ) );
00095 }
00096
00101 function makeRandomPassword($n=8, $chars='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890') {
00102 $m=strlen($chars);
00103 while($n--) {
00104 $x.=substr($chars,rand()%$m,1);
00105 }
00106 return $x;
00107 }
00108
00113 function validateEmail($email){
00114 $exp = ".+@.+\..+.";
00115 if(eregi($exp,$email)){
00116 $exploded = explode("@",$email);
00117 $popped = array_pop($exploded);
00118 if(checkdnsrr($popped,"MX")){
00119 return true;
00120 }else{
00121 return false;
00122 }
00123 } else {
00124 return false;
00125 }
00126 }
00127
00135 function getAvatar( $username = "" )
00136 {
00137 global $userinfo_folder, $setup_folder;
00138 $avatarfile = "$setup_folder/images/noavatar.png";
00139
00140 if( $username == "" )
00141 $avatarfile = $avatarfile;
00142 else if( file_exists("$userinfo_folder/$username/avatar.jpg") )
00143 $avatarfile = "$userinfo_folder/$username/avatar.jpg";
00144 else if( file_exists("$userinfo_folder/$username/avatar.png") )
00145 $avatarfile = "$userinfo_folder/$username/avatar.png";
00146 else if( file_exists("$userinfo_folder/$username/avatar.gif") )
00147 $avatarfile = "$userinfo_folder/$username/avatar.gif";
00148
00149 return $avatarfile;
00150 }
00151
00160 function getAvatarThumbnail( $username, $tiny = false )
00161 {
00162 global $userinfo_folder, $setup_folder, $profile_options;
00163
00164 $avatarfile = getAvatar( $username );
00165 $avatarthumbfile = "$userinfo_folder/$username/avatar-thumb" . substr( $avatarfile, -4 );
00166 $avatartinyfile = "$userinfo_folder/$username/avatar-tiny" . substr( $avatarfile, -4 );
00167
00168 if( !file_exists($avatarthumbfile) )
00169 $avatarthumbfile = $avatarfile;
00170
00171 if( $tiny )
00172 {
00173 if( !file_exists($avatartinyfile) )
00174 {
00175 if( file_exists( $avatarthumbfile ) )
00176 scaleImage( $avatarthumbfile, $avatartinyfile, $profile_options["tiny_width"], $profile_options["tiny_height"] );
00177 }
00178 $avatarthumbfile = $avatartinyfile;
00179 }
00180
00181 return $avatarthumbfile;
00182 }
00183
00195 function getAvatarThumbSize( $username, $tiny = false )
00196 {
00197 $avatarfile = getAvatarThumbnail($username, $tiny);
00198 $avatarinfofile = $avatarfile . ".php";
00199 if( file_exists($avatarinfofile) )
00200 {
00201 include($avatarinfofile);
00202 }
00203 else
00204 {
00205 $avatarsizes = getimagesize($avatarfile);
00206 file_put_contents( $avatarinfofile, array_export( $avatarsizes, "avatarsizes" ) );
00207 }
00208
00209 return $avatarsizes;
00210 }
00211
00212 ?>