function handle($notice) { $mirror = new SubMirror(); $mirror->subscribed = $notice->profile_id; if ($mirror->find()) { while ($mirror->fetch()) { $mirror->mirrorNotice($notice); } } return true; }
/** * Show the form for OpenID management * * We have one form with a few different submit buttons to do different things. * * @return void */ function showContent() { $user = common_current_user(); $this->showAddFeedForm(); $mirror = new SubMirror(); $mirror->subscriber = $user->id; if ($mirror->find()) { while ($mirror->fetch()) { $this->showFeedForm($mirror); } } }
function handle($notice) { $mirror = new SubMirror(); $mirror->subscribed = $notice->profile_id; if ($mirror->find()) { while ($mirror->fetch()) { try { $mirror->mirrorNotice($notice); } catch (Exception $e) { common_log(LOG_ERR, "Exception trying to mirror notice {$notice->id} " . "for subscriber {$mirror->subscriber} ({$mirror->style}): " . $e->getMessage()); } } } return true; }
function __construct($action, $profile) { parent::__construct($action); $this->profile = clone $profile; $this->user = common_current_user(); $this->mirror = SubMirror::pkeyGet(array('subscriber' => $this->user->id, 'subscribed' => $this->profile->id)); }
function saveMirror() { if ($this->oprofile->subscribe()) { SubMirror::saveMirror($this->user, $this->profile); } else { $this->serverError(_m("Could not subscribe to feed.")); } }
function saveMirror() { if ($this->oprofile->subscribe()) { SubMirror::saveMirror($this->user, $this->profile); } else { // TRANS: Exception thrown when a subscribing to a feed fails. $this->serverError(_m('Could not subscribe to feed.')); } }
/** * Show the form for OpenID management * * We have one form with a few different submit buttons to do different things. * * @return void */ function showContent() { $provider = $this->trimmed('provider'); if (!empty($provider) || GNUsocial::isAjax()) { $this->showAddFeedForm($provider); } else { $this->elementStart('div', array('id' => 'add-mirror')); $this->showAddWizard(); $this->elementEnd('div'); $mirror = new SubMirror(); $mirror->subscriber = $this->scoped->getID(); if ($mirror->find()) { while ($mirror->fetch()) { $this->showFeedForm($mirror); } } } }
/** * Show the form for OpenID management * * We have one form with a few different submit buttons to do different things. * * @return void */ function showContent() { $user = common_current_user(); $provider = $this->trimmed('provider'); if ($provider) { $this->showAddFeedForm($provider); } else { $this->elementStart('div', array('id' => 'add-mirror')); $this->showAddWizard(); $this->elementEnd('div'); $mirror = new SubMirror(); $mirror->subscriber = $user->id; if ($mirror->find()) { while ($mirror->fetch()) { $this->showFeedForm($mirror); } } } }
function saveMirror() { $mirror = SubMirror::getMirror($this->user, $this->profile); if (!$mirror) { $this->clientError(_m('Requested edit of missing mirror')); } if ($this->delete) { $mirror->delete(); $oprofile = Ostatus_profile::staticGet('profile_id', $this->profile->id); if ($oprofile) { $oprofile->garbageCollect(); } } else { if ($this->style != $mirror->style) { $orig = clone $mirror; $mirror->style = $this->style; $mirror->modified = common_sql_now(); $mirror->update($orig); } } }
function saveMirror() { $mirror = SubMirror::getMirror($this->user, $this->profile); if (!$mirror) { // TRANS: Client error thrown when a mirror request is made and no result is retrieved. $this->clientError(_m('Requested edit of missing mirror.')); } if ($this->delete) { $mirror->delete(); $oprofile = Ostatus_profile::staticGet('profile_id', $this->profile->id); if ($oprofile) { $oprofile->garbageCollect(); } } else { if ($this->style != $mirror->style) { $orig = clone $mirror; $mirror->style = $this->style; $mirror->modified = common_sql_now(); $mirror->update($orig); } } }
/** * Add a count of mirrored feeds into a user's profile sidebar stats. * * @param Profile $profile * @param array $stats * @return boolean hook return value */ function onProfileStats($profile, &$stats) { $cur = common_current_user(); if (!empty($cur) && $cur->id == $profile->id) { $mirror = new SubMirror(); $mirror->subscriber = $profile->id; $entry = array('id' => 'mirrors', 'label' => _m('Mirrored feeds'), 'link' => common_local_url('mirrorsettings'), 'value' => $mirror->count()); $insertAt = count($stats); foreach ($stats as $i => $row) { if ($row['id'] == 'groups') { // Slip us in after them. $insertAt = $i + 1; break; } } array_splice($stats, $insertAt, 0, array($entry)); } return true; }
/** * @param Profile $subscribed * @param Profile $subscribed * @return SubMirror * @throws ServerException */ public static function saveMirror($subscriber, $subscribed, $style = 'repeat') { // @fixme make sure they're subscribed! $mirror = new SubMirror(); $mirror->subscriber = $subscriber->id; $mirror->subscribed = $subscribed->id; $mirror->style = $style; $mirror->created = common_sql_now(); $mirror->modified = common_sql_now(); $mirror->insert(); return $mirror; }
/** * Let the OStatus subscription garbage collection know if we're * making use of a remote feed, so it doesn't get dropped out * from under us. * * @param Ostatus_profile $oprofile * @param int $count in/out * @return mixed hook return value */ function onOstatus_profileSubscriberCount($oprofile, &$count) { if ($oprofile->profile_id) { $mirror = new SubMirror(); $mirror->subscribed = $oprofile->profile_id; if ($mirror->find()) { while ($mirror->fetch()) { $count++; } } } return true; }
protected function saveMirror() { $this->oprofile->subscribe(); SubMirror::saveMirror($this->user, $this->profile); }