function completePartialLogin($mid = "", $key = "", $custom_fields = "", $errors = "", $reg = "", $userFromService = array()) { $IPBHTML = ""; if (IPSLib::locationHasHooks('skin_register', $this->_funcHooks['completePartialLogin'])) { $count_c35fa0162a47fcc491466ff0c651a955 = is_array($this->functionData['completePartialLogin']) ? count($this->functionData['completePartialLogin']) : 0; $this->functionData['completePartialLogin'][$count_c35fa0162a47fcc491466ff0c651a955]['mid'] = $mid; $this->functionData['completePartialLogin'][$count_c35fa0162a47fcc491466ff0c651a955]['key'] = $key; $this->functionData['completePartialLogin'][$count_c35fa0162a47fcc491466ff0c651a955]['custom_fields'] = $custom_fields; $this->functionData['completePartialLogin'][$count_c35fa0162a47fcc491466ff0c651a955]['errors'] = $errors; $this->functionData['completePartialLogin'][$count_c35fa0162a47fcc491466ff0c651a955]['reg'] = $reg; $this->functionData['completePartialLogin'][$count_c35fa0162a47fcc491466ff0c651a955]['userFromService'] = $userFromService; } $IPBHTML .= "" . $this->registry->getClass('output')->addJSModule("register", "0") . "\n<script type='text/javascript'>\n//<![CDATA[\n\tipb.register.inSection\t = \"completeReg\";\n\tipb.register.nameMaxLength = \"{$this->settings['max_user_name_length']}\";\n\tipb.register.allowedChars = \"{$this->settings['username_characters']}\";\n\tipb.register.memberPartial = parseInt('{$mid}');\n\tipb.templates['accept'] = \" <span id='[id]_msg' class='reg_msg reg_accept' style='display: none'><img src='{$this->settings['img_url']}/accept.png' alt='' /> [msg]</span>\";\n\tipb.templates['error'] = \" <span id='[id]_msg' class='reg_msg reg_error' style='display: none'><img src='{$this->settings['img_url']}/exclamation.png' alt='' /> [msg]</span>\";\n//]]>\n</script>\n<div id='register_form'>\t\n\t<h1 class='ipsType_pagetitle'>" . (($this->request['members_display_name'] or $userFromService['_name']) ? "" . sprintf($this->lang->words['connect_sub'], $userFromService['_name'] ? IPSText::utf8ToEntities($userFromService['_name']) : $this->request['members_display_name']) . "" : "{$this->lang->words['connect_sub2']}") . "</h1>\n\t<br />\n\t" . ((count($userFromService) and !empty($userFromService['service'])) ? "\n\t\t<input type='hidden' name='connectService' value='{$userFromService['service']}' />\n\t\t<div id='facebookComplete' class='clearfix'>\n\t\t\t<img src=\"{$userFromService['_pic']}\" class='ipsUserPhoto ipsUserPhoto_medium left' />\n\t\t\t<img src=\"{$userFromService['_sImage']}\" class='servicepic' />\n\t\t\t<p class='ipsBox_withphoto'>\n\t\t\t\t" . sprintf($this->lang->words['connect_sub_desc'], ucfirst($userFromService['service'])) . "\n\t\t\t\t<br />\n\t\t\t\t" . sprintf($this->lang->words['connect_desc'], ucfirst($userFromService['service'])) . "\n\t\t\t</p>\n\t\t</div>\n\t" : "\n\t\t<p class='message'>{$this->lang->words['clogin_text']}</p>\n\t") . "\n\t<br />\n\t" . (!empty($errors) ? "\n\t\t<p class='message error'>\n\t\t\t<strong>{$this->lang->words['errors_found']}</strong>\n\t\t\t{$errors}\n\t\t</p>\n\t\t<br />\n\t" : "") . "\n\t<div id='connect_choose'>\n\t\t<h2 class='ipsType_subtitle'>" . sprintf($this->lang->words['already_have_account'], $this->settings['board_name']) . "</h2>\n\t\t<div class='ipsBox' style='margin-top: 5px'>\n\t\t\t<div class='ipsBox_container ipsPad' style='text-align: center'>\n\t\t\t\t<a href='#connect_new' class='ipsButton' id='choose_new'>{$this->lang->words['need_to_create_acc']}</a> \n\t\t\t\t" . ((count($userFromService) and !empty($userFromService['service'])) ? "\n\t\t\t\t\t<a href='#connect_existing' id='choose_existing'>{$this->lang->words['use_an_existing_acc']}</a>\n\t\t\t\t" : "") . "\n\t\t\t</div>\n\t\t</div>\n\t</div>\n\t<div id='connect_new'>\n\t\t<br />\n\t\t<h2 class='maintitle'>{$this->lang->words['new_account_title']}</h2>\n\t\t<div class='ipsBox'>\n\t\t\t<div class='ipsBox_container " . ((count($userFromService) and !empty($userFromService['service'])) ? " completeLeft" : "") . "'>\n\t\t\t\t<form action=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&module=global&section=register&do=complete_login_do&key={$key}&mid={$mid}&connectService={$userFromService['service']}", "public", ''), "", "") . "\" method=\"POST\">\n\t\t\t\t\t<input type=\"hidden\" name=\"termsread\" value=\"1\" />\n\t\t\t\t\t<input type=\"hidden\" name=\"agree_to_terms\" value=\"1\" />\n\t\t\t\t\t<input type='hidden' name='from' value='new' />\n\t\t\t\t\t<fieldset class='main'>\n\t\t\t\t\t\t<ul class='ipsForm ipsForm_horizontal ipsPad'>\n\t\t\t\t\t\t\t" . ($this->settings['auth_allow_dnames'] == 1 ? "<li class='ipsField clear'>\n\t\t\t\t\t\t\t\t\t" . (($userFromService['service'] == 'facebook' and $this->settings['fb_realname'] != 'any' and $userFromService['_displayName']) ? "" . ($this->settings['fb_realname'] == 'prefilled' ? "\n\t\t\t\t\t\t\t\t\t\t\t<label for='display_name' class='ipsField_title'>{$this->lang->words['dname_name']}</label>\n\t\t\t\t\t\t\t\t\t\t\t<p class='ipsField_content'>\n\t\t\t\t\t\t\t\t\t\t\t\t<input id='display_name' class='input_text' type=\"text\" size=\"40\" maxlength=\"64\" value=\"{$userFromService['_displayName']}\" name=\"members_display_name\" />\n\t\t\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\t\t" : "\n\t\t\t\t\t\t\t\t\t\t\t<span class='ipsField_title'></span>\n\t\t\t\t\t\t\t\t\t\t\t<p class='ipsField_content'><strong>" . IPSText::utf8ToEntities($userFromService['_displayName']) . "</strong></p>\n\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" value=\"{$userFromService['_displayName']}\" name=\"members_display_name\" />\n\t\t\t\t\t\t\t\t\t\t") . "" : "\n\t\t\t\t\t\t\t\t\t\t<label for='display_name' class='ipsField_title'>{$this->lang->words['dname_name']}</label>\n\t\t\t\t\t\t\t\t\t\t<p class='ipsField_content'>\n\t\t\t\t\t\t\t\t\t\t\t<input id='display_name' class='input_text' type=\"text\" size=\"40\" maxlength=\"64\" value=\"{$this->request['members_display_name']}\" name=\"members_display_name\" />\n\t\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\t") . "\n\t\t\t\t\t\t\t\t</li>" : "") . "\n\t\t\t\t\t\t\t" . (!$reg['partial_email_ok'] ? "\n\t\t\t\t\t\t\t\t<li class='ipsField clear'>\n\t\t\t\t\t\t\t\t\t<label for='email_1' class='ipsField_title'>{$this->lang->words['email_address']}</label>\n\t\t\t\t\t\t\t\t\t<p class='ipsField_content'>\n\t\t\t\t\t\t\t\t\t\t<input id='email_1' class='input_text' type=\"text\" size=\"40\" maxlength=\"50\" value=\"{$this->request['EmailAddress']}\" name=\"EmailAddress\" />\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t<li class='ipsField clear'>\n\t\t\t\t\t\t\t\t\t<label for='email_2' class='ipsField_title'>{$this->lang->words['email_address_confirm']}</label>\n\t\t\t\t\t\t\t\t\t<p class='ipsField_content'>\n\t\t\t\t\t\t\t\t\t\t<input id='email_2' class='input_text' type=\"text\" size=\"40\" maxlength=\"50\" value=\"{$this->request['EmailAddress_two']}\" name=\"EmailAddress_two\" />\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t" : "") . "\n\t\t\t\t\t\t\t" . ($custom_fields != '' ? "<fieldset class='rcomplete'>\n\t\t\t\t\t\t\t\t" . (is_array($custom_fields['required']) && count($custom_fields['required']) ? "\n\t\t\t\t\t\t\t\t\t" . $this->__f__0ddc7b38c6e13e5d34e71f00ccb612ba($mid, $key, $custom_fields, $errors, $reg, $userFromService) . "\t\t\t\t\t\t\t\t" : "") . "\n\t\n\t\t\t\t\t\t\t\t" . (is_array($custom_fields['optional']) && count($custom_fields['optional']) ? "\n\t\t\t\t\t\t\t\t\t" . $this->__f__f88810a0591f40d486f9bb7bee2317d8($mid, $key, $custom_fields, $errors, $reg, $userFromService) . "\t\t\t\t\t\t\t\t" : "") . "\n\t\t\t\t\t\t\t\t</fieldset>" : "") . "\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</fieldset>\n\t\t\t\t\t<fieldset class='submit'>\n\t\t\t\t\t\t<input type='submit' value='{$this->lang->words['new_account_submit']}' class='input_submit' />\n\t\t\t\t\t</fieldset>\n\t\t\t\t</form>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n\t" . ((count($userFromService) and !empty($userFromService['service'])) ? "\n\t\t<br />\n\t\t<div id='connect_existing'>\n\t\t\t<h2 class='maintitle'>{$this->lang->words['connect_account_title']}</h2>\n\t\t\t<div class='ipsBox'>\n\t\t\t\t<div class='ipsBox_container'>\n\t\t\t\t\t<form action=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&module=global&section=register&do=complete_login_do&key={$key}&mid={$mid}&connectService={$userFromService['service']}", "public", ''), "", "") . "\" method=\"POST\">\n\t\t\t\t\t\t<input type=\"hidden\" name=\"termsread\" value=\"1\" />\n\t\t\t\t\t\t<input type=\"hidden\" name=\"agree_to_terms\" value=\"1\" />\n\t\t\t\t\t\t<input type='hidden' name=\"from\" value=\"existing\" />\n\t\t\t\t\t\t<fieldset class='ipsPad_double'>\n\t\t\t\t\t\t\t<ul class='ipsForm ipsForm_horizontal'>\n\t\t\t\t\t\t\t\t<li class='ipsField clear'>\n\t\t\t\t\t\t\t\t\t<label for='login_user' class='ipsField_title'>{$this->lang->words['connect_username']}</label>\n\t\t\t\t\t\t\t\t\t<div class='ipsField_content'>\n\t\t\t\t\t\t\t\t\t\t<input id='login_user' class='input_text' type=\"text\" size=\"50\" maxlength=\"50\" value=\"{$this->request['login_user']}\" name=\"login_user\" /><br />\n\t\t\t\t\t\t\t\t\t\t<span class='desc'>{$this->lang->words['connect_username_desc']}</span> \n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t<li class='ipsField clear'>\n\t\t\t\t\t\t\t\t\t<label for='login_pass' class='ipsField_title'>{$this->lang->words['connect_password']}</label>\n\t\t\t\t\t\t\t\t\t<div class='ipsField_content'>\n\t\t\t\t\t\t\t\t\t\t<input id='login_pass' class='input_text' type=\"password\" size=\"50\" maxlength=\"50\" value=\"\" name=\"login_pass\" /><br />\n\t\t\t\t\t\t\t\t\t\t<span class='desc'>{$this->lang->words['connect_password_desc']}</span>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t</fieldset>\n\t\t\t\t\t\t<fieldset class='submit'>\n\t\t\t\t\t\t\t<input type='submit' value='{$this->lang->words['connect_account_submit']}' class='input_submit' />\n\t\t\t\t\t\t</fieldset>\n\t\t\t\t\t</form>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t" : "") . "\n</div>\n<script type='text/javascript'>\n\t" . ($this->request['from'] ? "\n\t\tipb.vars['register_active'] = \"{$this->request['from']}\";\n\t" : "") . "\n\t\n\tfunction setUpSignin(){\n\t\tif( !\$('connect_existing') ){\n\t\t\t\$('connect_choose').hide();\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif( !Object.isUndefined( ipb.vars['register_active'] ) ){\n\t\t\tif( ipb.vars['register_active'] == 'new' ){\n\t\t\t\t\$('connect_new').show();\n\t\t\t\t\$('connect_existing').hide();\n\t\t\t} else {\n\t\t\t\t\$('connect_existing').show();\n\t\t\t\t\$('connect_new').hide();\n\t\t\t}\n\t\t} else {\n\t\t\t\$('connect_new').hide();\n\t\t\t\$('connect_existing').hide();\n\t\t}\n\t\t\n\t\t\$('choose_new').observe('click', toggleSignIn);\n\t\t\$('choose_existing').observe('click', toggleSignIn);\n\t}\n\t\n\tfunction toggleSignIn(e){\n\t\tEvent.stop(e);\n\t\tvar toggleTo = Event.findElement(e, 'a');\n\t\tif( !toggleTo ){ return; }\n\t\t\n\t\tif( toggleTo == \$('choose_new') ){\n\t\t\tif( !\$('connect_new').visible() ){\n\t\t\t\t\$('connect_existing').fade( { duration: 0.3, afterFinish: function(){\n\t\t\t\t\t\$('connect_new').appear( { duration: 0.2 } );\n\t\t\t\t} } );\n\t\t\t}\n\t\t} else {\n\t\t\tif( !\$('connect_existing').visible() ){\n\t\t\t\t\$('connect_new').fade( { duration: 0.3, afterFinish: function(){\n\t\t\t\t\t\$('connect_existing').appear({ duration: 0.2});\n\t\t\t\t}});\n\t\t\t}\n\t\t}\n\t}\n\t\n\tsetUpSignin();\n</script>"; return $IPBHTML; }
/** * Encodes meta tag content so its safe for readers, etc * * @param string $content Meta tag content * @return @e string */ public function encodeMetaTagContent($content, $makeUTF8Safe = false) { $content = IPSText::htmlspecialchars($content); # Hebrew chars screw up Facebook sharer if ($makeUTF8Safe === true && IPS_DOC_CHAR_SET == 'UTF-8' && IPSText::isUTF8($content)) { $content = IPSText::utf8ToEntities($content); } return $content; }
/** * Function to resync a member's Facebook data * * @access public * @param mixed Member Data in an array form (result of IPSMember::load( $id, 'all' ) ) or a member ID * @return array Updated member data * * EXCEPTION CODES: * NO_MEMBER Member ID does not exist * NOT_LINKED Member ID or data specified is not linked to a FB profile */ public function syncMember($memberData) { //----------------------------------------- // INIT //----------------------------------------- $exProfile = array(); /* Do we need to load a member? */ if (!is_array($memberData)) { $memberData = IPSMember::load(intval($memberData), 'all'); } /* Got a member? */ if (!$memberData['member_id']) { throw new Exception('NO_MEMBER'); } /* Linked account? */ if (!$memberData['fb_uid']) { throw new Exception('NOT_LINKED'); } /* Thaw Options */ $bwOptions = IPSBWOptions::thaw($memberData['fb_bwoptions'], 'facebook'); /* Grab the data */ try { $this->resetApi($memberData['fb_token'], $memberData['fb_uid']); if ($this->isConnected()) { $user = $this->fetchUserData(); /* Load library */ if ($bwOptions['fbc_s_pic']) { $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/member/photo.php', 'classes_member_photo'); $photo = new $classToLoad($this->registry); $photo->save($memberData, 'facebook'); } if ($bwOptions['fbc_si_status'] and (isset($memberData['gbw_no_status_import']) and !$memberData['gbw_no_status_import']) and !$memberData['bw_no_status_update']) { /* Fetch timeline */ //$memberData['tc_last_sid_import'] = ( $memberData['tc_last_sid_import'] < 1 ) ? 100 : $memberData['tc_last_sid_import']; $_updates = $this->fetchUserTimeline($user['id'], 0, true); /* Got any? */ if (count($_updates)) { $update = array_shift($_updates); if (is_array($update) and isset($update['message'])) { /* @link http://community.invisionpower.com/tracker/issue-27746-video-in-facebook-status */ $update['message'] = strip_tags($update['message']); /* Load status class */ if (!$this->registry->isClassLoaded('memberStatus')) { $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/member/status.php', 'memberStatus'); $this->registry->setClass('memberStatus', new $classToLoad(ipsRegistry::instance())); } /* Set Author */ $this->registry->getClass('memberStatus')->setAuthor($memberData); $this->registry->getClass('memberStatus')->setStatusOwner($memberData); /* Convert if need be */ if (IPS_DOC_CHAR_SET != 'UTF-8') { $update['message'] = IPSText::utf8ToEntities($update['message']); } /* Set Content */ $this->registry->getClass('memberStatus')->setContent(trim(IPSText::getTextClass('bbcode')->stripBadWords($update['message']))); /* Set as imported */ $this->registry->getClass('memberStatus')->setIsImport(1); /* Set creator */ $this->registry->getClass('memberStatus')->setCreator('facebook'); /* Can we reply? */ if ($this->registry->getClass('memberStatus')->canCreate()) { $this->registry->getClass('memberStatus')->create(); //$exProfile['tc_last_sid_import'] = $update['id']; } } } } /* Update member */ IPSMember::save($memberData['member_id'], array('core' => array('fb_lastsync' => time()), 'extendedProfile' => $exProfile)); /* merge and return */ $memberData['fb_lastsync'] = time(); $memberData = array_merge($memberData, $exProfile); } else { /* Update member even if it failed so it's not selected on next task run */ IPSMember::save($memberData['member_id'], array('core' => array('fb_lastsync' => time()))); } } catch (Exception $e) { /* Update member even if it failed so it's not selected on next task run */ IPSMember::save($memberData['member_id'], array('core' => array('fb_lastsync' => time()))); $this->registry->output->logErrorMessage($e->getMessage(), 'FB-EXCEPTION'); } return $memberData; }
/** * Show the member form * * @author Matt Mecham * @param string Any inline message to show * @return string Processed HTML */ public function formFacebook($inlineMsg = '') { //----------------------------------------- // INIT //----------------------------------------- if (!IPSLib::fbc_enabled()) { $this->registry->getClass('output')->showError('fbc_disabled', 1005.2); } //----------------------------------------- // Shut off save button if not associated yet //----------------------------------------- if (!$this->memberData['fb_uid']) { $this->hide_form_and_save_button = true; $userData = array(); $linkedMemberData = array(); $perms = array(); } else { //----------------------------------------- // FB user logged in? //----------------------------------------- $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/facebook/connect.php', 'facebook_connect'); $facebook = new $classToLoad($this->registry); /* Now get the linked user */ $linkedMemberData = IPSMember::load(intval($this->memberData['fb_uid']), 'all', 'fb_uid'); $userData = $facebook->fetchUserData(); /* Email */ $perms['email'] = $facebook->fetchHasAppPermission('email'); /* Publish Stream */ $perms['publish_stream'] = $facebook->fetchHasAppPermission('publish_stream'); /* Read stream */ $perms['read_stream'] = $facebook->fetchHasAppPermission('read_stream'); /* Offline access */ $perms['offline_access'] = $facebook->fetchHasAppPermission('offline_access'); //----------------------------------------- // Thaw bitfield options //----------------------------------------- $bwOptions = IPSBWOptions::thaw($this->memberData['fb_bwoptions'], 'facebook'); //----------------------------------------- // Merge.. //----------------------------------------- if (is_array($bwOptions)) { foreach ($bwOptions as $k => $v) { $this->memberData[$k] = $v; } } //----------------------------------------- // Able to update status? //----------------------------------------- $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/member/status.php', 'memberStatus'); $this->registry->setClass('memberStatus', new $classToLoad($this->registry)); $this->registry->memberStatus->setAuthor($this->memberData); $this->memberData['can_updated_status'] = $this->registry->memberStatus->canCreate(); $_updates = $facebook->fetchUserTimeline($userData['id'], 0, true); /* Got any? */ if (count($_updates)) { $update = array_shift($_updates); if (count($update) and is_array($update)) { $userData['status'] = $update; } } if (is_array($userData) and $userData['status']['message'] and IPS_DOC_CHAR_SET != 'UTF-8') { $userData['status']['message'] = IPSText::utf8ToEntities($userData['status']['message']); } /* Make safe */ $userData['status']['message'] = str_replace(array('<', '>'), array('<', '>'), $userData['status']['message']); } return $this->registry->getClass('output')->getTemplate('ucp')->membersFacebookConnect(trim($this->memberData['fb_uid']), $userData, $linkedMemberData, $perms); }
/** * Function to resync a member's Twitter data * * @access public * @param mixed Member Data in an array form (result of IPSMember::load( $id, 'all' ) ) or a member ID * @return array Updated member data * * EXCEPTION CODES: * NO_MEMBER Member ID does not exist * NOT_LINKED Member ID or data specified is not linked to a FB profile */ public function syncMember($memberData) { //----------------------------------------- // INIT //----------------------------------------- $exProfile = array(); /* Do we need to load a member? */ if (!is_array($memberData)) { $memberData = IPSMember::load(intval($memberData), 'all'); } /* Got a member? */ if (!$memberData['member_id']) { throw new Exception('NO_MEMBER'); } /* Linked account? */ if (!$memberData['twitter_id']) { throw new Exception('NOT_LINKED'); } /* Not completed sign up ( no display name ) */ if ($memberData['member_group_id'] == $this->settings['auth_group']) { return false; } /* Thaw Options */ $bwOptions = IPSBWOptions::thaw($memberData['tc_bwoptions'], 'twitter'); /* Grab the data */ try { $this->resetApi($memberData['twitter_token'], $memberData['twitter_secret']); if ($this->isConnected()) { $user = $this->fetchUserData(); /* Load library */ if ($bwOptions['tc_s_pic']) { $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/member/photo.php', 'classes_member_photo'); $photo = new $classToLoad($this->registry); $photo->save($memberData, 'twitter'); } if ($bwOptions['tc_s_aboutme']) { $exProfile['pp_about_me'] = IPSText::getTextClass('bbcode')->stripBadWords(IPSText::convertCharsets($user['description'], 'utf-8', IPS_DOC_CHAR_SET)); } if ($bwOptions['tc_si_status'] and (isset($memberData['gbw_no_status_import']) and !$memberData['gbw_no_status_import']) and !$memberData['bw_no_status_update']) { /* Fetch timeline */ $memberData['tc_last_sid_import'] = $memberData['tc_last_sid_import'] < 1 ? 100 : $memberData['tc_last_sid_import']; $_updates = $this->fetchUserTimeline($user['id'], $memberData['tc_last_sid_import'], true); /* Got any? */ if (count($_updates)) { $update = array_shift($_updates); if (is_array($update) and isset($update['text'])) { /* Load status class */ if (!$this->registry->isClassLoaded('memberStatus')) { $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/member/status.php', 'memberStatus'); $this->registry->setClass('memberStatus', new $classToLoad(ipsRegistry::instance())); } /* Set Author */ $this->registry->getClass('memberStatus')->setAuthor($memberData); $this->registry->getClass('memberStatus')->setStatusOwner($memberData); /* Convert if need be */ if (IPS_DOC_CHAR_SET != 'UTF-8') { $update['text'] = IPSText::utf8ToEntities($update['text']); } /* Set Content */ $this->registry->getClass('memberStatus')->setContent(trim(IPSText::getTextClass('bbcode')->stripBadWords($update['text']))); /* Set as imported */ $this->registry->getClass('memberStatus')->setIsImport(1); /* Set creator */ $this->registry->getClass('memberStatus')->setCreator('twitter'); /* Can we reply? */ if ($this->registry->getClass('memberStatus')->canCreate()) { $this->registry->getClass('memberStatus')->create(); $exProfile['tc_last_sid_import'] = $update['id']; } } } } /* Allowed profile customization? */ if ($bwOptions['tc_s_bgimg'] and ($user['profile_background_image_url'] or $user['profile_background_color']) and ($this->memberData['gbw_allow_customization'] and !$this->memberData['bw_disable_customization'])) { /* remove bg images */ IPSMember::getFunction()->removeUploadedBackgroundImages($memberData['member_id']); $exProfile['pp_customization'] = serialize(array('bg_url' => $user['profile_background_image_url'], 'type' => $user['profile_background_image_url'] ? 'url' : 'color', 'bg_color' => IPSText::alphanumericalClean($user['profile_background_color']), 'bg_tile' => intval($user['profile_background_tile']))); } /* Update member */ IPSMember::save($memberData['member_id'], array('core' => array('tc_lastsync' => time()), 'extendedProfile' => $exProfile)); /* merge and return */ $memberData['tc_lastsync'] = time(); $memberData = array_merge($memberData, $exProfile); } } catch (Exception $e) { } return $memberData; }
/** * Send an email * * @return boolean Email sent successfully */ public function sendMail() { $this->init(); if ($this->emailer->error) { return $this->fatalError($this->emailer->error_msg, $this->emailer->error_help); } /* Add attachments if any */ if (count($this->_attachments)) { foreach ($this->_attachments as $a) { $this->emailer->addAttachment($a[0], $a[1], $a[2]); } } $this->settings['board_name'] = $this->cleanMessage($this->settings['board_name']); $this->emailer->setFrom($this->from ? $this->from : $this->settings['email_out'], $this->settings['board_name']); $this->emailer->setTo($this->to); foreach ($this->cc as $cc) { $this->emailer->addCC($cc); } foreach ($this->bcc as $bcc) { $this->emailer->addBCC($bcc); } if (count($this->temp_headers)) { foreach ($this->temp_headers as $k => $v) { $this->emailer->setHeader($k, $v); } } //----------------------------------------- // Added strip_tags for the subject 4.16.2010 // so we can have links in subject for inline // notifications and still use the subject //----------------------------------------- $this->emailer->setSubject($this->_cleanSubject($this->subject)); /* If we're sending a HTML email, we need to manually send the plain text and HTML versions */ if ($this->html_email and $this->htmlTemplate) { /* Dynamically replace subject in template */ $this->htmlTemplate = str_ireplace(array('<#subject#>'), IPSText::utf8ToEntities($this->_cleanSubject($this->subject)), $this->htmlTemplate); $this->emailer->setPlainTextContent($this->plainTextTemplate); $this->emailer->setHtmlContent($this->htmlTemplate); } else { if ($this->message && !$this->plainTextTemplate) { /* Older methods pass message directly */ $this->emailer->setBody($this->message); } else { $this->emailer->setBody($this->plainTextTemplate); } } $this->emailer->sendMail(); /* Clear out stuffs */ $this->clearContent(); // Unset HTML setting to remain backwards compatibility //$this->html_email = FALSE; if ($this->emailer->error) { return $this->fatalError($this->emailer->error_msg, $this->emailer->error_help); } return true; }