当前位置: 首页>>代码示例>>PHP>>正文


PHP IPSLib::getDefaultLanguage方法代码示例

本文整理汇总了PHP中IPSLib::getDefaultLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP IPSLib::getDefaultLanguage方法的具体用法?PHP IPSLib::getDefaultLanguage怎么用?PHP IPSLib::getDefaultLanguage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPSLib的用法示例。


在下文中一共展示了IPSLib::getDefaultLanguage方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createAdminAccount

 /**
  * Create admin account
  *
  * @access	public
  * @return	@e void
  */
 public static function createAdminAccount()
 {
     /* Build Entry */
     $_mke_time = ipsRegistry::$settings['login_key_expire'] ? time() + intval(ipsRegistry::$settings['login_key_expire']) * 86400 : 0;
     $salt = IPSMember::generatePasswordSalt(5);
     $passhash = IPSMember::generateCompiledPasshash($salt, md5(IPSSetUp::getSavedData('admin_pass')));
     $_dname = IPSSetUp::getSavedData('admin_user');
     $member = array('name' => $_dname, 'members_l_username' => strtolower($_dname), 'members_display_name' => $_dname, 'members_l_display_name' => strtolower($_dname), 'members_seo_name' => IPSText::makeSeoTitle($_dname), 'member_login_key' => IPSMember::generateAutoLoginKey(), 'member_login_key_expire' => $_mke_time, 'title' => 'Administrator', 'email' => IPSSetUp::getSavedData('admin_email'), 'member_group_id' => 4, 'posts' => 1, 'joined' => time(), 'last_visit' => time(), 'last_activity' => time(), 'ip_address' => my_getenv('REMOTE_ADDR'), 'view_sigs' => 1, 'restrict_post' => 0, 'msg_show_notification' => 1, 'msg_count_total' => 0, 'msg_count_new' => 0, 'coppa_user' => 0, 'language' => IPSLib::getDefaultLanguage(), 'members_auto_dst' => 1, 'member_uploader' => 'flash', 'allow_admin_mails' => 0, 'members_pass_hash' => $passhash, 'members_pass_salt' => $salt, 'has_blog' => '', 'fb_token' => '', 'ignored_users' => '', 'members_cache' => '', 'failed_logins' => '', 'bday_day' => 0, 'bday_month' => 0, 'bday_year' => 0);
     /* Insert: MEMBERS */
     ipsRegistry::DB()->setDataType(array('name', 'members_display_name', 'members_l_username', 'members_l_display_name'), 'string');
     ipsRegistry::DB()->insert('members', $member);
     $member_id = ipsRegistry::DB()->getInsertId();
     $member['member_id'] = $member_id;
     /* Insert into the custom profile fields DB */
     ipsRegistry::DB()->insert('pfields_content', array('member_id' => $member_id));
     /* Insert into pp */
     ipsRegistry::DB()->insert('profile_portal', array('pp_member_id' => $member_id, 'pp_setting_count_friends' => 1, 'signature' => '', 'pconversation_filters' => '', 'pp_setting_count_comments' => 1, 'pp_setting_count_visitors' => 1));
 }
开发者ID:mover5,项目名称:imobackup,代码行数:24,代码来源:install.php

示例2: _getVariableInformation

 /**
 * Get variable values
 *
 * @param	array	Member information
 * @param	int		0 	All
 					1	Member Specific only
 					2	Global only
 * @retrun	array	key/value pairs
 */
 protected function _getVariableInformation($member, $type = 0, $html = TRUE)
 {
     $variables = array();
     if ($type == 0 or $type == 2) {
         $variables['board_name'] = str_replace("'", "'", $this->settings['board_name']);
         $variables['board_url'] = $this->settings['board_url'] . "/index." . $this->settings['php_ext'];
         $variables['reg_total'] = $this->caches['stats']['mem_count'];
         $variables['total_posts'] = $this->caches['stats']['total_topics'] + $this->caches['stats']['total_replies'];
         $variables['busy_count'] = $this->caches['stats']['most_count'];
         $variables['busy_time'] = ipsRegistry::getClass('class_localization')->getDate($this->caches['stats']['most_date'], 'SHORT');
     }
     if ($type == 0 or $type == 1) {
         $variables['member_id'] = $member['member_id'];
         $variables['member_name'] = $member['members_display_name'];
         $variables['member_joined'] = ipsRegistry::getClass('class_localization')->getDate($member['joined'], 'JOINED', TRUE);
         $variables['member_posts'] = $member['posts'];
         $variables['member_last_visit'] = ipsRegistry::getClass('class_localization')->getDate($member['last_visit'], 'JOINED', TRUE);
         $this->registry->class_localization->loadLanguageFile(array('public_global'), 'core', $member['language'] ? $member['language'] : IPSLib::getDefaultLanguage(), TRUE);
         $key = md5($member['email'] . ':' . $member['members_pass_hash']);
         $link = $this->registry->output->buildUrl("app=core&module=global&section=unsubscribe&member={$member['member_id']}&key={$key}", 'publicNoSession');
         $variables['unsubscribe'] = $html ? "<a href='{$link}'>" . $this->registry->class_localization->words['email_unsubscribe'] . '</a>' : "{$this->registry->class_localization->words['email_unsubscribe']}: {$link}";
     }
     return $variables;
 }
开发者ID:ConnorChristie,项目名称:GrabViews,代码行数:33,代码来源:bulkmail.php

示例3: finish

 /**
  * Finish up conversion stuff
  * 
  * @return	@e void
  */
 public function finish()
 {
     $options = IPSSetUp::getSavedData('custom_options');
     $skipPms = $options['core'][30001]['skipPms'];
     $output = array();
     /* Emoticons */
     if (file_exists(DOC_IPS_ROOT_PATH . 'style_emoticons/default')) {
         try {
             foreach (new DirectoryIterator(DOC_IPS_ROOT_PATH . 'style_emoticons/default') as $file) {
                 if (!$file->isDot()) {
                     $_name = $file->getFileName();
                     /* Annoyingly, isDot doesn't match .svn, etc */
                     if (substr($_name, 0, 1) == '.') {
                         continue;
                     }
                     if (@copy(DOC_IPS_ROOT_PATH . 'style_emoticons/default/' . $_name, IPS_PUBLIC_PATH . 'style_emoticons/default/' . $_name)) {
                         $output[] = "Смайлики: скопирован {$_name}...";
                     } else {
                         $output[] = "Не удалось скопировать {$_name} - после обновления перенесите его самостоятельно";
                     }
                 }
             }
         } catch (Exception $e) {
         }
     }
     /* LOG IN METHODS */
     $this->DB->build(array('select' => '*', 'from' => 'login_methods'));
     $this->DB->execute();
     while ($row = $this->DB->fetch()) {
         $loginMethods[$row['login_folder_name']] = $row;
     }
     $count = 6;
     $recount = array('internal' => 1, 'ipconverge' => 2, 'ldap' => 3, 'external' => 4);
     /* Fetch XML */
     require_once IPS_KERNEL_PATH . 'classXML.php';
     /*noLibHook*/
     $xml = new classXML(IPSSetUp::charSet);
     $xml->load(IPS_ROOT_PATH . 'setup/xml/loginauth.xml');
     foreach ($xml->fetchElements('login_methods') as $xmlelement) {
         $data = $xml->fetchElementsFromRecord($xmlelement);
         $data['login_order'] = isset($recount[$data['login_folder_name']]) ? $recount[$data['login_folder_name']] : ++$count;
         unset($data['login_id']);
         if (!$loginMethods[$data['login_folder_name']]) {
             $this->DB->insert('login_methods', $data);
         } else {
             $this->DB->update('login_methods', array('login_order' => $data['login_order']), 'login_folder_name=\'' . $data['login_folder_name'] . '\'');
         }
     }
     /* Reset member languages and skins */
     $this->DB->update('members', array('language' => IPSLib::getDefaultLanguage(), 'skin' => 0));
     /* Empty caches */
     $this->DB->delete('cache_store', "cs_key='forum_cache'");
     $this->DB->delete('cache_store', "cs_key='skin_id_cache'");
     /* Empty other tables */
     $this->DB->delete('skin_cache');
     $this->DB->delete('skin_templates_cache');
     /* Reset admin permissions */
     $this->DB->update('admin_permission_rows', array('row_perm_cache' => ''));
     /* Drop Tables */
     $this->DB->dropTable('contacts');
     $this->DB->dropTable('skin_macro');
     $this->DB->dropTable('skin_template_links');
     $this->DB->dropTable('skin_templates_old');
     $this->DB->dropTable('skin_sets');
     $this->DB->dropTable('languages');
     $this->DB->dropTable('topics_read');
     $this->DB->dropTable('topic_markers');
     $this->DB->dropTable('acp_help');
     $this->DB->dropTable('members_converge');
     $this->DB->dropTable('member_extra');
     $this->DB->dropTable('custom_bbcode_old');
     $this->DB->dropTable('admin_sessions');
     $this->DB->dropTable('components');
     $this->DB->dropTable('admin_permission_keys');
     $this->DB->dropTable('conf_settings');
     $this->DB->dropTable('conf_settings_titles');
     $this->DB->dropTable('reg_antispam');
     if (!$skipPms) {
         $this->DB->dropTable('message_text');
         $this->DB->dropTable('message_topics_old');
     }
     $message = (is_array($output) and count($output)) ? implode("<br />", $output) . '<br />' : '';
     $this->registry->output->addMessage($message . "очистка SQL завершена...");
     /* Last function, so unset workact */
     $this->request['workact'] = '';
 }
开发者ID:Advanture,项目名称:Online-RolePlay,代码行数:91,代码来源:version_upgrade.php

示例4: sendOutQuoteNotifications

 /**
  * Send out quote notifications, yo.
  *
  * @param	array	$post			Post data
  * @param	array	$membersToSkip	List of member IDs to not send notifications to
  * @return	void
  */
 public function sendOutQuoteNotifications($post, $membersToSkip)
 {
     $seen = array();
     if (stristr($post['post'], '<blockquote') || stristr($post['post'], '[quote')) {
         if (preg_match_all('#(\\[quote|\\<blockquote)(?:[^\\]]+?)data-cid=(?:\'|"|&quot;|&\\#39;)(\\d+?)(?:\'|"|&quot;|&\\#39;)#', $post['post'], $quotes)) {
             $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications');
             $notifyLibrary = new $classToLoad($this->registry);
             $posts = $this->registry->getClass('topics')->getPosts(array('postId' => array_unique($quotes[2])));
             foreach ($posts as $pid => $_quoted) {
                 /* Try and make things a bit more readable */
                 $_toMember = $_quoted;
                 if (!$_toMember['member_id']) {
                     continue;
                 }
                 $topic = $this->registry->getClass('topics')->getTopicById($post['topic_id']);
                 /* Is the user being ignored? */
                 $ignored = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'ignored_users', 'where' => 'ignore_ignore_id=' . $this->memberData['member_id'] . ' AND ignore_owner_id=' . $_toMember['member_id'] . ' AND ignore_topics = 1'));
                 if ($this->registry->getClass('topics')->canView($topic, $_toMember) && !$ignored) {
                     if (!isset($seen[$_quoted['author_id']]) && $_quoted['author_id'] && $_quoted['author_id'] != $this->getAuthor('member_id') and !in_array($_quoted['author_id'], $membersToSkip)) {
                         $seen[$_quoted['author_id']] = true;
                         $_toMember['language'] = $_toMember['language'] == "" ? IPSLib::getDefaultLanguage() : $_toMember['language'];
                         IPSText::getTextClass('email')->getTemplate("post_was_quoted", $_toMember['language']);
                         IPSText::getTextClass('email')->buildMessage(array('MEMBER_NAME' => $this->getAuthor('members_display_name'), 'ORIGINAL_POST' => $this->registry->output->buildSEOUrl("showtopic={$_quoted['tid']}&amp;view=findpost&amp;p={$_quoted['pid']}", "publicNoSession", $_quoted['title_seo'], 'showtopic'), 'NEW_POST' => $this->registry->output->buildSEOUrl("showtopic={$post['topic_id']}&amp;view=findpost&amp;p={$post['pid']}", "publicNoSession", $topic['title_seo'], 'showtopic'), 'POST' => $post['post']));
                         IPSText::getTextClass('email')->subject = sprintf(IPSText::getTextClass('email')->subject, $this->registry->output->buildSEOUrl('showuser=' . $this->getAuthor('member_id'), 'publicNoSession', $this->getAuthor('members_seo_name'), 'showuser'), $this->getAuthor('members_display_name'), $this->registry->output->buildSEOUrl("showtopic={$post['topic_id']}&amp;view=findpost&amp;p={$post['pid']}", "publicNoSession", $topic['title_seo'], 'showtopic'), $this->registry->output->buildSEOUrl("showtopic={$_quoted['tid']}&amp;view=findpost&amp;p={$_quoted['pid']}", "publicNoSession", $_quoted['title_seo'], 'showtopic'));
                         $notifyLibrary->setMember($_toMember);
                         $notifyLibrary->setFrom($this->memberData);
                         $notifyLibrary->setNotificationKey('post_quoted');
                         $notifyLibrary->setNotificationUrl($this->registry->output->buildSEOUrl("showtopic={$post['topic_id']}&amp;view=findpost&amp;p={$post['pid']}", "public", $topic['title_seo'], 'showtopic'));
                         $notifyLibrary->setNotificationText(IPSText::getTextClass('email')->message);
                         $notifyLibrary->setNotificationTitle(IPSText::getTextClass('email')->subject);
                         try {
                             $notifyLibrary->sendNotification();
                         } catch (Exception $e) {
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:ConnorChristie,项目名称:GrabViews,代码行数:47,代码来源:classPost.php

示例5: create


//.........这里部分代码省略.........
                         $_num = $max['max'] + 1;
                         $finalTables['members']['name'] = $finalTables['members']['name'] . '_' . $_num;
                     }
                 } else {
                     $finalTables['members']['name'] = '';
                 }
             }
         } catch (Exception $e) {
         }
     }
     //-----------------------------------------
     // Populate member table(s)
     //-----------------------------------------
     $finalTables['members']['members_l_username'] = isset($finalTables['members']['name']) ? strtolower($finalTables['members']['name']) : '';
     $finalTables['members']['joined'] = $finalTables['members']['joined'] ? $finalTables['members']['joined'] : time();
     $finalTables['members']['email'] = $finalTables['members']['email'] ? $finalTables['members']['email'] : $finalTables['members']['name'] . '@' . $finalTables['members']['joined'];
     $finalTables['members']['member_group_id'] = $finalTables['members']['member_group_id'] ? $finalTables['members']['member_group_id'] : ipsRegistry::$settings['member_group'];
     $finalTables['members']['ip_address'] = $finalTables['members']['ip_address'] ? $finalTables['members']['ip_address'] : ipsRegistry::member()->ip_address;
     $finalTables['members']['members_created_remote'] = intval($finalTables['members']['members_created_remote']);
     $finalTables['members']['member_login_key'] = IPSMember::generateAutoLoginKey();
     $finalTables['members']['member_login_key_expire'] = ipsRegistry::$settings['login_key_expire'] ? time() + intval(ipsRegistry::$settings['login_key_expire']) * 86400 : 0;
     $finalTables['members']['view_sigs'] = 1;
     $finalTables['members']['email_pm'] = 1;
     $finalTables['members']['view_img'] = 1;
     $finalTables['members']['view_avs'] = 1;
     $finalTables['members']['restrict_post'] = intval($finalTables['members']['restrict_post']);
     $finalTables['members']['view_pop'] = 1;
     $finalTables['members']['msg_count_total'] = 0;
     $finalTables['members']['msg_count_new'] = 0;
     $finalTables['members']['msg_show_notification'] = 1;
     $finalTables['members']['coppa_user'] = 0;
     $finalTables['members']['auto_track'] = intval($finalTables['members']['auto_track']);
     $finalTables['members']['last_visit'] = $finalTables['members']['last_visit'] ? $finalTables['members']['last_visit'] : time();
     $finalTables['members']['last_activity'] = $finalTables['members']['last_activity'] ? $finalTables['members']['last_activity'] : time();
     $finalTables['members']['language'] = IPSLib::getDefaultLanguage();
     $finalTables['members']['members_editor_choice'] = ipsRegistry::$settings['ips_default_editor'];
     $finalTables['members']['members_pass_salt'] = IPSMember::generatePasswordSalt(5);
     $finalTables['members']['members_pass_hash'] = IPSMember::generateCompiledPasshash($finalTables['members']['members_pass_salt'], $md_5_password);
     $finalTables['members']['members_display_name'] = isset($finalTables['members']['members_display_name']) ? $finalTables['members']['members_display_name'] : '';
     $finalTables['members']['members_l_display_name'] = isset($finalTables['members']['members_display_name']) ? strtolower($finalTables['members']['members_display_name']) : '';
     $finalTables['members']['fb_uid'] = isset($finalTables['members']['fb_uid']) ? $finalTables['members']['fb_uid'] : 0;
     $finalTables['members']['fb_emailhash'] = isset($finalTables['members']['fb_emailhash']) ? strtolower($finalTables['members']['fb_emailhash']) : '';
     $finalTables['members']['members_seo_name'] = IPSText::makeSeoTitle($finalTables['members']['members_display_name']);
     $finalTables['members']['bw_is_spammer'] = intval($finalTables['members']['bw_is_spammer']);
     //-----------------------------------------
     // Insert: MEMBERS
     //-----------------------------------------
     ipsRegistry::DB()->force_data_type = array('name' => 'string', 'members_l_username' => 'string', 'members_display_name' => 'string', 'members_l_display_name' => 'string', 'members_seo_name' => 'string', 'email' => 'string');
     /* Bitwise options */
     if (is_array($bitWiseFields['members'])) {
         $_freeze = array();
         foreach ($bitWiseFields['members'] as $field) {
             if (isset($finalTables['members'][$field])) {
                 /* Add to freezeable array */
                 $_freeze[$field] = $finalTables['members'][$field];
                 /* Remove it from the fields to save to DB */
                 unset($finalTables['members'][$field]);
             }
         }
         if (count($_freeze)) {
             $finalTables['members']['members_bitoptions'] = IPSBWOptions::freeze($_freeze, 'members', 'global');
         }
     }
     ipsRegistry::DB()->insert('members', $finalTables['members']);
     //-----------------------------------------
     // Get the member id
     //-----------------------------------------
     $finalTables['members']['member_id'] = ipsRegistry::DB()->getInsertId();
     //-----------------------------------------
     // Insert: PROFILE PORTAL
     //-----------------------------------------
     $finalTables['profile_portal']['pp_member_id'] = $finalTables['members']['member_id'];
     $finalTables['profile_portal']['pp_setting_count_friends'] = 1;
     $finalTables['profile_portal']['pp_setting_count_comments'] = 1;
     ipsRegistry::DB()->insert('profile_portal', $finalTables['profile_portal']);
     //-----------------------------------------
     // Insert into the custom profile fields DB
     //-----------------------------------------
     if (!$bypassCfields) {
         $fields->out_fields['member_id'] = $finalTables['members']['member_id'];
         ipsRegistry::DB()->delete('pfields_content', 'member_id=' . $finalTables['members']['member_id']);
         ipsRegistry::DB()->insert('pfields_content', $fields->out_fields);
     } else {
         ipsRegistry::DB()->delete('pfields_content', 'member_id=' . $finalTables['members']['member_id']);
         ipsRegistry::DB()->insert('pfields_content', array('member_id' => $finalTables['members']['member_id']));
     }
     //-----------------------------------------
     // Insert into partial ID table
     //-----------------------------------------
     $full_account = false;
     if ($finalTables['members']['members_display_name'] and $finalTables['members']['name'] and $finalTables['members']['email'] != $finalTables['members']['name'] . '@' . $finalTables['members']['joined']) {
         $full_account = true;
     }
     if (!$full_account) {
         ipsRegistry::DB()->insert('members_partial', array('partial_member_id' => $finalTables['members']['member_id'], 'partial_date' => $finalTables['members']['joined'], 'partial_email_ok' => $finalTables['members']['email'] == $finalTables['members']['name'] . '@' . $finalTables['members']['joined'] ? 0 : 1));
     }
     //IPSMember::updateSearchIndex( $finalTables['members']['member_id'] );
     IPSLib::runMemberSync('onCreateAccount', $finalTables['members']);
     return array_merge($finalTables['members'], $finalTables['profile_portal'], !$bypassCfields ? $fields->out_fields : array(), array('timenow' => $finalTables['members']['joined'], 'full' => $full_account));
 }
开发者ID:dalandis,项目名称:Visualization-of-Cell-Phone-Locations,代码行数:101,代码来源:core.php

示例6: _memberDoAdd

 /**
  * Add a member [process]
  *
  * @return	@e void
  */
 protected function _memberDoAdd()
 {
     /* Init vars */
     $in_username = trim($this->request['name']);
     $in_password = trim($this->request['password']);
     $in_email = trim(strtolower($this->request['email']));
     $members_display_name = $this->request['mirror_loginname'] ? $in_username : trim($this->request['members_display_name']);
     $this->registry->output->global_error = '';
     $this->registry->class_localization->loadLanguageFile(array('public_register'), 'core');
     /* Check erros */
     foreach (array('name', 'password', 'email', 'member_group_id') as $field) {
         if (!$_POST[$field]) {
             $this->registry->output->showError($this->lang->words['m_completeform'], 11238);
         }
     }
     //-----------------------------------------
     // Check
     //-----------------------------------------
     if (!IPSText::checkEmailAddress($in_email)) {
         $this->registry->output->global_error = $this->lang->words['m_emailinv'];
     }
     $userName = IPSMember::getFunction()->cleanAndCheckName($in_username, array(), 'name');
     $displayName = IPSMember::getFunction()->cleanAndCheckName($members_display_name, array(), 'members_display_name');
     if (count($userName['errors'])) {
         $_message = $this->lang->words[$userName['errors']['username']] ? $this->lang->words[$userName['errors']['username']] : $userName['errors']['username'];
         $this->registry->output->global_error .= '<p>' . $this->lang->words['sm_loginname'] . ': ' . $_message . '</p>';
     }
     if ($this->settings['auth_allow_dnames'] and count($displayName['errors'])) {
         $_message = $this->lang->words[$displayName['errors']['dname']] ? $this->lang->words[$displayName['errors']['dname']] : $displayName['errors']['dname'];
         $this->registry->output->global_error .= '<p>' . $this->lang->words['sm_display'] . ': ' . $_message . '</p>';
     }
     /* Errors? */
     if ($this->registry->output->global_error) {
         $this->_memberAddForm();
         return;
     }
     //-----------------------------------------
     // Load handler...
     //-----------------------------------------
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login');
     $this->han_login = new $classToLoad($this->registry);
     $this->han_login->init();
     //-----------------------------------------
     // Only check local, else a user being in Converge
     // means that you can't manually add the user to the board
     //-----------------------------------------
     $email_check = $this->DB->buildAndFetch(array('select' => 'member_id', 'from' => 'members', 'where' => "email='" . $in_email . "'"));
     if ($email_check['member_id']) {
         $this->registry->output->global_error = $this->lang->words['m_emailalready'];
         $this->_memberAddForm();
         return;
     }
     //$this->han_login->emailExistsCheck( $in_email );
     //if( $this->han_login->return_code AND $this->han_login->return_code != 'METHOD_NOT_DEFINED' AND $this->han_login->return_code != 'EMAIL_NOT_IN_USE' )
     //{
     //	$this->registry->output->global_message = $this->lang->words['m_emailalready'];
     //	$this->_memberAddForm();
     //	return;
     //}
     //-----------------------------------------
     // Allowed to add administrators?
     //-----------------------------------------
     if ($this->caches['group_cache'][intval($this->request['member_group_id'])]['g_access_cp'] and !$this->registry->getClass('class_permissions')->checkPermission('member_add_admin')) {
         $this->registry->output->global_error = $this->lang->words['m_addadmin'];
         $this->_memberAddForm();
         return;
     }
     $member = array('name' => $in_username, 'members_display_name' => $members_display_name ? $members_display_name : $in_username, 'email' => $in_email, 'member_group_id' => intval($this->request['member_group_id']), 'joined' => time(), 'ip_address' => $this->member->ip_address, 'time_offset' => $this->settings['time_offset'], 'coppa_user' => intval($this->request['coppa']), 'allow_admin_mails' => 1, 'password' => $in_password, 'language' => IPSLib::getDefaultLanguage());
     //-----------------------------------------
     // Create the account
     //-----------------------------------------
     $member = IPSMember::create(array('members' => $member, 'pfields_content' => $this->request), FALSE, FALSE, FALSE);
     //-----------------------------------------
     // Login handler create account callback
     //-----------------------------------------
     $this->han_login->createAccount(array('email' => $in_email, 'joined' => $member['joined'], 'password' => $in_password, 'ip_address' => $member['ip_address'], 'username' => $member['members_display_name']));
     /*if( $this->han_login->return_code AND $this->han_login->return_code != 'METHOD_NOT_DEFINED' AND $this->han_login->return_code != 'SUCCESS' )
     		{
     			$this->registry->output->global_message = sprintf( $this->lang->words['m_cantadd'], $this->han_login->return_code ) . $this->han_login->return_details;
     			$this->_memberAddForm();
     			return;
     		}*/
     //-----------------------------------------
     // Restriction permissions stuff
     //-----------------------------------------
     if ($this->memberData['row_perm_cache']) {
         if ($this->caches['group_cache'][intval($this->request['member_group_id'])]['g_access_cp']) {
             //-----------------------------------------
             // Copy restrictions...
             //-----------------------------------------
             $this->DB->insert('admin_permission_rows', array('row_member_id' => $member['member_id'], 'row_perm_cache' => $this->memberData['row_perm_cache'], 'row_updated' => time()));
         }
     }
     //-----------------------------------------
     // Send teh email (I love 'teh' as much as !!11!!1)
//.........这里部分代码省略.........
开发者ID:ConnorChristie,项目名称:GrabViews,代码行数:101,代码来源:members.php

示例7: sendNewPersonalTopic


//.........这里部分代码省略.........
     //-----------------------------------------
     if ($options['topicID']) {
         /* Fetch topic data */
         $_topicData = $this->fetchTopicData($options['topicID']);
         if (!$_topicData['mt_id'] and $this->forceMessageToSend !== TRUE) {
             throw new Exception('TOPIC_ID_NOT_EXISTS');
         }
         $this->DB->setDataType('mt_title', 'string');
         /* First off, update message_topics and message_posts... */
         $this->DB->update('message_topics', array('mt_date' => time(), 'mt_title' => $msgTitle, 'mt_starter_id' => $fromMemberData['member_id'], 'mt_start_time' => time(), 'mt_last_post_time' => time(), 'mt_invited_members' => serialize(array_keys($inviteUsersData)), 'mt_to_count' => count(array_keys($inviteUsersData)) + 1, 'mt_to_member_id' => $toMemberData['member_id'], 'mt_is_draft' => intval($isDraft)), 'mt_id=' . $_topicData['mt_id']);
         /* Now the posts ... */
         $this->DB->update('message_posts', array('msg_date' => time(), 'msg_topic_id' => $_topicData['mt_id'], 'msg_post' => $msgContent, 'msg_author_id' => $fromMemberData['member_id'], 'msg_is_first_post' => 1, 'msg_ip_address' => $this->member->ip_address), 'msg_id=' . $_topicData['mt_first_msg_id']);
         /* Delete any current user mapping as this will be sorted out below */
         $this->DB->delete('message_topic_user_map', 'map_topic_id=' . $_topicData['mt_id']);
         /* Reset variable IDs */
         $msg_topic_id = $_topicData['mt_id'];
         $msg_id = $_topicData['mt_first_msg_id'];
     } else {
         $_messageTopicData = array('mt_date' => time(), 'mt_title' => $msgTitle, 'mt_starter_id' => $fromMemberData['member_id'], 'mt_start_time' => IPS_UNIX_TIME_NOW, 'mt_last_post_time' => IPS_UNIX_TIME_NOW, 'mt_invited_members' => serialize(array_keys($inviteUsersData)), 'mt_to_count' => count(array_keys($inviteUsersData)) + 1, 'mt_to_member_id' => $toMemberData['member_id'], 'mt_is_draft' => $isDraft ? 1 : 0, 'mt_is_system' => $isSystem, 'mt_replies' => 0);
         /* Create topic entry */
         $this->DB->setDataType('mt_title', 'string');
         /* Data Hook Location */
         IPSLib::doDataHooks($_messageTopicData, 'messengerSendTopicData');
         $this->DB->insert('message_topics', $_messageTopicData);
         $msg_topic_id = $this->DB->getInsertId();
         $_messagePostData = array('msg_date' => time(), 'msg_topic_id' => $msg_topic_id, 'msg_post' => $msgContent, 'msg_post_key' => $options['postKey'], 'msg_author_id' => $fromMemberData['member_id'], 'msg_is_first_post' => 1, 'msg_ip_address' => $this->member->ip_address);
         /* Data Hook Location */
         IPSLib::doDataHooks($_messagePostData, 'messengerSendTopicFirstPostData');
         $this->DB->insert('message_posts', $_messagePostData);
         $msg_id = $this->DB->getInsertId();
     }
     //-----------------------------------------
     // Update with last / first msg ID
     //-----------------------------------------
     $this->DB->update('message_topics', array('mt_last_msg_id' => $msg_id, 'mt_first_msg_id' => $msg_id, 'mt_hasattach' => intval($this->_makeAttachmentsPermanent($options['postKey'], $msg_id, $msg_topic_id))), 'mt_id=' . $msg_topic_id);
     //-----------------------------------------
     // Not a draft?
     //-----------------------------------------
     if ($isDraft !== TRUE) {
         //-----------------------------------------
         // Add in 'to user' and 'from user' to the cc array
         //-----------------------------------------
         $inviteUsersData[$toMemberData['member_id']] = $toMemberData;
         $inviteUsersData[$fromMemberData['member_id']] = $fromMemberData;
         //-----------------------------------------
         // Loop....
         //-----------------------------------------
         foreach ($inviteUsersData as $id => $toMember) {
             //-----------------------------------------
             // Enter the info into the DB
             // Target user side.
             //-----------------------------------------
             $_isStarter = $fromMemberData['member_id'] == $toMember['member_id'] ? 1 : 0;
             $_isSystem = ($fromMemberData['member_id'] == $toMember['member_id'] and $isSystem) ? 1 : 0;
             $_isActive = $_isSystem ? 0 : 1;
             /* Create user map entry */
             $this->DB->insert('message_topic_user_map', array('map_user_id' => $toMember['member_id'], 'map_topic_id' => $msg_topic_id, 'map_folder_id' => 'myconvo', 'map_user_active' => $_isActive, 'map_is_starter' => $fromMemberData['member_id'] == $toMember['member_id'] ? 1 : 0, 'map_has_unread' => $fromMemberData['member_id'] == $toMember['member_id'] ? 0 : 1, 'map_read_time' => $fromMemberData['member_id'] == $toMember['member_id'] ? IPS_UNIX_TIME_NOW : 0, 'map_is_system' => $_isSystem, 'map_user_banned' => 0, 'map_left_time' => 0, 'map_ignore_notification' => 0, 'map_last_topic_reply' => IPS_UNIX_TIME_NOW));
             //-----------------------------------------
             // Notifications library
             //-----------------------------------------
             if ($fromMemberData['member_id'] != $toMember['member_id']) {
                 $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications');
                 $notifyLibrary = new $classToLoad($this->registry);
                 $toMember['language'] = $toMember['language'] == "" ? IPSLib::getDefaultLanguage() : $toMember['language'];
                 $buildMessage = array('NAME' => $toMember['members_display_name'], 'POSTER' => $fromMemberData['members_display_name'], 'TITLE' => $msgTitle, 'TEXT' => $msgContent, 'LINK' => "?app=members&module=messaging&section=view&do=showConversation&topicID={$msg_topic_id}#msg{$msg_id}");
                 IPSText::getTextClass('email')->setPlainTextTemplate(IPSText::getTextClass('email')->getTemplate('personal_convo_new_convo', $toMember['language']));
                 IPSText::getTextClass('email')->buildPlainTextContent($buildMessage);
                 IPSText::getTextClass('email')->subject = sprintf(IPSText::getTextClass('email')->subject, $this->registry->output->buildSEOUrl('showuser=' . $fromMemberData['member_id'], 'public', $fromMemberData['members_seo_name'], 'showuser'), $fromMemberData['members_display_name'], $this->registry->output->buildUrl("app=members&module=messaging&section=view&do=showConversation&topicID={$msg_topic_id}#msg{$msg_id}", 'public'));
                 $notifyLibrary->setMember($toMember);
                 $notifyLibrary->setFrom($fromMemberData);
                 $notifyLibrary->setNotificationKey('new_private_message');
                 $notifyLibrary->setNotificationUrl($this->registry->output->buildUrl("app=members&module=messaging&section=view&do=showConversation&topicID={$msg_topic_id}#msg{$msg_id}", 'public'));
                 $notifyLibrary->setNotificationText(IPSText::getTextClass('email')->getPlainTextContent());
                 $notifyLibrary->setNotificationTitle(IPSText::getTextClass('email')->subject);
                 $notifyLibrary->setNotificationHtml(IPSText::getTextClass('email')->buildHtmlContent($buildMessage));
                 $notifyLibrary->setMetaData(array('meta_area' => 'pm', 'meta_id' => $msg_topic_id, 'meta_app' => 'members'));
                 try {
                     $notifyLibrary->sendNotification();
                 } catch (Exception $e) {
                 }
                 IPSMember::save($toMember['member_id'], array('core' => array('msg_count_total' => 'plus:1', 'msg_count_new' => 'plus:1', 'msg_count_reset' => 1)));
             } else {
                 IPSMember::save($toMember['member_id'], array('core' => array('msg_count_total' => 'plus:1')));
             }
         }
     } else {
         //-----------------------------------------
         // Is a draft
         //-----------------------------------------
         /* Create user map entry */
         $this->DB->insert('message_topic_user_map', array('map_user_id' => $fromMemberData['member_id'], 'map_topic_id' => $msg_topic_id, 'map_folder_id' => 'drafts', 'map_user_active' => 1, 'map_has_unread' => 0, 'map_user_banned' => 0, 'map_read_time' => 0, 'map_left_time' => 0, 'map_ignore_notification' => 0, 'map_last_topic_reply' => IPS_UNIX_TIME_NOW));
         if (!$options['topicID']) {
             //-----------------------------------------
             // Update profile
             //-----------------------------------------
             $this->rebuildFolderCount($fromMemberData['member_id'], array('drafts' => 'plus:1'), TRUE, array('core' => array('msg_count_total' => 'plus:1')));
         }
     }
     return TRUE;
 }
开发者ID:Advanture,项目名称:Online-RolePlay,代码行数:101,代码来源:messengerFunctions.php

示例8: sendNewPersonalTopic


//.........这里部分代码省略.........
             $this->sendNewPersonalTopic($toMember['member_id'], $fromMemberID, array(), $msgTitle, $_originalMessageContent, array());
         }
         /* Done */
         return TRUE;
     }
     //-----------------------------------------
     // Insert the user data
     //-----------------------------------------
     $_count = count($inviteUsersData);
     //-----------------------------------------
     // Got a topic ID?
     //-----------------------------------------
     if ($options['topicID']) {
         /* Fetch topic data */
         $_topicData = $this->fetchTopicData($options['topicID']);
         if (!$_topicData['mt_id'] and $this->forceMessageToSend !== TRUE) {
             throw new Exception('TOPIC_ID_NOT_EXISTS');
         }
         $this->DB->force_data_type = array('mt_title' => 'string');
         /* First off, update message_topics and message_posts... */
         $this->DB->update('message_topics', array('mt_date' => time(), 'mt_title' => $msgTitle, 'mt_starter_id' => $fromMemberData['member_id'], 'mt_start_time' => time(), 'mt_last_post_time' => time(), 'mt_invited_members' => serialize(array_keys($inviteUsersData)), 'mt_to_count' => count(array_keys($inviteUsersData)) + 1, 'mt_to_member_id' => $toMemberData['member_id'], 'mt_is_draft' => $isDraft), 'mt_id=' . $_topicData['mt_id']);
         /* Now the posts ... */
         $this->DB->update('message_posts', array('msg_date' => time(), 'msg_topic_id' => $_topicData['mt_id'], 'msg_post' => IPSText::removeMacrosFromInput($msgContent), 'msg_author_id' => $fromMemberData['member_id'], 'msg_is_first_post' => 1, 'msg_ip_address' => $this->member->ip_address), 'msg_id=' . $_topicData['mt_first_msg_id']);
         /* Delete any current user mapping as this will be sorted out below */
         $this->DB->delete('message_topic_user_map', 'map_topic_id=' . $_topicData['mt_id']);
         /* Reset variable IDs */
         $msg_topic_id = $_topicData['mt_id'];
         $msg_id = $_topicData['mt_first_msg_id'];
         IPSMember::save($toMemberData['member_id'], array('core' => array('msg_count_new' => 'plus:1')));
     } else {
         /* Create topic entry */
         $this->DB->force_data_type = array('mt_title' => 'string');
         $this->DB->insert('message_topics', array('mt_date' => time(), 'mt_title' => $msgTitle, 'mt_starter_id' => $fromMemberData['member_id'], 'mt_start_time' => time(), 'mt_last_post_time' => time(), 'mt_invited_members' => serialize(array_keys($inviteUsersData)), 'mt_to_count' => count(array_keys($inviteUsersData)) + 1, 'mt_to_member_id' => $toMemberData['member_id'], 'mt_is_draft' => $isDraft ? 1 : 0, 'mt_is_system' => $isSystem, 'mt_replies' => 0));
         $msg_topic_id = $this->DB->getInsertId();
         $this->DB->insert('message_posts', array('msg_date' => time(), 'msg_topic_id' => $msg_topic_id, 'msg_post' => IPSText::removeMacrosFromInput($msgContent), 'msg_post_key' => $options['postKey'], 'msg_author_id' => $fromMemberData['member_id'], 'msg_is_first_post' => 1, 'msg_ip_address' => $this->member->ip_address));
         $msg_id = $this->DB->getInsertId();
         IPSMember::save($toMemberData['member_id'], array('core' => array('msg_count_new' => 'plus:1')));
     }
     //-----------------------------------------
     // Update with last / first msg ID
     //-----------------------------------------
     $this->DB->update('message_topics', array('mt_last_msg_id' => $msg_id, 'mt_first_msg_id' => $msg_id, 'mt_hasattach' => intval($this->_makeAttachmentsPermanent($options['postKey'], $msg_id, $msg_topic_id))), 'mt_id=' . $msg_topic_id);
     //-----------------------------------------
     // Not a draft?
     //-----------------------------------------
     if ($isDraft !== TRUE) {
         //-----------------------------------------
         // Add in 'to user' and 'from user' to the cc array
         //-----------------------------------------
         $inviteUsersData[$toMemberData['member_id']] = $toMemberData;
         $inviteUsersData[$fromMemberData['member_id']] = $fromMemberData;
         //-----------------------------------------
         // Loop....
         //-----------------------------------------
         foreach ($inviteUsersData as $id => $toMember) {
             //-----------------------------------------
             // Enter the info into the DB
             // Target user side.
             //-----------------------------------------
             $_isStarter = $fromMemberData['member_id'] == $toMember['member_id'] ? 1 : 0;
             $_isSystem = ($fromMemberData['member_id'] == $toMember['member_id'] and $isSystem) ? 1 : 0;
             $_isActive = $_isSystem ? 0 : 1;
             /* Create user map entry */
             $this->DB->insert('message_topic_user_map', array('map_user_id' => $toMember['member_id'], 'map_topic_id' => $msg_topic_id, 'map_folder_id' => 'myconvo', 'map_user_active' => $_isActive, 'map_is_starter' => $fromMemberData['member_id'] == $toMember['member_id'] ? 1 : 0, 'map_has_unread' => $fromMemberData['member_id'] == $toMember['member_id'] ? 0 : 1, 'map_read_time' => $fromMemberData['member_id'] == $toMember['member_id'] ? time() : 0, 'map_is_system' => $_isSystem));
             //-----------------------------------------
             // Update profile
             //-----------------------------------------
             if ($fromMemberData['member_id'] != $toMember['member_id']) {
                 IPSMember::save($toMember['member_id'], array('core' => array('msg_count_total' => 'plus:1', 'msg_show_notification' => $toMember['view_pop'], 'msg_count_reset' => 1)));
             } else {
                 IPSMember::save($fromMemberData['member_id'], array('core' => array('msg_count_total' => 'plus:1', 'msg_count_reset' => 1)));
             }
             //-----------------------------------------
             // Has this member requested a PM email nofity?
             //-----------------------------------------
             if ($toMember['email_pm'] == 1 and $fromMemberData['member_id'] != $toMember['member_id']) {
                 $toMember['language'] = $toMember['language'] == "" ? IPSLib::getDefaultLanguage() : $toMember['language'];
                 IPSText::getTextClass('email')->getTemplate("personal_convo_new_convo", $toMember['language']);
                 IPSText::getTextClass('email')->buildMessage(array('NAME' => $toMember['members_display_name'], 'POSTER' => $fromMemberData['members_display_name'], 'TITLE' => $msgTitle, 'TEXT' => IPSText::removeMacrosFromInput($msgContent), 'LINK' => "?app=members&module=messaging&section=view&do=showConversation&topicID={$msg_topic_id}#msg{$msg_id}"));
                 $this->DB->insert('mail_queue', array('mail_to' => $toMember['email'], 'mail_from' => '', 'mail_date' => time(), 'mail_subject' => IPSText::getTextClass('email')->subject, 'mail_content' => IPSText::getTextClass('email')->message));
                 $cache = $this->cache->getCache('systemvars');
                 $cache['mail_queue'] += 1;
                 $this->cache->setCache('systemvars', $cache, array('array' => 1, 'donow' => 1, 'deletefirst' => 0));
             }
         }
     } else {
         //-----------------------------------------
         // Is a draft
         //-----------------------------------------
         /* Create user map entry */
         $this->DB->insert('message_topic_user_map', array('map_user_id' => $fromMemberData['member_id'], 'map_topic_id' => $msg_topic_id, 'map_folder_id' => 'drafts', 'map_user_active' => 1, 'map_has_unread' => 0, 'map_read_time' => 0));
         if (!$options['topicID']) {
             //-----------------------------------------
             // Update profile
             //-----------------------------------------
             $this->rebuildFolderCount($fromMemberData['member_id'], array('drafts' => 'plus:1'), TRUE, array('core' => array('msg_count_total' => 'plus:1')));
         }
     }
     return TRUE;
 }
开发者ID:dalandis,项目名称:Visualization-of-Cell-Phone-Locations,代码行数:101,代码来源:messengerFunctions.php

示例9: create


//.........这里部分代码省略.........
     }
     if ($finalTables['members']['members_display_name']) {
         $displayName = IPSMember::getFunction()->cleanAndCheckName($finalTables['members']['members_display_name']);
         if ($displayName['errors']) {
             $finalTables['members']['members_display_name'] = '';
         } else {
             $finalTables['members']['members_display_name'] = $displayName['members_display_name'];
         }
     }
     //-----------------------------------------
     // Populate member table(s)
     //-----------------------------------------
     $finalTables['members']['members_l_username'] = isset($finalTables['members']['name']) ? strtolower($finalTables['members']['name']) : '';
     $finalTables['members']['joined'] = $finalTables['members']['joined'] ? $finalTables['members']['joined'] : time();
     $finalTables['members']['email'] = $finalTables['members']['email'] ? $finalTables['members']['email'] : $finalTables['members']['name'] . '@' . $finalTables['members']['joined'];
     $finalTables['members']['member_group_id'] = $finalTables['members']['member_group_id'] ? $finalTables['members']['member_group_id'] : ipsRegistry::$settings['member_group'];
     $finalTables['members']['ip_address'] = $finalTables['members']['ip_address'] ? $finalTables['members']['ip_address'] : ipsRegistry::member()->ip_address;
     $finalTables['members']['members_created_remote'] = intval($finalTables['members']['members_created_remote']);
     $finalTables['members']['member_login_key'] = IPSMember::generateAutoLoginKey();
     $finalTables['members']['member_login_key_expire'] = ipsRegistry::$settings['login_key_expire'] ? time() + intval(ipsRegistry::$settings['login_key_expire']) * 86400 : 0;
     $finalTables['members']['view_sigs'] = 1;
     $finalTables['members']['bday_day'] = intval($finalTables['members']['bday_day']);
     $finalTables['members']['bday_month'] = intval($finalTables['members']['bday_month']);
     $finalTables['members']['bday_year'] = intval($finalTables['members']['bday_year']);
     $finalTables['members']['restrict_post'] = intval($finalTables['members']['restrict_post']);
     $finalTables['members']['auto_track'] = $finalTables['members']['auto_track'] ? $finalTables['members']['auto_track'] : ipsRegistry::$settings['auto_track_method'];
     $finalTables['members']['msg_count_total'] = 0;
     $finalTables['members']['msg_count_new'] = 0;
     $finalTables['members']['msg_show_notification'] = 1;
     $finalTables['members']['coppa_user'] = 0;
     $finalTables['members']['auto_track'] = substr($finalTables['members']['auto_track'], 0, 50);
     $finalTables['members']['last_visit'] = $finalTables['members']['last_visit'] ? $finalTables['members']['last_visit'] : time();
     $finalTables['members']['last_activity'] = $finalTables['members']['last_activity'] ? $finalTables['members']['last_activity'] : time();
     $finalTables['members']['language'] = $finalTables['members']['language'] ? $finalTables['members']['language'] : IPSLib::getDefaultLanguage();
     $finalTables['members']['member_uploader'] = ipsRegistry::$settings['uploadFormType'] ? 'flash' : 'default';
     $finalTables['members']['members_pass_salt'] = IPSMember::generatePasswordSalt(5);
     $finalTables['members']['members_pass_hash'] = IPSMember::generateCompiledPasshash($finalTables['members']['members_pass_salt'], $md_5_password);
     $finalTables['members']['members_display_name'] = isset($finalTables['members']['members_display_name']) ? $finalTables['members']['members_display_name'] : '';
     $finalTables['members']['members_l_display_name'] = isset($finalTables['members']['members_display_name']) ? strtolower($finalTables['members']['members_display_name']) : '';
     $finalTables['members']['fb_uid'] = isset($finalTables['members']['fb_uid']) ? $finalTables['members']['fb_uid'] : 0;
     $finalTables['members']['fb_emailhash'] = isset($finalTables['members']['fb_emailhash']) ? strtolower($finalTables['members']['fb_emailhash']) : '';
     $finalTables['members']['members_seo_name'] = IPSText::makeSeoTitle($finalTables['members']['members_display_name']);
     $finalTables['members']['bw_is_spammer'] = intval($finalTables['members']['bw_is_spammer']);
     //-----------------------------------------
     // Insert: MEMBERS
     //-----------------------------------------
     ipsRegistry::DB()->setDataType(array('name', 'members_l_username', 'members_display_name', 'members_l_display_name', 'members_seo_name', 'email'), 'string');
     /* Bitwise options */
     if (is_array($bitWiseFields['members'])) {
         $_freeze = array();
         foreach ($bitWiseFields['members'] as $field) {
             if (isset($finalTables['members'][$field])) {
                 /* Add to freezeable array */
                 $_freeze[$field] = $finalTables['members'][$field];
                 /* Remove it from the fields to save to DB */
                 unset($finalTables['members'][$field]);
             }
         }
         if (count($_freeze)) {
             $finalTables['members']['members_bitoptions'] = IPSBWOptions::freeze($_freeze, 'members', 'global');
         }
     }
     ipsRegistry::DB()->insert('members', $finalTables['members']);
     //-----------------------------------------
     // Get the member id
     //-----------------------------------------
开发者ID:ConnorChristie,项目名称:GrabViews-Live,代码行数:67,代码来源:ipsMember.php

示例10: addRate


//.........这里部分代码省略.........
             require IPSLib::getAppDir($app) . '/extensions/reputation.php';
             /*maybeLibHook*/
         } else {
             $this->error_message = $this->lang->words['reputation_config'];
             return false;
         }
         if (!$rep_author_config[$type]['column'] || !$rep_author_config[$type]['table']) {
             $this->error_message = $this->lang->words['reputation_config'];
             return false;
         }
         $_col = $rep_author_config[$type]['id_field'] ? $rep_author_config[$type]['id_field'] : $type;
         /* Query the content author */
         $content_author = $this->DB->buildAndFetch(array('select' => "{$rep_author_config[$type]['column']} as id", 'from' => $rep_author_config[$type]['table'], 'where' => "{$_col}={$type_id}"));
         $member_id = $content_author['id'];
     }
     if (!ipsRegistry::$settings['reputation_can_self_vote'] && $member_id == $this->memberData['member_id']) {
         $this->error_message = $this->lang->words['reputation_yourown'];
         return false;
     }
     /* Query the member group */
     if (ipsRegistry::$settings['reputation_protected_groups']) {
         $member_group = $this->DB->buildAndFetch(array('select' => 'member_group_id', 'from' => 'members', 'where' => "member_id={$member_id}"));
         if (in_array($member_group['member_group_id'], explode(',', ipsRegistry::$settings['reputation_protected_groups']))) {
             $this->error_message = $this->lang->words['reputation_protected'];
             return false;
         }
     }
     /* Build the insert array */
     $db_insert = array('member_id' => $this->memberData['member_id'], 'app' => $app, 'type' => $type, 'type_id' => $type_id, 'rep_date' => time(), 'rep_msg' => $message, 'rep_rating' => $rating);
     /* Insert */
     if ($currentRating) {
         if ($rating == -1 && $this->isLikeMode()) {
             $this->DB->delete('reputation_index', "app='{$app}' AND type='{$type}' AND type_id={$type_id} AND member_id=" . $this->memberData['member_id']);
         }
     } else {
         $this->DB->replace('reputation_index', $db_insert, array('app', 'type', 'type_id', 'member_id'));
     }
     /* Update cache */
     $this->updateCache($app, $type, $type_id);
     /* Get authors current rep */
     $author_points = $this->DB->buildAndFetch(array('select' => 'pp_reputation_points', 'from' => 'profile_portal', 'where' => "pp_member_id=" . intval($member_id)));
     /* Figure out new rep */
     if ($currentRating['rep_rating'] == -1) {
         $author_points['pp_reputation_points'] += 1;
     } else {
         if ($currentRating['rep_rating'] == 1) {
             $author_points['pp_reputation_points'] -= 1;
         }
     }
     /* now add on new rating if we're not like mode-ing */
     if (!$this->isLikeMode() || empty($currentRating['rep_rating']) && $this->isLikeMode()) {
         $author_points['pp_reputation_points'] += $rating;
     }
     $this->DB->update('profile_portal', array('pp_reputation_points' => $author_points['pp_reputation_points']), "pp_member_id={$member_id}");
     /* Notification */
     if ($rating == 1 && $this->isLikeMode() && $app == 'forums' && $type == 'pid') {
         /* Check for class_forums */
         if (!$this->registry->isClassLoaded('class_forums')) {
             $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums');
             $this->registry->setClass('class_forums', new $classToLoad($this->registry));
             $this->registry->strip_invisible = 0;
             $this->registry->class_forums->forumsInit();
         }
         $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications');
         $notifyLibrary = new $classToLoad($this->registry);
         if (!$this->registry->isClassLoaded('topics')) {
             $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/topics.php", 'app_forums_classes_topics', 'forums');
             $this->registry->setClass('topics', new $classToLoad($this->registry));
         }
         $post = $this->registry->getClass('topics')->getPostById($type_id);
         /* Set topic data */
         $this->registry->getClass('topics')->setTopicData($post);
         /* Quick check */
         if (!$post['author_id'] or $post['author_id'] == $this->memberData['member_id']) {
             return true;
         }
         $_toMember = IPSMember::load($post['author_id']);
         /* Set language */
         $_toMember['language'] = $_toMember['language'] == "" ? IPSLib::getDefaultLanguage() : $_toMember['language'];
         /* Quick permission check */
         if ($this->registry->getClass('topics')->canView() !== true) {
             return true;
         }
         $url = $this->registry->output->buildSEOUrl("showtopic={$post['topic_id']}&amp;view=findpost&amp;p={$post['pid']}", "publicNoSession", $post['title_seo'], 'showtopic');
         IPSText::getTextClass('email')->getTemplate("new_likes", $_toMember['language']);
         IPSText::getTextClass('email')->buildMessage(array('MEMBER_NAME' => $this->memberData['members_display_name'], 'SHORT_POST' => IPSText::truncate(IPSText::getTextClass('bbcode')->stripAllTags($post['post']), 300), 'URL' => $url));
         IPSText::getTextClass('email')->subject = sprintf(IPSText::getTextClass('email')->subject, $this->registry->output->buildSEOUrl('showuser=' . $this->memberData['member_id'], 'publicNoSession', $this->memberData['members_seo_name'], 'showuser'), $this->memberData['members_display_name'], $url, $this->registry->output->buildSEOUrl("showtopic={$post['topic_id']}", "publicNoSession", $post['title_seo'], 'showtopic'), IPSText::truncate($post['topic_title'], 30));
         $notifyLibrary->setMember($_toMember);
         $notifyLibrary->setFrom($this->memberData);
         $notifyLibrary->setNotificationKey('new_likes');
         $notifyLibrary->setNotificationUrl($url);
         $notifyLibrary->setNotificationText(IPSText::getTextClass('email')->message);
         $notifyLibrary->setNotificationTitle(IPSText::getTextClass('email')->subject);
         try {
             $notifyLibrary->sendNotification();
         } catch (Exception $e) {
         }
     }
     return true;
 }
开发者ID:ConnorChristie,项目名称:GrabViews,代码行数:101,代码来源:class_reputation_cache.php

示例11: setEmailSubject

 /**
  * Set email subject
  *
  * @param	array		$data			Subject data
  * @param	string		$language		Language to use
  * @param	string		$lang_file		Language file to load
  * @param	string		$app			Application of language file
  * @return	@e void
  */
 public function setEmailSubject($data, $language = '', $lang_file = 'public_email_content', $app = 'core')
 {
     if (!is_array($data) or !$data['key']) {
         return;
     }
     /* This is a bit hacky. Sorry */
     $tmp = $this->lang->words;
     if (!$language) {
         $language = IPSLib::getDefaultLanguage();
     }
     $this->registry->class_localization->loadLanguageFile(array($lang_file), $app, $language, TRUE);
     //-----------------------------------------
     // Stored KEY?
     //-----------------------------------------
     if (!isset($this->lang->words[$data['key']])) {
         if ($language != IPSLib::getDefaultLanguage()) {
             $this->registry->class_localization->loadLanguageFile(array($lang_file), $app, IPSLib::getDefaultLanguage(), TRUE);
         }
     }
     if (is_array($data['params'])) {
         foreach ($data['params'] as $p) {
             /* Each iteration should replace one %s */
             $this->_emailTitle = sprintf($this->lang->words[$data['key']], $p);
         }
     }
     /* Yeah */
     $this->lang->words = $tmp;
 }
开发者ID:Advanture,项目名称:Online-RolePlay,代码行数:37,代码来源:notifications.php

示例12: buildMessage

 /**
  * Legacy, generic method: builds an email from a template, replacing variables
  *
  * @deprecated
  * @param	array		Replacement keys to values
  * @param	bool		Do not "clean"
  * @param	bool		Raw HTML
  * @param	array		Member data - necessary if including unsubscribe link
  * @return	@e void
  */
 public function buildMessage($words, $noClean = false, $rawHtml = FALSE, $memberData = array())
 {
     /* Init */
     $ptWords = array();
     $htmlWords = array();
     $subjWords = array();
     /* Try this first */
     if (!$this->plainTextTemplate && !$this->htmlTemplate && $this->message) {
         $this->setPlainTextTemplate($this->message, true);
     }
     /* need to converge some stuff here */
     if (!$this->plainTextTemplate && $this->template) {
         /* Sniff, sniff */
         if (stristr($this->template, '<br')) {
             if (!$this->htmlTemplate) {
                 $this->setHtmlTemplate($this->template);
             }
             $this->setPlainTextTemplate(IPSText::br2nl($this->template));
         } else {
             if (!$this->htmlTemplate) {
                 $this->setHtmlTemplate(nl2br($this->template));
             }
             $this->setPlainTextTemplate($this->template);
         }
     }
     /* HTML enabled but no specific template: Auto convert */
     if ($this->html_email && !$this->htmlTemplate) {
         /* It will be dynamically updated at the end */
         $this->setHtmlTemplate($this->plainTextTemplate);
     }
     /* HTML email with HTML template but no plain text version */
     if ($this->htmlTemplate && !$this->plainTextTemplate) {
         $msg = $this->htmlTemplate;
         $msg = preg_replace('/<#(.+?)#>/', '{{{-\\1-}}}', $msg);
         $msg = str_replace("<br />", "\n", $msg);
         $msg = str_replace("<br>", "\n", $msg);
         $msg = IPSText::stripTags($msg);
         $msg = html_entity_decode($msg, ENT_QUOTES);
         $msg = str_replace('&#092;', '\\', $msg);
         $msg = str_replace('&#036;', '$', $msg);
         $msg = preg_replace('/\\{\\{\\{(.+?)\\}\\}\\}/', '<#\\1#>', $msg);
         $this->setPlainTextTemplate($msg);
     }
     if ($this->plainTextTemplate && !$this->template && ($this->html_email && !$this->htmlTemplate)) {
         $this->error++;
         $this->fatalError("Could not build the email message, no template assigned", "Make sure a template is assigned first.");
     }
     /* Bit more clean up */
     $this->plainTextTemplate = str_replace(array("\r\n", "\r", "\n"), "\n", $this->plainTextTemplate);
     $this->htmlTemplate = str_replace(array("\r\n", "\r", "\n"), "\n", $this->htmlTemplate);
     /* Apply HTML wrapper */
     $this->htmlTemplate = $this->applyHtmlWrapper($this->subject, $rawHtml ? $this->htmlTemplate : $this->convertTextEmailToHtmlEmail($this->htmlTemplate, $rawHtml));
     /* Add unsubscribe link */
     if ($this->unsubscribe and !empty($memberData)) {
         $this->registry->class_localization->loadLanguageFile(array('public_global'), 'core', $this->language ? $this->language : IPSLib::getDefaultLanguage(), TRUE);
         $key = md5($memberData['email'] . ':' . $memberData['members_pass_hash']);
         $link = $this->registry->output->buildUrl("app=core&amp;module=global&amp;section=unsubscribe&amp;member={$memberData['member_id']}&amp;key={$key}", 'publicNoSession');
         $this->plainTextTemplate = str_replace("<#UNSUBSCRIBE#>", "{$this->registry->class_localization->words['email_unsubscribe']}: {$link}", $this->plainTextTemplate);
         $this->htmlTemplate = str_replace("<#UNSUBSCRIBE#>", "<a href='{$link}'>" . $this->registry->class_localization->words['email_unsubscribe'] . '</a>', $this->htmlTemplate);
     }
     /* Add some default words */
     $words['BOARD_ADDRESS'] = $this->settings['board_url'] . '/index.' . $this->settings['php_ext'];
     $words['WEB_ADDRESS'] = $this->settings['home_url'];
     $words['BOARD_NAME'] = $this->settings['board_name'];
     $words['SIGNATURE'] = $this->settings['signature'] ? $this->settings['signature'] : '';
     /* Swap the words: 10.7.08 - Added replacements in subject */
     foreach ($words as $k => $v) {
         if (!$noClean) {
             $ptWords[$k] = $this->cleanMessage($v);
         }
         $subjWords[$k] = $this->cleanMessage($v, false, false);
         /* Convert over words too so links are linkified */
         $htmlWords[$k] = $rawHtml ? $v : $this->convertTextEmailToHtmlEmail($v, $rawHtml);
     }
     $this->_words = $ptWords;
     $this->plainTextTemplate = preg_replace_callback("/<#(.+?)#>/", array(&$this, '_swapWords'), $this->plainTextTemplate);
     $this->_words = $htmlWords;
     $this->htmlTemplate = preg_replace_callback("/<#(.+?)#>/", array(&$this, '_swapWords'), str_replace(array('&lt;#', '#&gt;'), array('<#', '#>'), $this->htmlTemplate));
     $this->_words = $subjWords;
     $this->subject = preg_replace_callback("/<#(.+?)#>/", array(&$this, '_swapWords'), $this->subject);
     $this->_words = array();
     /* Final touches */
     $this->htmlTemplate = preg_replace('#<!--hook\\.([^\\>]+?)-->#', '', $this->htmlTemplate);
     $this->htmlTemplate = $this->registry->getClass('output')->parseIPSTags($this->htmlTemplate);
     /* strip all tags if not HTML */
     if (!$this->settings['email_use_html']) {
         $this->plainTextTemplate = IPSText::stripTags($this->plainTextTemplate);
     }
     $this->plainTextTemplate = IPSText::stripTags(stripslashes($this->lang->words['email_header'])) . $this->plainTextTemplate . IPSText::stripTags(stripslashes($this->lang->words['email_footer']));
     /* Some older apps use $this->message, so give them plaintext */
//.........这里部分代码省略.........
开发者ID:mover5,项目名称:imobackup,代码行数:101,代码来源:han_email.php

示例13: getTemplate

 /**
  * Retrieve an email template
  *
  * @access	public
  * @param	string		Template key
  * @param	string		Language to use
  * @param	string		Language file to load
  * @param	string		Application of language file
  * @return	void
  */
 public function getTemplate($name, $language = "", $lang_file = 'public_email_content', $app = 'core')
 {
     //-----------------------------------------
     // Check..
     //-----------------------------------------
     if ($name == "") {
         $this->error++;
         $this->fatalError("A valid email template ID was not passed to the email library during template parsing", "");
     }
     //-----------------------------------------
     // Default?
     //-----------------------------------------
     if (!$language) {
         $language = IPSLib::getDefaultLanguage();
     }
     //-----------------------------------------
     // Check and get
     //-----------------------------------------
     $this->registry->class_localization->loadLanguageFile(array($lang_file), $app, $language);
     //-----------------------------------------
     // Stored KEY?
     //-----------------------------------------
     if (!isset($this->lang->words[$name])) {
         if ($language == IPSLib::getDefaultLanguage()) {
             $this->fatalError("Could not find an email template with an ID of '{$name}'", "");
         } else {
             $this->registry->class_localization->loadLanguageFile(array($lang_file), $app, IPSLib::getDefaultLanguage());
             if (!isset($this->lang->words[$name])) {
                 $this->fatalError("Could not find an email template with an ID of '{$name}'", "");
             }
         }
     }
     //-----------------------------------------
     // Subject?
     //-----------------------------------------
     if (isset($this->lang->words['subject__' . $name])) {
         $this->subject = stripslashes($this->lang->words['subject__' . $name]);
     }
     //-----------------------------------------
     // Return
     //-----------------------------------------
     $this->template = stripslashes($this->lang->words['email_header']) . stripslashes($this->lang->words[$name]) . stripslashes($this->lang->words['email_footer']);
 }
开发者ID:dalandis,项目名称:Visualization-of-Cell-Phone-Locations,代码行数:53,代码来源:han_email.php


注:本文中的IPSLib::getDefaultLanguage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。