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


PHP IPSLib::doDataHooks方法代码示例

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


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

示例1: reply

 /**
  * Create a status update for a member
  *
  * @param	array	[Array of member data for member updating their status - will use ->getAuthor() if null]
  * @param	array	[Array of status information OR status ID OR uses $this->_internalData['StatusData'] if none]
  * @return	array	Reply information
  */
 public function reply($author = null, $status = null)
 {
     $author = $author === null ? $this->getAuthor() : $author;
     $status = $status === null ? $this->_internalData['StatusData'] : (is_array($status) ? $status : $this->_loadStatus($status));
     $data = array();
     if ($this->canReply($author, $status, $status)) {
         if ($this->getContent() and $status['status_id']) {
             $data = array('reply_status_id' => $status['status_id'], 'reply_member_id' => $author['member_id'], 'reply_date' => time(), 'reply_content' => $this->_cleanContent($this->getContent()));
             /* Data Hook Location */
             IPSLib::doDataHooks($data, 'statusCommentNew');
             $this->DB->insert('member_status_replies', $data);
             $data['reply_id'] = $this->DB->getInsertId();
             $this->_recordAction('reply', $author, $status, $data);
             $this->rebuildStatus($status);
             $this->rebuildOwnerLatest($author);
             $this->_sendNotification($author, $status, $data);
         }
         return $data;
     }
     return FALSE;
 }
开发者ID:ConnorChristie,项目名称:GrabViews,代码行数:28,代码来源:status.php

示例2: import


//.........这里部分代码省略.........
                 preg_match("#(\\d+?)H#is", $event['duration'], $match);
                 $hour = $match[1] ? $match[1] : 0;
                 preg_match("#(\\d+?)M#is", $event['duration'], $match);
                 $minute = $match[1] ? $match[1] : 0;
                 preg_match("#(\\d+?)S#is", $event['duration'], $match);
                 $second = $match[1] ? $match[1] : 0;
                 $event_unix_to = $event_unix_from + $hour * 3600 + $minute * 60 + $second;
             }
             //-----------------------------------------
             // Recurring...
             //-----------------------------------------
             $recurring = 0;
             if (isset($event['recurr']['FREQ'])) {
                 if ($event['recurr']['FREQ'] == 'MONTHLY' and $event['recurr']['INTERVAL'] == 12) {
                     $event['recurr']['FREQ'] = 'YEARLY';
                 }
                 switch ($event['recurr']['FREQ']) {
                     case 'WEEKLY':
                         $recurring = 1;
                         break;
                     case 'MONTHLY':
                         $recurring = 2;
                         break;
                     case 'YEARLY':
                         $recurring = 3;
                         break;
                 }
                 $event_unix_to = $event['recurr']['until_ts'] ? $event['recurr']['until_ts'] : time() + 86400 * 365 * 10;
             }
             //-----------------------------------------
             // Adjust timestamps if all day event
             //-----------------------------------------
             if ($event_all_day) {
                 $event_unix_from = gmmktime(0, 0, 0, gmstrftime('%m', $event_unix_from), gmstrftime('%d', $event_unix_from), gmstrftime('%Y', $event_unix_from));
                 $event_unix_to = $event_unix_to ? gmmktime(0, 0, 0, gmstrftime('%m', $event_unix_to), gmstrftime('%d', $event_unix_to), gmstrftime('%Y', $event_unix_to)) : 0;
             }
             //-----------------------------------------
             // If we are missing crucial data, skip
             //-----------------------------------------
             if (!($event['description'] or $event['summary']) or !$event_unix_from) {
                 $_skipped++;
                 continue;
             }
             //-----------------------------------------
             // Skip previously imported events
             //-----------------------------------------
             if ($event['uid']) {
                 $_check = $this->DB->buildAndFetch(array('select' => 'import_id', 'from' => 'cal_import_map', 'where' => "import_guid='" . $this->DB->addSlashes($event['uid']) . "'"));
                 if ($_check['import_id']) {
                     $_skipped++;
                     continue;
                 }
             }
             //-----------------------------------------
             // Format array for storage
             //-----------------------------------------
             $_eventData = array('event_calendar_id' => $this->calendar['cal_id'], 'event_member_id' => $_member['member_id'], 'event_content' => $event['description'] ? nl2br($event['description']) : $event['summary'], 'event_title' => $event['summary'] ? $event['summary'] : IPSText::truncate($event['description'], 100), 'event_title_seo' => IPSText::makeSeoTitle($event['summary']), 'event_smilies' => 1, 'event_comments' => 0, 'event_rsvp' => count($event['attendee']) ? 1 : 0, 'event_perms' => '*', 'event_private' => 0, 'event_approved' => 1, 'event_saved' => $event['created'] ? $event['created'] : time(), 'event_lastupdated' => $event['last_modified'] ? $event['last_modified'] : ($event['created'] ? $event['created'] : time()), 'event_recurring' => $recurring, 'event_start_date' => strftime("%Y-%m-%d %H:%M:00", $event_unix_from), 'event_end_date' => $event_unix_to ? strftime("%Y-%m-%d %H:%M:00", $event_unix_to) : 0, 'event_post_key' => md5(uniqid(microtime(), true)), 'event_sequence' => intval($event['sequence']), 'event_all_day' => $event_all_day);
             //-----------------------------------------
             // Data hooks
             //-----------------------------------------
             IPSLib::doDataHooks($_eventData, 'calendarAddEvent');
             //-----------------------------------------
             // Insert
             //-----------------------------------------
             $this->DB->insert('cal_events', $_eventData);
             $event_id = $this->DB->getInsertId();
             $_imported++;
             //-----------------------------------------
             // Insert mapping
             //-----------------------------------------
             $this->DB->insert('cal_import_map', array('import_feed_id' => $feed_id, 'import_event_id' => $event_id, 'import_guid' => $event['uid']));
             //-----------------------------------------
             // If we have attendees that are members, insert them
             //-----------------------------------------
             if (isset($event['attendee']) and count($event['attendee'])) {
                 foreach ($event['attendee'] as $attendee) {
                     if ($attendee['email']) {
                         $_loadedMember = IPSMember::load($attendee['email']);
                         if ($_loadedMember['member_id']) {
                             $this->DB->insert('cal_event_rsvp', array('rsvp_member_id' => $_loadedMember['member_id'], 'rsvp_event_id' => $event_id, 'rsvp_date' => time()));
                         }
                     }
                 }
             }
             //-----------------------------------------
             // Send notifications
             //-----------------------------------------
             $_url = $this->registry->output->buildSEOUrl('app=calendar&module=calendar&section=view&do=showevent&event_id=' . $event_id, 'public', $_eventData['event_title_seo'], 'cal_event');
             $_like->sendNotifications($_eventData['event_calendar_id'], array('immediate', 'offline'), array('notification_key' => 'new_event', 'notification_url' => $_url, 'email_template' => 'add_event_follow', 'email_subject' => sprintf($this->lang->words['add_event_follow_subject'], $_url, $_eventData['event_title']), 'build_message_array' => array('NAME' => '-member:members_display_name-', 'AUTHOR' => $_member['members_display_name'], 'TITLE' => $_eventData['event_title'], 'URL' => $_url)));
         }
     }
     //-----------------------------------------
     // Rebuild cache
     //-----------------------------------------
     $this->cache->rebuildCache('calendar_events', 'calendar');
     //-----------------------------------------
     // Return
     //-----------------------------------------
     return array('skipped' => $_skipped, 'imported' => $_imported);
 }
开发者ID:mover5,项目名称:imobackup,代码行数:101,代码来源:icalendar.php

示例3: save


//.........这里部分代码省略.........
                 // The values we set earlier during init are fine
             }
         }
     }
     if (!empty($errors)) {
         return $this->form($errors);
     }
     //-----------------------------------------
     // Parse
     //-----------------------------------------
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite');
     $editor = new $classToLoad();
     $noteForMember = $editor->process($_POST['note_member']);
     $noteForMods = $editor->process($_POST['note_mods']);
     //-----------------------------------------
     // Save Log
     //-----------------------------------------
     /* If our points are going to expire, woprk out exactly when */
     $expireDate = 0;
     if ($removePoints) {
         IPSTime::setTimestamp(time());
         if ($removePointsUnit == 'h') {
             IPSTime::add_hours($removePoints);
         } else {
             IPSTime::add_days($removePoints);
         }
         $expireDate = IPSTime::getTimestamp();
     }
     /* Log */
     $warning = array('wl_member' => $this->_member['member_id'], 'wl_moderator' => $this->memberData['member_id'], 'wl_date' => time(), 'wl_reason' => $reason, 'wl_points' => $points, 'wl_note_member' => $noteForMember, 'wl_note_mods' => $noteForMods, 'wl_mq' => $mq, 'wl_mq_unit' => $mq_unit, 'wl_rpa' => $rpa, 'wl_rpa_unit' => $rpa_unit, 'wl_suspend' => $suspend, 'wl_suspend_unit' => $suspend_unit, 'wl_ban_group' => $banGroup, 'wl_expire' => $removePoints, 'wl_expire_unit' => $removePointsUnit, 'wl_acknowledged' => $this->settings['warnings_acknowledge'] ? 0 : 1, 'wl_content_app' => trim($this->request['from_app']), 'wl_content_id1' => $this->request['from_id1'], 'wl_content_id2' => $this->request['from_id2'], 'wl_expire_date' => $expireDate);
     /* Data Hook Location */
     $warning['actionData'] = $action;
     $warning['reasonsData'] = $this->reasons;
     IPSLib::doDataHooks($warning, 'memberWarningPre');
     unset($warning['actionData'], $warning['reasonsData']);
     $this->DB->insert('members_warn_logs', $warning);
     $warning['wl_id'] = $this->DB->getInsertId();
     /* Data Hook Location */
     $warning['actionData'] = $action;
     $warning['reasonsData'] = $this->reasons;
     IPSLib::doDataHooks($warning, 'memberWarningPost');
     unset($warning['actionData'], $warning['reasonsData']);
     //-----------------------------------------
     // Actually do it
     //-----------------------------------------
     $update = array();
     /* Add Points */
     if ($points) {
         $update['warn_level'] = $this->_member['warn_level'] + $points;
     }
     /* Set Punishments */
     if ($mq) {
         $update['mod_posts'] = $mq == -1 ? 1 : IPSMember::processBanEntry(array('unit' => $mq_unit, 'timespan' => $mq));
     }
     if ($rpa) {
         $update['restrict_post'] = $rpa == -1 ? 1 : IPSMember::processBanEntry(array('unit' => $rpa_unit, 'timespan' => $rpa));
     }
     if ($suspend) {
         if ($suspend == -1) {
             $update['member_banned'] = 1;
         } else {
             $update['temp_ban'] = IPSMember::processBanEntry(array('unit' => $suspend_unit, 'timespan' => $suspend));
         }
     }
     if ($banGroup > 0) {
         if (!$this->caches['group_cache'][$banGroup]['g_access_cp'] and !$this->caches['group_cache'][$banGroup]['g_is_supmod'] and $banGroup != $this->settings['guest_group']) {
开发者ID:Advanture,项目名称:Online-RolePlay,代码行数:67,代码来源:warnings.php

示例4: updateForumAndStats

 /**
  * Update forum's last post information
  *
  * @param	array 	$topic
  * @param	string	$type
  * @return	@e void
  */
 protected function updateForumAndStats($topic, $type = 'new')
 {
     $moderated = 0;
     $stat_cache = $this->registry->cache()->getCache('stats');
     $forum_data = $this->getForumData();
     //-----------------------------------------
     // Moderated?
     //-----------------------------------------
     $moderate = 0;
     if ($this->getPublished() === false) {
         $moderate = 1;
     }
     //-----------------------------------------
     // Add to forum's last post?
     //-----------------------------------------
     if (!$moderate) {
         if ($topic['approved']) {
             $dbs = array('last_title' => $topic['title'], 'seo_last_title' => IPSText::makeSeoTitle($topic['title']), 'last_id' => $topic['tid'], 'last_post' => IPS_UNIX_TIME_NOW, 'last_poster_name' => $this->getAuthor('member_id') ? $this->getAuthor('members_display_name') : $this->request['UserName'], 'seo_last_name' => IPSText::makeSeoTitle($this->getAuthor('member_id') ? $this->getAuthor('members_display_name') : $this->request['UserName']), 'last_poster_id' => $this->getAuthor('member_id'), 'last_x_topic_ids' => $this->registry->class_forums->lastXFreeze($this->registry->class_forums->buildLastXTopicIds($forum_data['id'], FALSE)));
             if ($type == 'new') {
                 $stat_cache['total_topics']++;
                 $forum_data['topics'] = intval($forum_data['topics']);
                 $dbs['topics'] = ++$forum_data['topics'];
                 $dbs['newest_id'] = $topic['tid'];
                 $dbs['newest_title'] = $topic['title'];
             } else {
                 $stat_cache['total_replies']++;
                 $forum_data['posts'] = intval($forum_data['posts']);
                 $dbs['posts'] = ++$forum_data['posts'];
             }
         }
     } else {
         if ($type == 'new') {
             $forum_data['queued_topics'] = intval($forum_data['queued_topics']);
             $dbs['queued_topics'] = ++$forum_data['queued_topics'];
         } else {
             $forum_data['queued_posts'] = intval($forum_data['queued_posts']);
             $dbs['queued_posts'] = ++$forum_data['queued_posts'];
         }
     }
     //-----------------------------------------
     // Merging posts?
     // Don't update counter
     //-----------------------------------------
     if ($this->_isMergingPosts) {
         unset($dbs['posts']);
         unset($dbs['queued_posts']);
         $stat_cache['total_replies'] -= 1;
     }
     //-----------------------------------------
     // Update
     //-----------------------------------------
     if (is_array($dbs) and count($dbs)) {
         $this->DB->setDataType(array('last_poster_name', 'seo_last_name', 'seo_last_title', 'last_title'), 'string');
         /* Data Hook Location */
         IPSLib::doDataHooks($dbs, 'updateForumLastPostData');
         $this->DB->update('forums', $dbs, "id=" . intval($forum_data['id']));
     }
     //-----------------------------------------
     // Update forum cache
     //-----------------------------------------
     //$this->registry->getClass('class_forums')->updateForumCache();
     $this->registry->cache()->setCache('stats', $stat_cache, array('array' => 1, 'donow' => 0));
 }
开发者ID:ConnorChristie,项目名称:GrabViews,代码行数:70,代码来源:classPost.php

示例5: sendNewPersonalTopic


//.........这里部分代码省略.........
             $this->sendNewPersonalTopic($toMember['member_id'], $fromMemberID, array(), $msgTitle, $_newContent, array('postKey' => $_newPostKey));
         }
         /* 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->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;
开发者ID:Advanture,项目名称:Online-RolePlay,代码行数:67,代码来源:messengerFunctions.php

示例6: _getPosts

 /**
  * Get Topic Data
  *
  * @return	array
  */
 public function _getPosts()
 {
     /* Init */
     $topicData = $this->registry->getClass('topics')->getTopicData();
     $forumData = $this->forumClass->getForumById($topicData['forum_id']);
     $permissionData = $this->registry->getClass('topics')->getPermissionData();
     $first = $this->registry->getClass('topics')->pageToSt($this->request['page']);
     /* Default - just see all visible posts */
     $queued_query_bit = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery('visible', '');
     /* Can we deal with hidden posts? */
     if ($this->registry->class_forums->canQueuePosts($topicData['forum_id'])) {
         if ($permissionData['softDeleteSee']) {
             /* See queued and soft deleted */
             $queued_query_bit = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery(array('visible', 'hidden', 'sdeleted'), '');
         } else {
             /* Otherwise, see queued and approved */
             $queued_query_bit = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery(array('visible', 'hidden'), '');
         }
         /* Specifically requesting to see queued posts only */
         if ($this->request['modfilter'] and $this->request['modfilter'] == 'invisible_posts') {
             $queued_query_bit = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery('hidden', '');
         }
     } else {
         /* We cannot see hidden posts */
         if ($permissionData['softDeleteSee']) {
             /* See queued and soft deleted */
             $queued_query_bit = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery(array('approved', 'sdeleted'), '');
         }
     }
     /* Did we specifically want to see soft deleted posts? */
     if ($this->request['modfilter'] == 'deleted_posts' and $permissionData['softDeleteSee']) {
         $queued_query_bit = ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery('sdeleted', '');
     }
     /* Data Hook Location */
     $dataHook = array('members' => array(), 'postJoins' => array());
     IPSLib::doDataHooks($dataHook, 'topicViewQuery');
     //-----------------------------------------
     // Joins
     //-----------------------------------------
     $_extraMember = is_array($dataHook['members']) && count($dataHook['members']) ? ',m.' . implode(',m.', $dataHook['members']) : '';
     $_post_joins = array(array('select' => '', 'from' => array('posts' => 'p'), 'where' => 'p.pid=z.pid'), array('select' => 'm.member_id as mid,m.name,m.member_group_id,m.email,m.joined,m.posts, m.last_visit, m.last_activity,m.login_anonymous,m.title as member_title, m.warn_level, m.warn_lastwarn, m.members_display_name, m.members_seo_name, m.member_banned, m.has_gallery, m.has_blog, m.members_bitoptions,m.mgroup_others' . $_extraMember, 'from' => array('members' => 'm'), 'where' => 'm.member_id=p.author_id', 'type' => 'left'), array('select' => 'pp.*', 'from' => array('profile_portal' => 'pp'), 'where' => 'm.member_id=pp.pp_member_id', 'type' => 'left'));
     /* Warn system enabled? */
     if ($this->settings['warn_on'] == 1) {
         $_post_joins[] = array('select' => 'w.wl_id', 'from' => array('members_warn_logs' => 'w'), 'where' => 'w.wl_content_app=\'forums\' and w.wl_content_id1=p.pid');
     }
     /* Add data hook joins */
     if (is_array($dataHook['postJoins']) && count($dataHook['postJoins'])) {
         $_post_joins = array_merge($_post_joins, $dataHook['postJoins']);
     }
     /* Add custom fields join? */
     if ($this->settings['custom_profile_topic'] == 1) {
         $_post_joins[] = array('select' => 'pc.*', 'from' => array('pfields_content' => 'pc'), 'where' => 'pc.member_id=p.author_id', 'type' => 'left');
     }
     /* Reputation system enabled? */
     if ($this->settings['reputation_enabled']) {
         /* Add the join to figure out if the user has already rated the post */
         $_post_joins[] = $this->registry->repCache->getUserHasRatedJoin('pid', 'p.pid', 'forums');
         /* Add the join to figure out the total ratings for each post */
         if ($this->settings['reputation_show_content']) {
             $_post_joins[] = $this->registry->repCache->getTotalRatingJoin('pid', 'p.pid', 'forums');
         }
     }
     /* Cache? */
     if (IPSContentCache::isEnabled()) {
         if (IPSContentCache::fetchSettingValue('post')) {
             $_post_joins[] = IPSContentCache::join('post', 'p.pid');
         }
         if (IPSContentCache::fetchSettingValue('sig')) {
             $_post_joins[] = IPSContentCache::join('sig', 'm.member_id', 'ccb', 'left', 'ccb.cache_content as cache_content_sig, ccb.cache_updated as cache_updated_sig');
         }
     }
     /* Ignored Users */
     $ignored_users = array();
     foreach ($this->member->ignored_users as $_i) {
         if ($_i['ignore_topics']) {
             $ignored_users[] = $_i['ignore_ignore_id'];
         }
     }
     //-----------------------------------------
     // Get posts
     // See http://community.invisionpower.com/resources/bugs.html/_/ip-board/big-topics-i-mean-big-topics-r36577 for an explanation why this a bit odd
     //-----------------------------------------
     $this->DB->build(array('select' => 'p.*', 'from' => array('( ****FROM**** )' => 'z'), 'add_join' => $_post_joins));
     $query = $this->DB->fetchSqlString();
     $this->DB->flushQuery();
     $this->DB->build(array('select' => 'pid, post_date', 'from' => 'posts', 'where' => 'topic_id=' . $topicData['tid'] . $queued_query_bit, 'order' => $this->settings['post_order_column'] . ' ' . $this->settings['post_order_sort'], 'limit' => array($first, $this->settings['display_max_posts'])));
     $query = str_replace('****FROM****', $this->DB->fetchSqlString(), $query) . " ORDER BY z." . $this->settings['post_order_column'] . " " . $this->settings['post_order_sort'];
     $query = str_replace($this->settings['sql_tbl_prefix'] . '(', '(', $query);
     $this->DB->flushQuery();
     $this->DB->allow_sub_select = TRUE;
     $oq = $this->DB->query($query);
     if (!$this->DB->getTotalRows()) {
         if ($first >= $this->settings['display_max_posts']) {
             //-----------------------------------------
             // AUTO FIX: Get the correct number of replies...
//.........这里部分代码省略.........
开发者ID:ConnorChristie,项目名称:GrabViews-Live,代码行数:101,代码来源:topics.php

示例7: addFriend

 /**
  * Adds a friend to the account that is logged in or specified
  *
  * @param	integer	$friend_id			The friend being added to the account
  * @param	integer	$from_id			The requesting member, defaults to current member
  * @param	boolean	$forceApproval		Automatically approve, regardless of setting
  * @param	boolean	$sendNotification	If false, no notification will be sent to the member being added
  * @return	string						Error Key or blank for success
  */
 public function addFriend($friend_id, $from_id = 0, $forceApproval = false, $sendNotification = true)
 {
     /* INIT */
     $friend_id = intval($friend_id);
     $from_id = $from_id ? intval($from_id) : $this->memberData['member_id'];
     $friend = array();
     $member = array();
     $friends_approved = 1;
     $message = '';
     $subject = '';
     $to = array();
     $from = array();
     $return_msg = '';
     /* Can't add yourself */
     if ($from_id == $friend_id) {
         return 'error';
     }
     /* Load our friends account */
     $friend = IPSMember::load($friend_id);
     /* Load our account */
     $member = IPSMember::load($from_id);
     /* This group not allowed to add friends */
     if (!$member['g_can_add_friends']) {
         return 'error';
     }
     /* Make sure we found ourselves and our friend */
     if (!$friend['member_id'] or !$member['member_id']) {
         return 'error';
     }
     /* Are we already friends? */
     $friend_check = $this->DB->buildAndFetch(array('select' => 'friends_id', 'from' => 'profile_friends', 'where' => "friends_member_id={$from_id} AND friends_friend_id={$friend_id}"));
     if ($friend_check['friends_id']) {
         return 'pp_friend_already';
     }
     /* Check flood table */
     if ($this->_canAddFriend($from_id, $friend['member_id']) !== TRUE) {
         return 'pp_friend_timeflood';
     }
     /* Do we approve our friends first? */
     if (!$forceApproval and $friend['pp_setting_moderate_friends']) {
         $friends_approved = 0;
         $this->pendingApproval = true;
     }
     $_profileFriendsData = array('friends_member_id' => $member['member_id'], 'friends_friend_id' => $friend['member_id'], 'friends_approved' => $friends_approved, 'friends_added' => time());
     /* Data Hook Location */
     IPSLib::doDataHooks($_profileFriendsData, 'profileFriendsNew');
     /* Insert the friend */
     $this->DB->insert('profile_friends', $_profileFriendsData);
     /* Do we need to send notifications? */
     if (!$friends_approved) {
         //-----------------------------------------
         // Notifications library
         //-----------------------------------------
         if ($sendNotification) {
             $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications');
             $notifyLibrary = new $classToLoad($this->registry);
             IPSText::getTextClass('email')->getTemplate("new_friend_request", $friend['language']);
             IPSText::getTextClass('email')->buildMessage(array('MEMBERS_DISPLAY_NAME' => $friend['members_display_name'], 'FRIEND_NAME' => $member['members_display_name'], 'LINK' => "{$this->settings['board_url']}/index.{$this->settings['php_ext']}?app=members&section=friends&module=profile&do=list&tab=pending"));
             IPSText::getTextClass('email')->subject = sprintf(IPSText::getTextClass('email')->subject, $this->registry->output->buildSEOUrl('showuser=' . $member['member_id'], 'public', $member['members_seo_name'], 'showuser'), $member['members_display_name'], "{$this->settings['board_url']}/index.{$this->settings['php_ext']}?app=members&section=friends&module=profile&do=list&tab=pending");
             $notifyLibrary->setMember($friend);
             $notifyLibrary->setFrom($member);
             $notifyLibrary->setNotificationKey('friend_request');
             $notifyLibrary->setNotificationUrl("{$this->settings['board_url']}/index.{$this->settings['php_ext']}?app=members&section=friends&module=profile&do=list&tab=pending");
             $notifyLibrary->setNotificationText(IPSText::getTextClass('email')->message);
             $notifyLibrary->setNotificationTitle(IPSText::getTextClass('email')->subject);
             try {
                 $notifyLibrary->sendNotification();
             } catch (Exception $e) {
             }
         }
         $return_msg = 'pp_friend_added_mod';
     } else {
         /* Don't notify yourself */
         if ($sendNotification and $friend['member_id'] != $this->memberData['member_id']) {
             //-----------------------------------------
             // Notifications library
             //-----------------------------------------
             $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications');
             $notifyLibrary = new $classToLoad($this->registry);
             IPSText::getTextClass('email')->getTemplate("new_friend_added", $friend['language']);
             IPSText::getTextClass('email')->buildMessage(array('MEMBERS_DISPLAY_NAME' => $friend['members_display_name'], 'FRIEND_NAME' => $member['members_display_name'], 'LINK' => "{$this->settings['board_url']}/index.{$this->settings['php_ext']}?app=members&section=friends&module=profile&do=list"));
             IPSText::getTextClass('email')->subject = sprintf(IPSText::getTextClass('email')->subject, $this->registry->output->buildSEOUrl('showuser=' . $member['member_id'], 'public', $member['members_seo_name'], 'showuser'), $member['members_display_name']);
             $notifyLibrary->setMember($friend);
             $notifyLibrary->setFrom($member);
             $notifyLibrary->setNotificationKey('friend_request');
             $notifyLibrary->setNotificationUrl($this->registry->output->buildSEOUrl('showuser=' . $member['member_id'], 'public', $member['members_seo_name'], 'showuser'));
             $notifyLibrary->setNotificationText(IPSText::getTextClass('email')->message);
             $notifyLibrary->setNotificationTitle(IPSText::getTextClass('email')->subject);
             try {
                 $notifyLibrary->sendNotification();
             } catch (Exception $e) {
//.........这里部分代码省略.........
开发者ID:ConnorChristie,项目名称:GrabViews-Live,代码行数:101,代码来源:friends.php

示例8: postVisibility

 /**
  * Toggles visibility
  * 
  * @param	string	on/off
  * @param	array	Array of comment IDs to be deleted
  * @param	int		Parent ID
  * @return 	void
  */
 public function postVisibility($toggle, $commentIds, $parentId)
 {
     $this->_rebuildCommentCount($parentId);
     $_dataHook = array('toggle' => $toggle, 'commentIds' => $commentIds, 'parentId' => $parentId);
     /* Data Hook Location */
     IPSLib::doDataHooks($_dataHook, 'calendarCommentToggleVisibility');
 }
开发者ID:mover5,项目名称:imobackup,代码行数:15,代码来源:events.php

示例9: calendarEventSave


//.........这里部分代码省略.........
                 }
             }
             $read_perms = implode(",", $this->request['e_groups']);
         }
     }
     $read_perms = $read_perms ? $read_perms : '*';
     //-----------------------------------------
     // Get editor and format post
     //-----------------------------------------
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite');
     $editor = new $classToLoad();
     $event_content = $editor->process($_POST['Post']);
     IPSText::getTextClass('bbcode')->parse_html = 0;
     IPSText::getTextClass('bbcode')->parse_smilies = intval($this->request['enableemo']);
     IPSText::getTextClass('bbcode')->parse_bbcode = 1;
     IPSText::getTextClass('bbcode')->parsing_section = 'calendar';
     $event_content = IPSText::getTextClass('bbcode')->preDbParse($event_content);
     //-----------------------------------------
     // Event approved?
     //-----------------------------------------
     if ($this->request['e_type'] == 'private') {
         $event_approved = 1;
     } else {
         $event_approved = $this->registry->permissions->check('nomod', $_calendar) ? 1 : ($_calendar['cal_moderate'] ? 0 : 1);
     }
     //-----------------------------------------
     // Store the event
     //-----------------------------------------
     if ($type == 'add') {
         //-----------------------------------------
         // Format array for storage
         //-----------------------------------------
         $_eventData = array('event_calendar_id' => $calendar_id, 'event_member_id' => $this->memberData['member_id'], 'event_content' => $event_content, 'event_title' => $event_title, 'event_title_seo' => IPSText::makeSeoTitle($event_title), 'event_smilies' => intval($this->request['enableemo']), 'event_comments' => 0, 'event_perms' => $read_perms, 'event_private' => $this->request['e_type'] == 'private' ? 1 : 0, 'event_approved' => $event_approved, 'event_saved' => time(), 'event_lastupdated' => time(), 'event_recurring' => $recurring, 'event_start_date' => $start_date, 'event_end_date' => $end_date, 'event_post_key' => $this->request['post_key'], 'event_rsvp' => $this->registry->permissions->check('askrsvp', $_calendar) ? intval($this->request['event_rsvp']) : 0, 'event_sequence' => 0, 'event_all_day' => intval($this->request['all_day']));
         //-----------------------------------------
         // Data hooks
         //-----------------------------------------
         IPSLib::doDataHooks($_eventData, 'calendarAddEvent');
         //-----------------------------------------
         // Insert
         //-----------------------------------------
         $this->DB->insert('cal_events', $_eventData);
         $event_id = $this->DB->getInsertId();
         //-----------------------------------------
         // Set language strings
         //-----------------------------------------
         $_langString = $event_approved ? $this->lang->words['new_event_redirect'] : $this->lang->words['new_event_mod'];
     } else {
         //-----------------------------------------
         // Format array for storage
         //-----------------------------------------
         $_eventData = array('event_calendar_id' => $calendar_id, 'event_content' => $event_content, 'event_title' => $event_title, 'event_title_seo' => IPSText::makeSeoTitle($event_title), 'event_smilies' => intval($this->request['enableemo']), 'event_perms' => $read_perms, 'event_private' => $this->request['e_type'] == 'private' ? 1 : 0, 'event_approved' => $event_approved, 'event_lastupdated' => time(), 'event_recurring' => $recurring, 'event_start_date' => $start_date, 'event_end_date' => $end_date, 'event_post_key' => $this->request['post_key'], 'event_rsvp' => $this->registry->permissions->check('askrsvp', $_calendar) ? intval($this->request['event_rsvp']) : $event['event_rsvp'], 'event_sequence' => intval($event['event_rsvp']) + 1, 'event_all_day' => intval($this->request['all_day']));
         //-----------------------------------------
         // Data hooks
         //-----------------------------------------
         IPSLib::doDataHooks($_eventData, 'calendarEditEvent');
         //-----------------------------------------
         // Update database
         //-----------------------------------------
         $this->DB->update('cal_events', $_eventData, 'event_id=' . $event_id);
         //-----------------------------------------
         // Set language strings
         //-----------------------------------------
         $_langString = $event_approved ? $this->lang->words['edit_event_redirect'] : $this->lang->words['new_event_mod'];
     }
     //-----------------------------------------
     // Upload attachments
     //-----------------------------------------
     if ($this->memberData['g_attach_max'] != -1) {
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('core') . '/sources/classes/attach/class_attach.php', 'class_attach');
         $class_attach = new $classToLoad($this->registry);
         $class_attach->type = 'event';
         $class_attach->attach_post_key = $_eventData['event_post_key'];
         $class_attach->attach_rel_id = $event_id;
         $class_attach->init();
         $class_attach->processMultipleUploads();
         $class_attach->postProcessUpload(array());
     }
     //-----------------------------------------
     // Send notifications
     //-----------------------------------------
     if ($event_approved) {
         require_once IPS_ROOT_PATH . 'sources/classes/like/composite.php';
         /*noLibHook*/
         $_like = classes_like::bootstrap('calendar', $type == 'edit' ? 'events' : 'calendars');
         $_url = $this->registry->output->buildSEOUrl('app=calendar&module=calendar&section=view&do=showevent&event_id=' . $event_id, 'public', $_eventData['event_title_seo'], 'cal_event');
         $_like->sendNotifications($type == 'edit' ? $event_id : $_eventData['event_calendar_id'], array('immediate', 'offline'), array('notification_key' => $type == 'edit' ? 'updated_event' : 'new_event', 'notification_url' => $_url, 'email_template' => $type . '_event_follow', 'email_subject' => sprintf($this->lang->words[$type . '_event_follow_subject'], $_url, $_eventData['event_title']), 'build_message_array' => array('NAME' => '-member:members_display_name-', 'AUTHOR' => $this->memberData['members_display_name'], 'TITLE' => $_eventData['event_title'], 'URL' => $_url)));
     }
     //-----------------------------------------
     // Rebuild cache
     //-----------------------------------------
     $this->cache->rebuildCache('calendar_events', 'calendar');
     //-----------------------------------------
     // Redirect
     //-----------------------------------------
     if ($event_approved) {
         $this->registry->output->redirectScreen($_langString, $this->settings['base_url'] . "app=calendar&module=calendar&section=view&do=showevent&event_id=" . $event_id, $_eventData['event_title_seo'], 'cal_event');
     } else {
         $this->registry->output->redirectScreen($_langString, $this->settings['base_url'] . "app=calendar&module=calendar&section=view&cal_id=" . $calendar_id, $this->caches['calendars'][$calendar_id]['cal_title_seo'], 'cal_calendar');
     }
 }
开发者ID:mover5,项目名称:imobackup,代码行数:101,代码来源:post.php


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