示例#1
0
function _loginNotice($user)
{
    if ($GLOBALS['prefs']->getValue('login_notify') != 1 || !$GLOBALS['registry']->hasInterface('letter')) {
        return;
    }
    require_once FOLKS_BASE . '/lib/Friends.php';
    $friends_driver = Folks_Friends::singleton();
    $friends = $friends_driver->getFriends();
    if ($friends instanceof PEAR_Error) {
        return $friends;
    } elseif (empty($friends)) {
        return true;
    }
    $users = $GLOBALS['folks_driver']->getOnlineUsers();
    if ($users instanceof PEAR_Error) {
        return $users;
    } elseif (empty($users)) {
        return true;
    }
    $notify = array();
    foreach ($friends as $friend) {
        if (array_key_exists($friend, $users)) {
            $notify[] = $friend;
        }
    }
    if (empty($notify)) {
        return true;
    }
    $body = _("User %s just logged in.\n%s");
    $params = array($notify, array('title' => _("Login reminder"), 'content' => sprintf($body, $user, Folks::getUrlFor('user', $user, true))));
    $GLOBALS['registry']->callByPackage('letter', 'sendMessage', $params);
}
示例#2
0
 /**
  */
 protected function _content()
 {
     if (!$GLOBALS['registry']->isAuthenticated()) {
         return '';
     }
     $GLOBALS['cache'] = $GLOBALS['injector']->getInstance('Horde_Cache');
     $cache_key = 'folks_myscommetns_' . $this->_params['limit'];
     $threads = $GLOBALS['cache']->get($cache_key, $GLOBALS['conf']['cache']['default_lifetime']);
     if ($threads) {
         return $threads;
     }
     $GLOBALS['page_output']->addScriptFile('tables.js', 'horde');
     $html = '<table class="sortable striped" id="my_comment_list" style="width: 100%">' . '<thead><tr><th>' . _("Title") . '</th>' . '<th>' . _("User") . '</th></tr></thead>';
     try {
         $threads = $GLOBALS['registry']->call('forums/getThreadsByForumOwner', array($GLOBALS['registry']->getAuth(), 'message_timestamp', 1, false, 'folks', 0, $this->_params['limit']));
     } catch (Horde_Exception $e) {
         return $e->getMessage();
     }
     $url = Folks::getUrlFor('user', $GLOBALS['registry']->getAuth());
     foreach ($threads as $message) {
         $html .= '<tr><td>' . '<a href="' . $url . '" title="' . $message['message_date'] . '">' . $message['message_subject'] . '</a> ' . '</td><td>' . $message['message_author'] . '</td></tr>';
     }
     $html .= '</table>';
     $GLOBALS['cache']->set($cache_key, $html);
     return $html;
 }
示例#3
0
 /**
  */
 protected function _init()
 {
     $links = array(Folks::getUrlFor('feed', 'online', true, -1) => _("Online users"));
     if ($GLOBALS['registry']->isAuthenticated()) {
         $links[Folks::getUrlFor('feed', 'friends', true, -1)] = _("Online friends");
         $links[Folks::getUrlFor('feed', 'activity', true, -1)] = _("Friends activity");
         $links[Folks::getUrlFor('feed', 'know', true, -1)] = _("People you might know");
     }
     foreach ($links as $url => $label) {
         $GLOBALS['page_output']->addLinkTag(array('href' => $url, 'title' => $label));
     }
 }
示例#4
0
文件: edit.php 项目: raz0rsdge/horde
    Folks::getUrlFor('list', 'list')->redirect();
}
$form = new Horde_Form($vars, $title, 'editprofile');
$form->addVariable(_("Email"), 'user_email', 'email', true);
$form->addVariable(_("Birthday"), 'user_birthday', 'monthdayyear', false, false, null, array(date('Y') - 90, date('Y') - 10, '%Y%m%d', '%Y%m%d'));
$form->addVariable(_("Gender"), 'user_gender', 'enum', false, false, null, array(array(1 => _("Male"), 2 => _("Female")), _("--- Select ---")));
$form->addVariable(_("City"), 'user_city', 'text', false);
$v = $form->addVariable(_("Country"), 'user_country', 'enum', false, false, null, array(Folks::getCountries()));
$v->setDefault('SI');
$form->addVariable(_("Homepage"), 'user_url', 'text', false);
if ($registry->hasMethod('video/listVideos')) {
    try {
        $result = $registry->call('video/listVideos', array(array('author' => $GLOBALS['registry']->getAuth()), 0, 100));
        $videos = array();
        foreach ($result as $video_id => $video) {
            $videos[$video_id] = $video['video_title'] . ' - ' . Folks::format_date($video['video_created']);
        }
        $video_link = '<a href="' . $registry->link('video/edit') . '">' . _("Upload a new video") . '</a>';
        $form->addVariable(_("Video"), 'user_video', 'enum', false, false, $video_link, array($videos, _("--- Select ---")));
    } catch (Horde_Exception $e) {
        $notification->push($e);
    }
}
$form->addVariable(_("Description"), 'user_description', 'longtext', false, false, false);
$form->addVariable(_("Picture"), 'user_picture', 'image', false);
$form->setButtons(array(_("Save"), _("Delete picture")));
if ($form->validate()) {
    switch (Horde_Util::getFormData('submitbutton')) {
        case _("Save"):
            $form->getInfo(null, $info);
            $info['user_description'] = strip_tags($info['user_description']);
示例#5
0
foreach ($list as $user) {
    ?>
<tr valign="top">
<td>
<a href="<?php 
    echo Folks::getUrlFor('user', $user);
    ?>
" alt="<?php 
    echo $user;
    ?>
" title="<?php 
    echo $user;
    ?>
">
<img src="<?php 
    echo Folks::getImageUrl($user);
    ?>
" class="userMiniIcon" style="float: left" />
<strong><?php 
    echo $user;
    ?>
</strong></a><br />
<span class="small">
<?php 
    foreach ($actions as $action) {
        ?>
<a href="<?php 
        echo $action['url']->add($action['id'], $user);
        ?>
"><?php 
        echo $action['name'];
示例#6
0
 /**
  * Send user a nofication or approve request
  *
  * @param string $user   Usersame
  * @param string $title   Title of notification
  * @param string $body   Content of notification
  *
  * @return boolean
  */
 public function sendNotification($user, $title, $body)
 {
     $to = Folks::getUserEmail($user);
     if ($to instanceof PEAR_Error) {
         return $to;
     }
     $result = Folks::sendMail($to, $title, $body);
     if ($result instanceof PEAR_Error) {
         return $result;
     }
     if (!$GLOBALS['registry']->hasInterface('letter')) {
         return true;
     }
     return $GLOBALS['registry']->callByPackage('letter', 'sendMessage', array($user, array('title' => $title, 'content' => $body)));
 }
示例#7
0
if ($count instanceof PEAR_Error) {
    $notification->push($count);
    $count = 0;
}
if (($sort_by = Horde_Util::getFormData('sort_by')) !== null) {
    $prefs->setValue('sort_by', $sort_by);
} else {
    $sort_by = $prefs->getValue('sort_by');
}
if (($sort_dir = Horde_Util::getFormData('sort_dir')) !== null) {
    $prefs->setValue('sort_dir', $sort_dir);
} else {
    $sort_dir = $prefs->getValue('sort_dir');
}
$page = Horde_Util::getGet('page', 0);
$perpage = $prefs->getValue('per_page');
$criteria = array('birthday' => date('-m-d'), 'sort_by' => $sort_by, 'sort_dir' => $sort_dir);
$users = $folks_driver->getUsers($criteria, $page * $perpage, $perpage);
if ($users instanceof PEAR_Error) {
    $notification->push($users);
    $users = array();
}
$vars = Horde_Variables::getDefaultVariables();
$pager = new Horde_Core_Ui_Pager('page', $vars, array('num' => $count, 'url' => 'birthday.php', 'perpage' => $perpage));
$pager->preserve($criteria);
$list_url = Folks::getUrlFor('list', 'birthday');
$page_output->addScriptFile('stripe.js', 'horde');
$page_output->header(array('title' => $title));
$notification->notify(array('listeners' => 'status'));
require FOLKS_TEMPLATES . '/list/list.php';
$page_output->footer();
示例#8
0
?>
"><?php 
echo _("Online users");
?>
</a></td></tr>
<tr><td><a href="<?php 
echo Folks::getUrlFor('feed', 'friends');
?>
"><?php 
echo _("Online friends");
?>
</a></td></tr>
<tr><td><a href="<?php 
echo Folks::getUrlFor('feed', 'activity');
?>
"><?php 
echo _("Friends activity");
?>
</a></td></tr>
<tr><td><a href="<?php 
echo Folks::getUrlFor('feed', 'know');
?>
"><?php 
echo _("People you might know");
?>
</a></td></tr>
</table>

</td>
<td>
示例#9
0
$friends = Folks_Friends::singleton();
// Get friends
$friend_list = $friends->getFriends();
if ($friend_list instanceof PEAR_Error) {
    $notification->push($friend_list);
    $friend_list = array();
}
// Get friends activities
$firendActivities = array();
foreach ($friend_list as $user) {
    $activities = $folks_driver->getActivity($user);
    if ($activities instanceof PEAR_Error) {
        continue;
    }
    foreach ($activities as $activity) {
        $firendActivities[$activity['activity_date']] = $activity;
    }
}
krsort($firendActivities);
$firendActivities = array_slice($firendActivities, 0, 30);
// Own activities
$activities = $folks_driver->getActivity($GLOBALS['registry']->getAuth());
if ($activities instanceof PEAR_Error) {
    $notification->push($activities);
    Folks::getUrlFor('list', 'list')->redirect();
}
$page_output->addScriptFile('stripe.js', 'horde');
$page_output->header(array('title' => $title));
$notification->notify(array('listeners' => 'status'));
require FOLKS_TEMPLATES . '/friends/friends.php';
$page_output->footer();
示例#10
0
<table id="activities" class="striped"  style="width: 100%">
<tbody>
<?php 
foreach ($list as $activity_date => $activity) {
    echo '<tr>' . '<td><a href="' . Folks::getUrlFor('user', $activity['user_uid']) . '">' . '<img src="' . Folks::getImageUrl($activity['user_uid']) . '" class="userMiniIcon" style="float: left" /> ' . $activity['user_uid'] . '</a> - <span class="small">' . Folks::format_datetime($activity_date) . '</span>' . '<br />' . $activity['activity_message'] . '<br />' . '</td></tr>';
}
?>
</tbody>
</table>
示例#11
0
文件: user.php 项目: jubinpatel/horde
<a href="/uporabniki/friends/index.php" title="<?php 
    echo _("Preview");
    ?>
"><?php 
    echo Horde::img('nav/right.png');
    ?>
</a>
</span>
<?php 
    echo _("Activity");
    ?>
</td>
</tr>
<?php 
    foreach ($profile['activity_log'] as $item_id => $item) {
        echo '<tr><td colspan="2">' . Folks::format_datetime($item['activity_date']) . ' - ' . $item['activity_message'] . '</td></tr>';
    }
}
?>

</tbody>
</table>

</td>

</tr>

</tbody>
</table>

<?php 
示例#12
0
文件: Api.php 项目: jubinpatel/horde
 /**
  * Lists users with birthdays/goout dates as time objects.
  *
  * @param array $categories  The time categories (from listTimeObjectCategories) to list.
  * @param Horde_Date $start       The start date of the period.
  * @param Horde_Date $end         The end date of the period.
  */
 public function listTimeObjects($categories, $start, $end)
 {
     require_once __DIR__ . '/base.php';
     require_once FOLKS_BASE . '/lib/Friends.php';
     $friends_driver = Folks_Friends::singleton('sql');
     $friends = $friends_driver->getFriends();
     if ($friends instanceof PEAR_Error) {
         return array();
     }
     $objects = array();
     foreach ($friends as $friend) {
         $user = $GLOBALS['folks_driver']->getProfile($friend);
         if ($user instanceof PEAR_Error) {
             continue;
         }
         $user['user_birthday'] = date('Y') . substr($user['user_birthday'], 4);
         $born = strtotime($user['user_birthday']);
         if ($born === false || $born < $start->timestamp() || $born > $end->timestamp()) {
             continue;
         }
         $age = Folks::calcAge($user['user_birthday']);
         $desc = $age['age'] . ' (' . $age['sign'] . ')';
         $objects[$friend] = array('title' => $friend, 'description' => $desc, 'id' => $friend, 'start' => date('Y-m-d\\TH:i:s', $born), 'end' => date('Y-m-d\\TH:i:s', $born + 1), 'params' => array('user' => $friend), 'link' => Folks::getUrlFor('user', $friend, true));
     }
     return $objects;
 }
示例#13
0
?>
</generator>
<?php 
foreach ($firendActivities as $activity_date => $activity) {
    ?>
   <item>
    <title><?php 
    echo htmlspecialchars($activity['user']);
    ?>
</title>
    <description><?php 
    echo htmlspecialchars(strip_tags($activity['message']));
    ?>
</description>
    <link><?php 
    echo Folks::getUrlFor('user', $activity['user'], true);
    ?>
</link>
    <author><?php 
    echo $activity['user'];
    ?>
</author>
    <pubDate><?php 
    echo htmlspecialchars(date('r'), $activity_date);
    ?>
</pubDate>
  </item>
  <?php 
}
?>
 </channel>
示例#14
0
文件: add.php 项目: jubinpatel/horde
if ($user) {
    if ($friends->isFriend($user)) {
        $result = $friends->removeFriend($user);
        if ($result instanceof PEAR_Error) {
            $notification->push($result);
        } else {
            $notification->push(sprintf(_("User \"%s\" was removed from your friend list."), $user), 'horde.success');
            Horde::url('edit/friends/index.php')->redirect();
        }
    } else {
        $result = $friends->addFriend($user);
        if ($result instanceof PEAR_Error) {
            $notification->push($result);
        } elseif ($friends->needsApproval($user)) {
            $title = sprintf(_("%s added you as a friend on %s"), $GLOBALS['registry']->getAuth(), $GLOBALS['registry']->get('name', 'horde'));
            $body = sprintf(_("User %s added you to his firends list on %s. \nTo approve, go to: %s \nTo reject, go to: %s \nTo see to his profile, go to: %s \n"), $GLOBALS['registry']->getAuth(), $registry->get('name', 'horde'), Horde::url('edit/friends/approve.php', true, -1)->add('user', $GLOBALS['registry']->getAuth()), Horde::url('edit/friends/reject.php', true, -1)->add('user', $GLOBALS['registry']->getAuth()), Folks::getUrlFor('user', $GLOBALS['registry']->getAuth(), true, -1));
            $result = $friends->sendNotification($user, $title, $body);
            if ($result instanceof PEAR_Error) {
                $notification->push($result);
            } else {
                $notification->push(sprintf(_("A confirmation was send to \"%s\"."), $user), 'horde.warning');
            }
            Horde::url('edit/friends/index.php')->redirect();
        } else {
            $notification->push(sprintf(_("User \"%s\" was added as your friend."), $user), 'horde.success');
            Horde::url('edit/friends/index.php')->redirect();
        }
    }
}
$friend_form = new Folks_AddFriend_Form($vars, _("Add or remove user"), 'blacklist');
$page_output->addScriptFile('tables.js', 'horde');
示例#15
0
文件: report.php 项目: horde/horde
}
$title = _("Do you really want to report this user?");
$vars = Horde_Variables::getDefaultVariables();
$form = new Horde_Form($vars, $title);
$form->setButtons(array(_("Report"), _("Cancel")));
$enum = array('advertisement' => _("Advertisement content"), 'terms' => _("Terms and conditions infringement"), 'offensive' => _("Offensive content"), 'copyright' => _("Copyright infringement"));
$form->addVariable($user, 'name', 'description', false);
$form->addHidden('', 'user', 'text', true, true);
$form->addVariable(_("Report type"), 'type', 'radio', true, false, null, array($enum));
$form->addVariable(_("Report reason"), 'reason', 'longtext', true);
$user_id = Horde_Util::getFormData('id');
if ($form->validate()) {
    if (Horde_Util::getFormData('submitbutton') == _("Report")) {
        $body = _("User") . ': ' . $user . "\n" . _("Report type") . ': ' . $enum[$vars->get('type')] . "\n" . _("Report reason") . ': ' . $vars->get('reason') . "\n" . Folks::getUrlFor('user', $user);
        require FOLKS_BASE . '/lib/Notification.php';
        $rn = new Folks_Notification();
        $result = $rn->notifyAdmins($title, $body);
        if ($result instanceof PEAR_Error) {
            $notification->push(_("User was not reported.") . ' ' . $result->getMessage(), 'horde.error');
        } else {
            $notification->push(_("User was reported."), 'horde.success');
        }
    } else {
        $notification->push(_("User was not reported."), 'horde.warning');
    }
    Folks::getUrlFor('user', $user)->redirect();
}
$page_output->header(array('title' => $title));
$notification->notify(array('listeners' => 'status'));
$form->renderActive(null, null, null, 'post');
$page_output->footer();
示例#16
0
文件: feed.php 项目: jubinpatel/horde
?>
</generator>
<?php 
foreach ($users as $user) {
    ?>
   <item>
    <title><?php 
    echo htmlspecialchars($user);
    ?>
</title>
    <description><![CDATA[ <?php 
    echo '<img src="' . Folks::getImageUrl($user, 'small', true) . '" />';
    ?>
 ]]></description>
    <link><?php 
    echo Folks::getUrlFor('user', $user, true);
    ?>
</link>
    <author><?php 
    echo $user;
    ?>
</author>
  </item>
  <?php 
}
?>
 </channel>
</rss>


示例#17
0
if ($count instanceof PEAR_Error) {
    $notification->push($count);
    $count = 0;
}
if (($sort_by = Horde_Util::getFormData('sort_by')) !== null) {
    $prefs->setValue('sort_by', $sort_by);
} else {
    $sort_by = $prefs->getValue('sort_by');
}
if (($sort_dir = Horde_Util::getFormData('sort_dir')) !== null) {
    $prefs->setValue('sort_dir', $sort_dir);
} else {
    $sort_dir = $prefs->getValue('sort_dir');
}
$page = Horde_Util::getGet('page', 0);
$perpage = $prefs->getValue('per_page');
$criteria = array('online' => true, 'sort_by' => $sort_by, 'sort_dir' => $sort_dir);
$users = $folks_driver->getUsers($criteria, $page * $perpage, $perpage);
if ($users instanceof PEAR_Error) {
    $notification->push($users);
    $users = array();
}
$vars = Horde_Variables::getDefaultVariables();
$pager = new Horde_Core_Ui_Pager('page', $vars, array('num' => $count, 'url' => 'online.php', 'perpage' => $perpage));
$pager->preserve($criteria);
$list_url = Folks::getUrlFor('list', 'online');
$page_output->addScriptFile('stripe.js', 'horde');
$page_output->header(array('title' => $title));
$notification->notify(array('listeners' => 'status'));
require FOLKS_TEMPLATES . '/list/list.php';
$page_output->footer();
示例#18
0
<?php

/**
 * Copyright Obala d.o.o. (www.obala.si)
 *
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.horde.org/licenses/gpl.
 *
 * @author Duck <*****@*****.**>
 * @package Folks
 */
$folks_authentication = 'none';
require_once __DIR__ . '/../lib/base.php';
$users = $folks_driver->getOnlineUsers();
if ($users instanceof PEAR_Error) {
    $users = array();
} else {
    $users = array_flip($users);
}
$title = _("Online users");
$link = Folks::getUrlFor('list', 'online', true);
$rss_link = Horde::url('rss/online.php', true);
require FOLKS_TEMPLATES . '/feed/feed.php';
示例#19
0
 *
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.horde.org/licenses/gpl.
 *
 * @author Duck <*****@*****.**>
 * @package Folks
 */
require_once __DIR__ . '/lib/base.php';
$title = _("Activity");
$count = $folks_driver->countUsers();
if ($count instanceof PEAR_Error) {
    $notification->push($count);
    $count = 0;
}
$page = Horde_Util::getGet('page', 0);
$perpage = $prefs->getValue('per_page');
$criteria = array('sort_by' => 'activity', 'sort_dir' => 0);
$users = $folks_driver->getUsers($criteria, $page * $perpage, $perpage);
if ($users instanceof PEAR_Error) {
    $notification->push($users);
    $users = array();
}
$vars = Horde_Variables::getDefaultVariables();
$pager = new Horde_Core_Ui_Pager('page', $vars, array('num' => $count, 'url' => 'activity.php', 'perpage' => $perpage));
$pager->preserve($criteria);
$list_url = Folks::getUrlFor('list', 'activity');
$page_output->addScriptFile('stripe.js', 'horde');
$page_output->header(array('title' => $title));
$notification->notify(array('listeners' => 'status'));
require FOLKS_TEMPLATES . '/list/list.php';
$page_output->footer();
示例#20
0
文件: list.php 项目: jubinpatel/horde
        echo Folks::getImageUrl($user['user_uid']);
        ?>
" class="userMiniIcon" />
        <?php 
        echo $user['user_uid'];
        ?>
</a>
    </td>
    <td><?php 
        if ($user['user_gender']) {
            echo $user['user_gender'] == 1 ? _("Male") : _("Female");
        }
        ?>
</td>
    <td><?php 
        $age = Folks::calcAge($user['user_birthday']);
        if (!empty($age['age'])) {
            echo $age['age'] . ' (' . $age['sign'] . ')';
        }
        ?>
</td>
    <td><?php 
        echo $user['user_city'];
        ?>
</td>
    <td><?php 
        echo $user['user_url'] ? _("Yes") : _("No");
        ?>
</td>
    <td><?php 
        echo $user['user_description'] ? _("Yes") : _("No");
示例#21
0
 *
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.horde.org/licenses/gpl.
 *
 * @author Duck <*****@*****.**>
 * @package Folks
 */
require_once __DIR__ . '/../../lib/base.php';
require_once FOLKS_BASE . '/lib/Friends.php';
if (!$registry->isAuthenticated()) {
    throw new Horde_Exception_AuthenticationFailure();
}
$user = Horde_Util::getGet('user');
if (empty($user)) {
    $notification->push(_("You must supply a username."));
    Horde::url('edit/friends/index.php')->redirect();
}
$friends = Folks_Friends::singleton();
$result = $friends->approveFriend($user);
if ($result instanceof PEAR_Error) {
    $notification->push($result);
    $notification->push($result->getDebugInfo());
    Horde::url('edit/friends/index.php')->redirect();
}
$notification->push(sprintf(_("User \"%s\" was confirmed as a friend."), $user), 'horde.success');
$title = sprintf(_("%s approved you as a friend on %s"), $GLOBALS['registry']->getAuth(), $registry->get('name', 'horde'));
$body = sprintf(_("User %s confirmed you as a friend on %s.. \nTo see to his profile, go to: %s \n"), $GLOBALS['registry']->getAuth(), $registry->get('name', 'horde'), Folks::getUrlFor('user', $GLOBALS['registry']->getAuth(), true, -1));
$friends->sendNotification($user, $title, $body);
$link = '<a href="' . Folks::getUrlFor('user', $user) . '">' . $user . '</a>';
$folks_driver->logActivity(sprintf(_("Added user %s as a friend."), $link));
Horde::url('edit/friends/index.php')->redirect();
示例#22
0
echo _("Group");
?>
</th>
    <th><?php 
echo _("Owner");
?>
</th>
    <th colsan="3"><?php 
echo _("Action");
?>
</th>
</tr>
</thead>
<tbody>
<?php 
foreach ($groups as $group_id => $group_name) {
    echo '<tr><td>' . $group_name . '</td>';
    $owner = $friends->getGroupOwner($group_id);
    echo '<td style="text-align: center"><a href="' . Folks::getUrlFor('user', $owner) . '"><img src="' . Folks::getImageUrl($owner) . '" class="userMiniIcon" /><br />' . $owner . '</a></td>';
    echo '<td><a href="' . $members_url->add('g', $group_id) . '">' . $members_img . ' ' . _("Members") . '</a></td>';
    if ($friends->hasCapability('groups_add')) {
        echo '<td><a href="' . $edit_url->add('g', $group_id) . '">' . $edit_img . ' ' . _("Rename") . '</a></td>';
        echo '<td><a href="#" onclick="if (confirm(\'' . _("Do you really want to delete this group?") . '\')) {window.location=\'' . $remove_url->add('g', $group_id) . '\'}">' . $remove_img . ' ' . _("Delete") . '</a></td>';
        echo '<td><a href="#" onclick="' . Horde::popupJs($perms_url, array('params' => array('cid' => $group_id), 'urlencode' => true)) . '">' . $perms_img . ' ' . _("Permissions") . '</a></td>';
    }
    echo '</tr>';
}
?>
</tbody>
</table>
示例#23
0
    ?>
<tr>
    <td><a href="<?php 
    echo $registry->get('webroot', $activity['activity_scope']);
    ?>
" />
        <?php 
    echo Horde::img(Horde_Themes::img($activitiy['activity_scope'] . 'png', $activity['activity_scope']));
    ?>
        <?php 
    echo $registry->get('name', $activity['activity_scope']);
    ?>
</a>
    </td>
    <td><?php 
    echo Folks::format_datetime($activity['activity_date']);
    ?>
</td>
    <td><?php 
    echo $activity['activity_message'];
    unset($activity['activity_message']);
    ?>
</td>
    <td><a href="<?php 
    echo $delete_url->add($activity);
    ?>
" title="<?php 
    echo _("Delete");
    ?>
"/><?php 
    echo $delete_img;
示例#24
0
require_once FOLKS_BASE . '/lib/Friends.php';
$friends = Folks_Friends::singleton();
// Manage adding groups
$form = new Horde_Form($vars, $title, 'invite');
$form->addVariable(_("Friend's e-mail"), 'email', 'email', true);
$v =& $form->addVariable(_("Subject"), 'subject', 'text', true);
$v->setDefault(sprintf(_("%s Invited to join %s."), ucfirst($GLOBALS['registry']->getAuth()), $registry->get('name', 'horde')));
$v =& $form->addVariable(_("Body"), 'body', 'longtext', true);
try {
    $body = Horde::loadConfiguration('invite.php', 'body', 'folks');
    $body = sprintf($body, $registry->get('name', 'horde'), Folks::getUrlFor('user', $GLOBALS['registry']->getAuth(), true), Horde::url('account/signup.php', true), $GLOBALS['registry']->getAuth());
} catch (Horde_Exception $e) {
    $body = $body->getMessage();
}
$v->setDefault($body);
if ($form->validate()) {
    $form->getInfo(null, $info);
    $result = Folks::sendMail($info['email'], $info['subject'], $info['body']);
    if ($result instanceof PEAR_Error) {
        $notification->push($result);
    } else {
        $notification->push(sprintf(_("Friend \"%s\" was invited to join %s."), $info['email'], $registry->get('name', 'horde')), 'horde.success');
    }
}
$page_output->header(array('title' => $title));
require FOLKS_TEMPLATES . '/menu.inc';
echo $tabs->render('friends');
require FOLKS_TEMPLATES . '/edit/header.php';
require FOLKS_TEMPLATES . '/edit/invite.php';
require FOLKS_TEMPLATES . '/edit/footer.php';
$page_output->footer();
示例#25
0
 /**
  * Get confirmation code
  *
  * @param string $user   Username to get code for
  * @param string $type   Code type
  *
  * @return string  Confirmation code
  */
 public function getConfirmationCode($user, $type = 'activate')
 {
     $encrypted = $this->_getCryptedPassword($user);
     if ($encrypted instanceof PEAR_Error) {
         return $encrypted;
     }
     return Folks::encodeString($user, $type . $encrypted);
 }
示例#26
0
文件: mail.php 项目: horde/horde
// Get new messages older time
$query = 'SELECT user_uid, user_email FROM folks_users ORDER BY user_uid ASC';
if (isset($count)) {
    $db->modifyLimitQuery($query, $from, $count);
}
$res = $db->query($query);
if ($res instanceof PEAR_Error) {
    $cli->fatal($res);
}
$cli->message($res->numRows(), 'cli.success');
$subject = sprintf('News on %s', $registry->get('name', 'horde'));
$body = "Hello %s,\n\n There is someting new on %s\n\n. Visit us at %s";
// Prepare data for bash process or delete one by one
$paths = array();
while ($row =& $res->fetchRow()) {
    $body2 = sprintf($body, $row[0], $registry->get('name', 'horde'), Folks::getUrlFor('user', $row[0], true, -1));
    // Send mail
    $mail = new MIME_Mail($subject, $body2, $row[1], $conf['support'], 'UTF-8');
    $mail->addHeader('User-Agent', 'Folks' . $registry->getVersion());
    $sent = $mail->send($conf['mailer']['type'], $conf['mailer']['params']);
    if ($sent instanceof PEAR_Error) {
        $cli->message($sent, 'cli.warning');
    } else {
        $cli->message($row[0], 'cli.success');
    }
    // sleep(1);
}
$cli->message('done', 'cli.success');
/**
 * Show the command line arguments that the script accepts.
 */
示例#27
0
 * See the enclosed file COPYING for license information (LGPL). If you
 * did not receive this file, see http://www.horde.org/licenses/lgpl21.
 *
 * @author Duck <*****@*****.**>
 */
require_once __DIR__ . '/tabs.php';
$vars = Horde_Variables::getDefaultVariables();
$title = _("Forgot your username?");
$form = new Horde_Form($vars, $title);
$form->setButtons(_("Send me my username"));
$form->addVariable(_("Your email"), 'email', 'email', true);
/* Validate the form. */
if ($form->validate()) {
    $form->getInfo(null, $info);
    $users = $folks_driver->getUsers(array('email' => $info['email']));
    if ($users instanceof PEAR_Error) {
        $notification->push($users);
    } elseif (empty($users) || count($users) != 1) {
        $notification->push(_("Could not find any username with this email."), 'horde.warning');
    } else {
        $users = current($users);
        $body = sprintf(_("Your username on %s %s is: %s. \n\n It was requested by %s on %s"), $registry->get('name', 'horde'), Horde::url($registry->get('webroot', 'horde'), true), $users['user_uid'], $_SERVER['REMOTE_ADDR'], date('Ymd H:i:s'));
        Folks::sendMail($info['email'], _("Your username was requested"), $body);
        $notification->push(sprintf(_("Your username was sent, check your email (%s)."), $users['user_email']), 'horde.success');
        throw new Horde_Exception_AuthenticationFailure();
    }
}
$page_output->header(array('title' => $title));
require FOLKS_TEMPLATES . '/menu.inc';
require FOLKS_TEMPLATES . '/login/signup.php';
$page_output->footer();
示例#28
0
/* Validate the form. */
if ($form->validate()) {
    $form->getInfo(null, $info);
    /* Get user email. */
    $email = Folks::getUserEmail($info['username']);
    if ($email instanceof PEAR_Error) {
        $notification->push($email);
        throw new Horde_Exception_AuthenticationFailure();
    }
    /* Check the given values with the prefs stored ones. */
    if (!empty($answer) && Horde_String::lower($answer) == Horde_String::lower($info['security_answer']) || empty($answer)) {
        /* Info matches, so reset the password. */
        $password = $auth->resetPassword($info['username']);
        if ($password instanceof PEAR_Error) {
            $notification->push($password);
            throw new Horde_Exception_AuthenticationFailure();
        }
        $body = sprintf(_("Your new password for %s is: %s. \n\n It was requested by %s on %s"), $registry->get('name', 'horde'), $password, $_SERVER['REMOTE_ADDR'], date('Ymd H:i:s'));
        Folks::sendMail($email, _("Your password has been reset"), $body);
        $notification->push(sprintf(_("Your password has been reset, check your email (%s) and log in with your new password."), $email), 'horde.success');
        throw new Horde_Exception_AuthenticationFailure();
    } else {
        /* Info submitted does not match what is in prefs, redirect user back
         * to login. */
        $notification->push(_("Could not reset the password for the requested user. Some or all of the details are not correct. Try again or contact your administrator if you need further help."), 'horde.error');
    }
}
$page_output->header(array('title' => $title));
require FOLKS_TEMPLATES . '/menu.inc';
require FOLKS_TEMPLATES . '/login/signup.php';
$page_output->footer();
示例#29
0
 *
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.horde.org/licenses/gpl.
 *
 * @author Duck <*****@*****.**>
 * @package Folks
 */
require_once __DIR__ . '/lib/base.php';
$title = _("Popularity");
$count = $folks_driver->countUsers();
if ($count instanceof PEAR_Error) {
    $notification->push($count);
    $count = 0;
}
$page = Horde_Util::getGet('page', 0);
$perpage = $prefs->getValue('per_page');
$criteria = array('sort_by' => 'popularity', 'sort_dir' => 0);
$users = $folks_driver->getUsers($criteria, $page * $perpage, $perpage);
if ($users instanceof PEAR_Error) {
    $notification->push($users);
    $users = array();
}
$vars = Horde_Variables::getDefaultVariables();
$pager = new Horde_Core_Ui_Pager('page', $vars, array('num' => $count, 'url' => 'popularity.php', 'perpage' => $perpage));
$pager->preserve($criteria);
$list_url = Folks::getUrlFor('list', 'popularity');
$page_output->addScriptFile('stripe.js', 'horde');
$page_output->header(array('title' => $title));
$page_output->footer();
$notification->notify(array('listeners' => 'status'));
require FOLKS_TEMPLATES . '/list/list.php';
示例#30
0
文件: list.php 项目: jubinpatel/horde
if ($count instanceof PEAR_Error) {
    $notification->push($count);
    $count = 0;
}
if (($sort_by = Horde_Util::getFormData('sort_by')) !== null) {
    $prefs->setValue('sort_by', $sort_by);
} else {
    $sort_by = $prefs->getValue('sort_by');
}
if (($sort_dir = Horde_Util::getFormData('sort_dir')) !== null) {
    $prefs->setValue('sort_dir', $sort_dir);
} else {
    $sort_dir = $prefs->getValue('sort_dir');
}
$page = Horde_Util::getGet('page', 0);
$perpage = $prefs->getValue('per_page');
$criteria = array('sort_by' => $sort_by, 'sort_dir' => $sort_dir);
$users = $folks_driver->getUsers($criteria, $page * $perpage, $perpage);
if ($users instanceof PEAR_Error) {
    $notification->push($users);
    $users = array();
}
$vars = Horde_Variables::getDefaultVariables();
$pager = new Horde_Core_Ui_Pager('page', $vars, array('num' => $count, 'url' => 'list.php', 'perpage' => $perpage));
$pager->preserve($criteria);
$list_url = Folks::getUrlFor('list', 'list');
$page_output->addScriptFile('stripe.js', 'horde');
$page_output->header(array('title' => $title));
$notification->notify(array('listeners' => 'status'));
require FOLKS_TEMPLATES . '/list/list.php';
$page_output->footer();