| 1 | <? |
|---|
| 2 | |
|---|
| 3 | /***************************************************************************
|
|---|
| 4 | * Dolphin Smart Community Builder
|
|---|
| 5 | * -----------------
|
|---|
| 6 | * begin : Mon Mar 23 2006
|
|---|
| 7 | * copyright : (C) 2006 BoonEx Group
|
|---|
| 8 | * website : http://www.boonex.com/
|
|---|
| 9 | * This file is part of Dolphin - Smart Community Builder
|
|---|
| 10 | *
|
|---|
| 11 | * Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License.
|
|---|
| 12 | * http://creativecommons.org/licenses/by/3.0/
|
|---|
| 13 | *
|
|---|
| 14 | * Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|---|
| 15 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|---|
| 16 | * See the Creative Commons Attribution 3.0 License for more details.
|
|---|
| 17 | * You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin,
|
|---|
| 18 | * see license.txt file; if not, write to marketing@boonex.com
|
|---|
| 19 | ***************************************************************************/
|
|---|
| 20 | |
|---|
| 21 | require_once( 'inc/header.inc.php' ); |
|---|
| 22 | require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' ); |
|---|
| 23 | require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' ); |
|---|
| 24 | |
|---|
| 25 | // --------------- page variables and login |
|---|
| 26 | |
|---|
| 27 | //$_page['name_index'] = 38; |
|---|
| 28 | $_page['name_index'] = 44; |
|---|
| 29 | $_page['css_name'] = 'freemail.css'; |
|---|
| 30 | |
|---|
| 31 | $_page['header'] = _t( "_FREEMAIL_H" ); |
|---|
| 32 | |
|---|
| 33 | $logged['member'] = member_auth(0, false); |
|---|
| 34 | |
|---|
| 35 | // --------------- page components |
|---|
| 36 | |
|---|
| 37 | $_ni = $_page['name_index']; |
|---|
| 38 | $_page_cont[$_ni]['page_main_code'] = DesignBoxContent( $_page['header'], PageCompPageMainCode(), $oTemplConfig -> PageFreeMailPop_db_num); |
|---|
| 39 | $_page_cont[$_ni]['body_onload'] = ''; |
|---|
| 40 | |
|---|
| 41 | // --------------- [END] page components |
|---|
| 42 | |
|---|
| 43 | PageCode(); |
|---|
| 44 | |
|---|
| 45 | // --------------- page components functions |
|---|
| 46 | |
|---|
| 47 | /** |
|---|
| 48 | * page code function |
|---|
| 49 | */ |
|---|
| 50 | function PageCompPageMainCode() |
|---|
| 51 | { |
|---|
| 52 | global $_page; |
|---|
| 53 | |
|---|
| 54 | $member['ID'] = (int)$_COOKIE['memberID']; |
|---|
| 55 | |
|---|
| 56 | if ( !$_REQUEST['ID'] ) |
|---|
| 57 | { |
|---|
| 58 | return _t_err( "_No member specified" ); |
|---|
| 59 | } |
|---|
| 60 | |
|---|
| 61 | $ID = getID($_REQUEST['ID'], 0); |
|---|
| 62 | |
|---|
| 63 | if( !$ID ) |
|---|
| 64 | return _t_err("_PROFILE_NOT_AVAILABLE"); |
|---|
| 65 | |
|---|
| 66 | $profile = getProfileInfo( $ID ); |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | // Check if member can get email ADD CART CHECK HERE |
|---|
| 70 | $check_res = checkAction( $member['ID'], ACTION_ID_GET_EMAIL ); |
|---|
| 71 | if ( $check_res[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED ) |
|---|
| 72 | { |
|---|
| 73 | $ret = '<div class="soundPop">' . $check_res[CHECK_ACTION_MESSAGE] . '</div>'; |
|---|
| 74 | return $ret; |
|---|
| 75 | } |
|---|
| 76 | |
|---|
| 77 | // Check if profile found |
|---|
| 78 | |
|---|
| 79 | if( !$profile ) |
|---|
| 80 | { |
|---|
| 81 | $ret = _t_err("_PROFILE_NOT_AVAILABLE"); |
|---|
| 82 | return $ret; |
|---|
| 83 | } |
|---|
| 84 | |
|---|
| 85 | $action_result = ""; |
|---|
| 86 | $get_result = MemberFreeEmail( $member['ID'], $profile ); |
|---|
| 87 | |
|---|
| 88 | switch ( $get_result ) |
|---|
| 89 | { |
|---|
| 90 | case 7: |
|---|
| 91 | $action_result = _t_err( "_PROFILE_NOT_AVAILABLE" ); |
|---|
| 92 | break; |
|---|
| 93 | case 13: |
|---|
| 94 | $action_result = _t_err( "_YOUR PROFILE_IS_NOT_ACTIVE" ); |
|---|
| 95 | break; |
|---|
| 96 | case 20: |
|---|
| 97 | $action_result = _t_err( "_FREEMAIL_NOT_ALLOWED" ); |
|---|
| 98 | break; |
|---|
| 99 | case 21: |
|---|
| 100 | $action_result = _t_err( "_FREEMAIL_ALREADY_SENT", $ID ); |
|---|
| 101 | break; |
|---|
| 102 | case 25: |
|---|
| 103 | $action_result = _t_err( "_FREEMAIL_BLOCK", $ID ); |
|---|
| 104 | break; |
|---|
| 105 | case 44: |
|---|
| 106 | $action_result = _t_err( "_FREEMAIL_NOT_KISSED", $ID ); |
|---|
| 107 | break; |
|---|
| 108 | case 45: |
|---|
| 109 | $action_result = _t_err("_FREEMAIL_ERROR"); |
|---|
| 110 | break; |
|---|
| 111 | default: |
|---|
| 112 | $action_result = _t( "_FREEMAIL_SENT", $profile['NickName'] ); |
|---|
| 113 | break; |
|---|
| 114 | } |
|---|
| 115 | |
|---|
| 116 | if ( $get_result ) |
|---|
| 117 | { |
|---|
| 118 | $_page['header_text'] = _t( "_Contact information not sent" ); |
|---|
| 119 | } |
|---|
| 120 | else |
|---|
| 121 | { |
|---|
| 122 | $_page['header_text'] = _t( "_Contact information sent" ); |
|---|
| 123 | } |
|---|
| 124 | |
|---|
| 125 | |
|---|
| 126 | /* |
|---|
| 127 | if ( $get_result != 0 && $get_result != 25 ) |
|---|
| 128 | $send_form = send_form(); |
|---|
| 129 | else |
|---|
| 130 | $send_form = ""; |
|---|
| 131 | */ |
|---|
| 132 | $ret = '<div class="soundPop">' . $action_result . '</div>' . "\n"; |
|---|
| 133 | |
|---|
| 134 | return $ret; |
|---|
| 135 | } |
|---|
| 136 | |
|---|
| 137 | function MemberFreeEmail( $recipientID, $profile ) |
|---|
| 138 | { |
|---|
| 139 | global $site; |
|---|
| 140 | global $anon_mode; |
|---|
| 141 | |
|---|
| 142 | $recipientID = (int)$recipientID; |
|---|
| 143 | $aRecipientArr = db_arr( "SELECT `Email` FROM `Profiles` WHERE `ID` = '$recipientID' AND `Status` = 'Active'", 0 ); |
|---|
| 144 | |
|---|
| 145 | if ( db_arr( "SELECT `ID` FROM `BlockList` WHERE `ID` = '{$profile['ID']}' AND `Profile` = '$recipientID';", 0 ) ) |
|---|
| 146 | { |
|---|
| 147 | return 25; |
|---|
| 148 | } |
|---|
| 149 | |
|---|
| 150 | |
|---|
| 151 | if ( !db_arr( "SELECT `ID` FROM `Profiles` WHERE `ID` = '{$profile['ID']}' AND `Status` = 'Active'", 0 ) ) |
|---|
| 152 | { |
|---|
| 153 | return 7; |
|---|
| 154 | } |
|---|
| 155 | |
|---|
| 156 | if ($anon_mode) |
|---|
| 157 | { |
|---|
| 158 | return 20; |
|---|
| 159 | } |
|---|
| 160 | |
|---|
| 161 | $message = getParam( "t_FreeEmail" ); |
|---|
| 162 | $subject = getParam('t_FreeEmail_subject'); |
|---|
| 163 | |
|---|
| 164 | if ( $recipientID ) |
|---|
| 165 | { |
|---|
| 166 | $recipient = $aRecipientArr['Email']; |
|---|
| 167 | } |
|---|
| 168 | else |
|---|
| 169 | { |
|---|
| 170 | if ( $_GET['Email'] ) |
|---|
| 171 | $recipient = $_GET['Email']; |
|---|
| 172 | else |
|---|
| 173 | return 45; |
|---|
| 174 | } |
|---|
| 175 | |
|---|
| 176 | $contact_info = "Email: {$profile['Email']}"; |
|---|
| 177 | if ( strlen( $profile['Phone'] ) ) |
|---|
| 178 | $contact_info .= "\nPhone: {$profile['Phone']}"; |
|---|
| 179 | if ( strlen( $profile['HomeAddress'] ) ) |
|---|
| 180 | $contact_info .= "\nHomeAddress: {$profile['HomeAddress']}"; |
|---|
| 181 | if ( strlen( $profile['HomePage'] ) ) |
|---|
| 182 | $contact_info .= "\nHomePage: {$profile['HomePage']}"; |
|---|
| 183 | if ( strlen( $profile['IcqUIN'] ) ) |
|---|
| 184 | $contact_info .= "\nICQ: {$profile['IcqUIN']}"; |
|---|
| 185 | |
|---|
| 186 | $message = str_replace( "<ContactInfo>", $contact_info, $message ); |
|---|
| 187 | $message = str_replace( "<YourRealName>", ($memberID ? $memb_arr['NickName'] : _t("_Visitor")), $message ); |
|---|
| 188 | $message = str_replace( "<NickName>", $profile['NickName'], $message ); |
|---|
| 189 | $message = str_replace( "<StrID>", $profile['ID'], $message ); |
|---|
| 190 | $message = str_replace( "<ID>", $profile['ID'], $message ); |
|---|
| 191 | |
|---|
| 192 | $aPlus = array(); |
|---|
| 193 | $aPlus['profileContactInfo'] = $contact_info; |
|---|
| 194 | $aPlus['profileNickName'] = $profile['NickName']; |
|---|
| 195 | $aPlus['profileID'] = $profile['ID']; |
|---|
| 196 | |
|---|
| 197 | $mail_ret = sendMail( $aRecipientArr['Email'], $subject, $message, $recipientID, $aPlus ); |
|---|
| 198 | |
|---|
| 199 | if ( $mail_ret ) |
|---|
| 200 | // Perform action |
|---|
| 201 | checkAction( $memberID, ACTION_ID_GET_EMAIL, true ); |
|---|
| 202 | else |
|---|
| 203 | return 10; |
|---|
| 204 | |
|---|
| 205 | return 0; |
|---|
| 206 | } |
|---|
| 207 | |
|---|
| 208 | /** |
|---|
| 209 | * Prints HTML code for enter ID |
|---|
| 210 | */ |
|---|
| 211 | /* |
|---|
| 212 | function send_form() |
|---|
| 213 | { |
|---|
| 214 | global $logged; |
|---|
| 215 | |
|---|
| 216 | $ret = ' |
|---|
| 217 | <form action="'. $_SERVER['PHP_SELF'] .'" method=get> |
|---|
| 218 | <div style="position:relative; border:0px solid red; margin-left:30px; margin-top:10px;"> |
|---|
| 219 | <div style="position:relative; border:0px solid red; width:150px; text-align:right; float:left; padding-right:5px; margin-bottom:5px;"> |
|---|
| 220 | '. _t("_Enter profile ID") .': |
|---|
| 221 | </div> |
|---|
| 222 | |
|---|
| 223 | <div style="postion:relative; border:0px solid red; text-align:left; width:300px; margin-bottom:5px;"> |
|---|
| 224 | <input class="no" type="text" size="30" name="ID" /> |
|---|
| 225 | </div>'; |
|---|
| 226 | if ( !$logged['member'] ) |
|---|
| 227 | { |
|---|
| 228 | $ret .= ' |
|---|
| 229 | <div style="position:relative; width:150px; text-align:right; float:left; padding-right:5px; margin-bottom:5px;"> |
|---|
| 230 | '. _t("_Your email") . ': |
|---|
| 231 | </div> |
|---|
| 232 | |
|---|
| 233 | <div style="postion:relative; text-align:left; width:300px; margin-bottom:5px;"> |
|---|
| 234 | <input class="no" type="text" size="30" name="Email" /> |
|---|
| 235 | </div>'; |
|---|
| 236 | } |
|---|
| 237 | $ret .= ' |
|---|
| 238 | <div style="postion:relative; border:0px solid red; text-align:left; width:300px; margin-bottom:5px; margin-left: 100px;"> |
|---|
| 239 | <input class=no type="submit" value="'. _t("_Submit") .'" /> |
|---|
| 240 | </div> |
|---|
| 241 | </div> |
|---|
| 242 | </form>'; |
|---|
| 243 | |
|---|
| 244 | return $ret; |
|---|
| 245 | } |
|---|
| 246 | */ |
|---|
| 247 | |
|---|
| 248 | ?> |
|---|