public function indexAction()
 {
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         throw new Exception("Please login");
     }
     $user = User::factory($auth->getIdentity());
     if (!$user->isAdmin()) {
         throw new Exception("You must be an admin to view this page.");
     }
     $this->_helper->viewRenderer->setNoRender();
     Zend_Loader::loadClass("UserModel");
     $usermodel = new UserModel();
     $users = $usermodel->getUserList();
     foreach ($users as $username) {
         $user = User::factory($username);
         $memcount = $usermodel->getMemberCount($user);
         for ($i = 0; $i < $memcount; $i++) {
             $member = $usermodel->getMember($user, $i);
             if (!empty($member->email)) {
                 echo "{$member->email}, ";
             }
         }
     }
 }
Exemple #2
0
/**
 * Copyright 2007-2009 Chennai Mathematical Institute
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * @file   GravatarModel.php
 * @author Arnold Noronha <*****@*****.**>
 */
function getgravatar($user)
{
    Zend_Loader::loadClass("UserModel");
    $userm = new UserModel();
    $user = $userm->getRow($user);
    $email = $userm->getMember($user, 0)->email;
    $grav_url = "http://www.gravatar.com/avatar.php?gravatar_id=" . md5(strtolower($email)) . '&amp;size=40';
    return $grav_url;
}
 public function indexAction()
 {
     $_user = $this->_request->get("user");
     if (webconfig::getContest()->isQueuePrivate()) {
         $user = User::factory(Zend_Auth::getInstance()->getIdentity());
         if (!$user || !$user->isAdmin()) {
             $this->_forward("privacy", "error", NULL, array());
         }
     }
     if (empty($_user)) {
         $this->_redirect(webconfig::getContestRelativeBaseUrl());
     }
     /* fillin information from User XML data */
     Zend_Loader::loadClass("UserModel");
     $userm = new UserModel();
     $user = $userm->getRow($_user);
     $this->view->username = $user->_username;
     $this->view->inst = $userm->getInstitute($user);
     $this->view->name = $userm->getMember($user, 0)->name;
 }
 function resetAction()
 {
     Zend_Loader::loadClass("UserModel");
     $userm = new UserModel();
     $user = $this->_request->get("user");
     $key = $this->_request->get("key");
     $obj = $userm->getRow($user);
     if (empty($obj) or empty($key)) {
         $this->_redirect("/");
     }
     $savedkey = $this->cache->load($user);
     if ($savedkey != $key) {
         $this->_redirect("/");
     }
     $this->cache->remove($user);
     $pass = "";
     for ($i = 0; $i < 8; $i++) {
         $pass = $pass . mt_rand(0, 9);
     }
     /* send email */
     $mail = Mailer::get_mailer();
     $baseurl = Zend_Controller_Front::getInstance()->getBaseUrl();
     if ($baseurl == "/") {
         $baseurl = "";
     }
     $mail->setBodyText("\n\nYou are receiving this email because you wished to reset your password\non http://{$_SERVER['SERVER_NAME']}{$baseurl}.\n\nWe have changed your password to: {$pass}\n\nPlease try logging in using this password and change it as soon as\npossible.\n\n");
     $mail->addTo($userm->getMember($obj, 0)->email, $userm->getMember($obj, 0)->name);
     $mail->setSubject("Password Reset");
     $mail->send();
     $obj->setPassword($pass);
 }
 public function updateAction()
 {
     $this->view->mode = "update";
     /* fill in the existing details */
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         $this->_forward("illegal", "error");
         return;
     }
     $this->user = $auth->getIdentity();
     Zend_Loader::loadClass("UserModel");
     $userm = new UserModel();
     $user = $userm->getRow($this->user);
     $this->user = $user->_username;
     $this->institute = $userm->getInstitute($user);
     $this->country = $userm->getCountry($user);
     $this->timezone = $userm->getTimezone($user);
     $this->name0 = $userm->getMember($user, 0)->name;
     $this->email0 = $userm->getMember($user, 0)->email;
     $count = $userm->getMemberCount($user);
     if ($count > 1) {
         $this->name1 = $userm->getMember($user, 1)->name;
         $this->email1 = $userm->getMember($user, 1)->email;
     }
     if ($count > 2) {
         $this->name2 = $userm->getMember($user, 2)->name;
         $this->email2 = $userm->getMember($user, 2)->email;
     }
     $this->copyToView();
 }