Ejemplo n.º 1
0
 function onStartShowSections(Action $action)
 {
     $name = $action->trimmed('action');
     if ($name == 'tag') {
         $taginput = $action->trimmed('tag');
         $tag = common_canonical_tag($taginput);
         if (!empty($tag)) {
             $url = sprintf('http://hashtags.wikia.com/index.php?title=%s&action=render', urlencode($tag));
             $editurl = sprintf('http://hashtags.wikia.com/index.php?title=%s&action=edit', urlencode($tag));
             $request = HTTPClient::start();
             $response = $request->get($url);
             $html = $response->getBody();
             $action->elementStart('div', array('id' => 'wikihashtags', 'class' => 'section'));
             if ($response->isOk() && !empty($html)) {
                 $action->element('style', null, "span.editsection { display: none }\n" . "table.toc { display: none }");
                 $action->raw($html);
                 $action->elementStart('p');
                 $action->element('a', array('href' => $editurl, 'title' => sprintf(_m('Edit the article for #%s on WikiHashtags'), $tag)), _m('Edit'));
                 $action->element('a', array('href' => 'http://www.gnu.org/copyleft/fdl.html', 'title' => _m('Shared under the terms of the GNU Free Documentation License'), 'rel' => 'license'), _m('GNU FDL'));
                 $action->elementEnd('p');
             } else {
                 $action->element('a', array('href' => $editurl), sprintf(_m('Start the article for #%s on WikiHashtags'), $tag));
             }
             $action->elementEnd('div');
         }
     }
     return true;
 }
Ejemplo n.º 2
0
    /**
     * Add the conrnify button
     *
     * @param Action $action the current action
     *
     * @return void
     */
    function onEndShowSections(Action $action)
    {
        $action->elementStart('div', array('id' => 'cornify_section', 'class' => 'section'));
        $action->raw(<<<EOT
                <a href="http://www.cornify.com" onclick="cornify_add();return false;">
                <img src="http://www.cornify.com/assets/cornify.gif" width="61" height="16" border="0" alt="Cornify" />
                </a>
        <script type="text/javascript">(function() {
        var js = document.createElement('script');
        js.type = 'text/javascript';
        js.async = true;
        js.src = 'http://www.cornify.com/js/cornify.js';
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(js);
})();</script>
EOT
);
        $action->elementEnd('div');
    }
Ejemplo n.º 3
0
 public function onEndEmailFormData(Action $action, Profile $scoped)
 {
     $emailfave = $scoped->getConfigPref('email', 'notify_fave') ? 1 : 0;
     $action->elementStart('li');
     $action->checkbox('email-notify_fave', _('Send me email when someone adds my notice as a favorite.'), $emailfave);
     $action->elementEnd('li');
     return true;
 }
Ejemplo n.º 4
0
 function onEndShowSections(Action $action)
 {
     $actionName = $action->trimmed('action');
     // These are the ones that have maps on 'em
     if (!in_array($actionName, array('showstream', 'all'))) {
         return true;
     }
     $action->elementStart('div', array('id' => 'entity_map', 'class' => 'section'));
     // TRANS: Header for Map widget that displays a map with geodata for notices.
     $action->element('h2', null, _m('Map'));
     $action->element('div', array('id' => 'map_canvas', 'class' => 'gray smallmap', 'style' => "width: 100%; height: 240px"));
     $mapAct = $actionName == 'showstream' ? 'usermap' : 'allmap';
     $mapUrl = common_local_url($mapAct, array('nickname' => $action->trimmed('nickname')));
     $action->element('a', array('href' => $mapUrl), _m('Full size'));
     $action->elementEnd('div');
 }
Ejemplo n.º 5
0
 /**
  * Show a checkbox on the profile form to ask whether to follow everyone
  *
  * @param Action $action The action being executed
  *
  * @return boolean hook value
  */
 function onEndProfileFormData($action)
 {
     $user = common_current_user();
     $action->elementStart('li');
     // TRANS: Checkbox label in form for profile settings.
     $action->checkbox('followeveryone', _('Follow everyone'), $action->arg('followeveryone') ? $action->arg('followeveryone') : User_followeveryone_prefs::followEveryone($user->id));
     $action->elementEnd('li');
     return true;
 }
Ejemplo n.º 6
0
 /**
  * Actually output a flag button. If the target profile has already been
  * flagged by the current user, a null-action faux button is shown.
  *
  * @param Action $action
  * @param Profile $profile
  * @param array $returnToArgs
  */
 protected function showFlagButton($action, $profile, $returnToArgs)
 {
     $user = common_current_user();
     if (!empty($user) && $user->id != $profile->id) {
         $action->elementStart('li', 'entity_flag');
         if (User_flag_profile::exists($profile->id, $user->id)) {
             // @todo FIXME: Add a title explaining what 'flagged' means?
             // TRANS: Message added to a profile if it has been flagged for review.
             $action->element('p', 'flagged', _m('Flagged'));
         } else {
             $form = new FlagProfileForm($action, $profile, $returnToArgs);
             $form->show();
         }
         $action->elementEnd('li');
     }
 }
 /**
  * Show some extra instructions for using Yubikey
  *
  * @param Action $action Action being executed
  *
  * @return boolean hook value
  */
 function onEndLoginFormData($action)
 {
     $action->elementStart('li');
     $action->password('otp', _('Yubikey OTP'));
     $action->elementEnd('li');
 }
Ejemplo n.º 8
0
 function onEndShowSections(Action $action)
 {
     if ($action->arg('action') != 'showstream') {
         return true;
     }
     $cur = common_current_user();
     if (empty($cur) || !$cur->hasRight(self::VIEWMODLOG)) {
         return true;
     }
     $profile = $action->profile;
     $ml = new ModLog();
     $ml->profile_id = $profile->id;
     $ml->orderBy("created");
     $cnt = $ml->find();
     if ($cnt > 0) {
         $action->elementStart('div', array('id' => 'entity_mod_log', 'class' => 'section'));
         $action->element('h2', null, _('Moderation'));
         $action->elementStart('table');
         while ($ml->fetch()) {
             $action->elementStart('tr');
             $action->element('td', null, strftime('%y-%m-%d', strtotime($ml->created)));
             $action->element('td', null, sprintf($ml->is_grant ? _('+%s') : _('-%s'), $ml->role));
             $action->elementStart('td');
             if ($ml->moderator_id) {
                 $mod = Profile::getKV('id', $ml->moderator_id);
                 if (empty($mod)) {
                     $action->text(_('[unknown]'));
                 } else {
                     $action->element('a', array('href' => $mod->profileurl, 'title' => $mod->fullname), $mod->nickname);
                 }
             } else {
                 $action->text(_('[unknown]'));
             }
             $action->elementEnd('td');
             $action->elementEnd('tr');
         }
         $action->elementEnd('table');
         $action->elementEnd('div');
     }
 }
Ejemplo n.º 9
0
 /**
  * Add a checkbox to turn off email summaries
  * 
  * @param Action $action Action being executed (emailsettings)
  * 
  * @return boolean hook value
  */
 function onEndEmailFormData($action)
 {
     $user = common_current_user();
     $action->elementStart('li');
     $action->checkbox('emailsummary', _('Send me a periodic summary of updates from my network.'), Email_summary_status::getSendSummary($user->id));
     $action->elementEnd('li');
     return true;
 }
Ejemplo n.º 10
0
 /**
  * Show a link to our delicious import page on profile settings form
  *
  * @param Action $action Profile settings action being shown
  *
  * @return boolean hook value
  */
 function onEndProfileSettingsActions($action)
 {
     $user = common_current_user();
     if (!empty($user) && $user->hasRight(self::IMPORTDELICIOUS)) {
         $action->elementStart('li');
         $action->element('a', array('href' => common_local_url('importdelicious')), _m('Import del.icio.us bookmarks'));
         $action->elementEnd('li');
     }
     return true;
 }
Ejemplo n.º 11
0
 /**
  * Add in a Facebook Connect avatar to the primary nav menu
  *
  * @param Action $action the current action
  *
  * @return void
  *
  */
 function onStartPrimaryNav($action)
 {
     if (self::hasKeys()) {
         $user = common_current_user();
         if (!empty($user)) {
             $fbuid = $this->loggedIn();
             if (!empty($fbuid)) {
                 /* Default FB silhouette pic for FB users who haven't
                    uploaded a profile pic yet. */
                 $silhouetteUrl = 'http://static.ak.fbcdn.net/pics/q_silhouette.gif';
                 $url = $this->getProfilePicURL($fbuid);
                 $action->elementStart('li', array('id' => 'nav_fb'));
                 $action->element('img', array('id' => 'fbc_profile-pic', 'src' => !empty($url) ? $url : $silhouetteUrl, 'alt' => 'Facebook Connect User', 'width' => '16'), '');
                 $iconurl = common_path('plugins/Facebook/fbfavicon.ico');
                 $action->element('img', array('id' => 'fb_favicon', 'src' => $iconurl));
                 $action->elementEnd('li');
             }
         }
     }
     return true;
 }
 /**
  * To add a "Message" button to the group profile page
  *
  * @param Action     $action The showgroup action being shown
  * @param User_group $group  The current group
  * 
  * @return boolean hook value
  */
 function onEndGroupActionsList($action, $group)
 {
     $cur = common_current_user();
     if (empty($cur)) {
         return true;
     }
     try {
         Group_privacy_settings::ensurePost($cur, $group);
     } catch (Exception $e) {
         return true;
     }
     $action->elementStart('li', 'entity_send-a-message');
     $action->element('a', array('href' => common_local_url('newgroupmessage', array('nickname' => $group->nickname)), 'title' => _('Send a direct message to this group')), _('Message'));
     // $form = new GroupMessageForm($action, $group);
     // $form->hidden = true;
     // $form->show();
     $action->elementEnd('li');
     return true;
 }
Ejemplo n.º 13
0
 function onEndShowSections(Action $action)
 {
     if (!$action instanceof ShowstreamAction) {
         // early return for actions we're not interested in
         return true;
     }
     $scoped = $action->getScoped();
     if (!$scoped instanceof Profile || !$scoped->hasRight(self::VIEWMODLOG)) {
         // only continue if we are allowed to VIEWMODLOG
         return true;
     }
     $profile = $action->getTarget();
     $ml = new ModLog();
     $ml->profile_id = $profile->getID();
     $ml->orderBy("created");
     $cnt = $ml->find();
     if ($cnt > 0) {
         $action->elementStart('div', array('id' => 'entity_mod_log', 'class' => 'section'));
         $action->element('h2', null, _('Moderation'));
         $action->elementStart('table');
         while ($ml->fetch()) {
             $action->elementStart('tr');
             $action->element('td', null, strftime('%y-%m-%d', strtotime($ml->created)));
             $action->element('td', null, sprintf($ml->is_grant ? _('+%s') : _('-%s'), $ml->role));
             $action->elementStart('td');
             if ($ml->moderator_id) {
                 $mod = Profile::getByID($ml->moderator_id);
                 if (empty($mod)) {
                     $action->text(_('[unknown]'));
                 } else {
                     $action->element('a', array('href' => $mod->getUrl(), 'title' => $mod->getFullname()), $mod->getNickname());
                 }
             } else {
                 $action->text(_('[unknown]'));
             }
             $action->elementEnd('td');
             $action->elementEnd('tr');
         }
         $action->elementEnd('table');
         $action->elementEnd('div');
     }
 }
Ejemplo n.º 14
0
 /**
  * Add a checkbox to turn off email summaries
  *
  * @param Action $action Action being executed (emailsettings)
  * @param Profile $scoped Profile for whom settings are configured (current user)
  *
  * @return boolean hook value
  */
 public function onEndEmailFormData(Action $action, Profile $scoped)
 {
     $action->elementStart('li');
     $action->checkbox('emailsummary', _m('Send me a periodic summary of updates from my network'), Email_summary_status::getSendSummary($scoped->id));
     $action->elementEnd('li');
     return true;
 }
Ejemplo n.º 15
0
 public function onEndShowInsideFooter(Action $action)
 {
     if ($this->serveMobile) {
         // TRANS: Link to switch site layout from mobile to desktop mode. Appears at very bottom of page.
         $linkText = _m('Switch to desktop site layout.');
         $key = 'mobile-toggle-disable';
     } else {
         // TRANS: Link to switch site layout from desktop to mobile mode. Appears at very bottom of page.
         $linkText = _m('Switch to mobile site layout.');
         $key = 'mobile-toggle-enable';
     }
     $action->elementStart('p');
     $action->element('a', array('href' => '#', 'id' => $key), $linkText);
     $action->elementEnd('p');
     return true;
 }