示例#1
0
 function testGravatarExists()
 {
     $gravatar = new Gravatar($this->email);
     $this->assertTrue($gravatar->avatar_exists());
     $gravatar = new Gravatar('*****@*****.**');
     $this->assertFalse($gravatar->avatar_exists());
 }
示例#2
0
 /**
  * Create an object.
  *
  * <code>
  * $userId = 1;
  *
  * $profile = Prism\Integration\Profile\Gravatar::getInstance(\JFactory::getDbo(), $userId);
  * </code>
  *
  * @param  \JDatabaseDriver $db
  * @param  int $id
  *
  * @return null|Gravatar
  */
 public static function getInstance(\JDatabaseDriver $db, $id)
 {
     if (empty(self::$instances[$id])) {
         $item = new Gravatar($db);
         $item->load($id);
         self::$instances[$id] = $item;
     }
     return self::$instances[$id];
 }
示例#3
0
 public function action_index($identifier = false)
 {
     // TODO: cache this crap
     if (!$identifier) {
         Message::instance()->set('No user specified.');
         return $this->request->redirect('');
     }
     if (is_numeric($identifier)) {
         // pass
         $user = ORM::factory('user', $identifier);
     } else {
         $user = ORM::factory('user')->where('username', '=', $identifier)->find();
     }
     if ($user->loaded()) {
         $user = (object) $user->as_array();
         unset($user->password);
         $user->avatar = Gravatar::avatar($user->email, 128);
         unset($user->email);
         $this->template->user = $user;
         $pg = isset($_GET['p']) && (int) $_GET['p'] ? $_GET['p'] : 1;
         $pg = max($pg, 1);
         $l = 10;
         $q = array('user' => $user->id, 'l' => $l, 'o' => ($pg - 1) * $l, 'p' => $pg, 'recent' => 'yes');
         $r = Sourcemap_Search::find($q);
         $this->template->search_result = $r;
         $p = Pagination::factory(array('current_page' => array('source' => 'query_string', 'key' => 'p'), 'total_items' => $r->hits_tot, 'items_per_page' => $r->limit, 'view' => 'pagination/basic'));
         $this->template->pager = $p;
         $this->template->supplychains = $r->results;
     } else {
         Message::instance()->set('That user doesn\'t exist.');
         return $this->request->redirect('');
     }
 }
示例#4
0
 /**
  *	@fn test_tomorrow
  *	@short Test method for tomorrow.
  */
 public function test_gravatar_url()
 {
     $email = '*****@*****.**';
     $size = 40;
     $default = 'http://www.emeraldion.it/images/avatar.png';
     $grav_url = 'http://www.gravatar.com/avatar.php?gravatar_id=' . md5($email) . '&amp;default=' . urlencode($default) . '&amp;size=' . $size;
     $this->assertEquals($grav_url, Gravatar::gravatar_url($email, $size, $default), 'Bad gravatar URL');
 }
示例#5
0
 public function getUser()
 {
     $responseData = \Auth::user()->toArray();
     $responseData['pingBaseUrl'] = \App\Ping::baseUrl();
     $responseData['avatar'] = \Gravatar::get($responseData['email']);
     unset($responseData['id']);
     unset($responseData['updated_at']);
     return response($responseData, 200);
 }
示例#6
0
 public function call()
 {
     $app = $this->app;
     $env = $app->environment();
     if (isset($_SESSION['uid'])) {
         $user = ORM::forTable('users')->findOne($_SESSION['uid']);
         $endpoint = array('id' => $_SESSION['username'], 'nick' => $user->nick, 'presence' => 'online', 'show' => 'available', 'status' => $user->status, 'url' => '#', 'pic_url' => Gravatar::url($user->login), 'role' => 'user');
         $env['endpoint'] = $endpoint;
     }
     $this->next->call();
 }
示例#7
0
 public function getCompleteregistration($id)
 {
     $gravatar = Gravatar::find($id);
     $userEdit = User::find(Auth::user()->id);
     $photo = bin2hex(openssl_random_pseudo_bytes(20)) . '_' . $gravatar->image;
     $photo_thumbnail = bin2hex(openssl_random_pseudo_bytes(20)) . '_' . 'thumbnail' . '_' . $gravatar->image;
     File::copy('gravatar/' . $gravatar->image, 'photo/' . $photo);
     File::copy('photo/' . $photo, 'photo/' . $photo_thumbnail);
     Image::make('photo/' . $photo)->resize(300, 300)->save('photo/' . $photo);
     Image::make('photo/' . $photo_thumbnail)->resize(48, 48)->save('photo/' . $photo_thumbnail);
     $userEdit->photo = $photo;
     $userEdit->photo_thumbnail = $photo_thumbnail;
     $userEdit->save();
     return Redirect::to('profile');
 }
示例#8
0
 public function kitchen_sink($scid)
 {
     $scid = (int) $scid;
     if (($sc = ORM::factory('supplychain', $scid)) && $sc->loaded()) {
         $rows = $this->_db->query(Database::SELECT, sprintf("select s.id as stop_id, ST_AsText(s.geometry) as geometry, \n                        sa.key as attr_k, sa.value as attr_v, s.local_stop_id as local_stop_id\n                    from stop as s left outer join stop_attribute as sa on\n                        (s.supplychain_id=sa.supplychain_id and s.local_stop_id=sa.local_stop_id)\n                    where s.supplychain_id = %d\n                    order by sa.id desc", $scid), true)->as_array();
         $stops = array();
         foreach ($rows as $i => $row) {
             if (!isset($stops[$row->local_stop_id])) {
                 $stops[$row->local_stop_id] = (object) array('local_stop_id' => $row->local_stop_id, 'id' => $row->local_stop_id, 'geometry' => $row->geometry, 'attributes' => (object) array());
             }
             if ($row->attr_k) {
                 $stops[$row->local_stop_id]->attributes->{$row->attr_k} = $row->attr_v;
             }
         }
         $hops = array();
         $sql = sprintf("select h.id as hop_id, h.from_stop_id, h.to_stop_id,\n                ST_AsText(h.geometry) as geometry, ha.key as attr_k, ha.value as attr_v\n                from hop as h \n                    left outer join hop_attribute as ha on (\n                        h.supplychain_id=ha.supplychain_id and\n                        h.from_stop_id=ha.from_stop_id and\n                        h.to_stop_id=ha.to_stop_id\n                    )\n                where h.supplychain_id = %d order by h.id asc", $scid);
         $rows = $this->_db->query(Database::SELECT, $sql, true);
         foreach ($rows as $i => $row) {
             $hkey = sprintf("%d-%d", $row->from_stop_id, $row->to_stop_id);
             if (!isset($hops[$hkey])) {
                 $hops[$hkey] = (object) array('from_stop_id' => $row->from_stop_id, 'to_stop_id' => $row->to_stop_id, 'geometry' => $row->geometry, 'attributes' => (object) array());
             }
             if ($row->attr_k) {
                 $hops[$hkey]->attributes->{$row->attr_k} = $row->attr_v;
             }
         }
         $sql = sprintf("select sca.key as attr_k, sca.value as attr_v\n                from supplychain_attribute as sca\n                where sca.supplychain_id=%d", $scid);
         $owner = $sc->owner;
         $cat = $sc->taxonomy;
         $sc = (object) $sc->as_array();
         $sc->attributes = new stdClass();
         $rows = $this->_db->query(Database::SELECT, $sql, true);
         foreach ($rows as $i => $row) {
             $sc->attributes->{$row->attr_k} = $row->attr_v;
         }
         $sc->stops = array_values($stops);
         $sc->hops = array_values($hops);
         $sc->owner = (object) array('id' => $owner->id, 'name' => $owner->username, 'avatar' => Gravatar::avatar($owner->email));
         $sc->user_id = $owner->id;
         $sc->taxonomy = $cat && $cat->loaded() ? Sourcemap_Taxonomy::load_ancestors($cat->id) : null;
     } else {
         throw new Exception('Supplychain not found.');
     }
     return $sc;
 }
示例#9
0
if (!empty($logs)) {
    ?>
<div class="panel-heading">
	<span class="panel-title"><?php 
    echo __('Activity');
    ?>
</span>
</div>
<div class="widget-comments panel-body no-padding" id="profile-tabs-board">
	<?php 
    foreach ($logs as $log) {
        ?>
	<div class="comment">
		<?php 
        echo Gravatar::load($log->email, 32, NULL, array('class' => 'comment-avatar'));
        ?>
		<div class="comment-body">
			<div class="comment-by">
				<?php 
        echo HTML::anchor(Route::get('backend')->uri(array('controller' => 'users', 'action' => 'profile', 'id' => $log->user_id)), $log->username);
        ?>
				<span><?php 
        echo Date::format($log->created_on, 'j F Y H:i');
        ?>
</span>
			</div>
			<div class="comment-text">
				
				<?php 
        echo $log->message;
示例#10
0
            .container {
                text-align: center;
                display: table-cell;
                vertical-align: middle;
            }

            .content {
                text-align: center;
                display: inline-block;
            }

            .title {
                font-size: 96px;
            }
        </style>
    </head>
    <body>
        <div class="container">
            <div class="content">
                <img src="<?php 
echo Gravatar::get('*****@*****.**');
?>
" alt="" />

                <div class="title">Laravel 5</div>
            </div>
        </div>
    </body>
</html>
示例#11
0
			</tr>
		</tfoot>
		
		<tbody>
			<?php 
                foreach ($items as $item) {
                    ?>
				<tr>
					<td style="text-align:left;">
						<?php 
                    if ($pawUsers->config["show_gravatars"]) {
                        ?>
							<span class="pawusers-td-avatar">
								<?php 
                        use_helper("Gravatar");
                        $file = Gravatar::url($item->email, "image", array("size" => 45, "default" => pawUsers_URL . "admin/images/no-avatar.jpg"));
                        $header = @get_headers($file);
                        if (!strpos($header[0], "200")) {
                            $file = pawUsers_URL . "admin/images/no-avatar.jpg";
                        }
                        ?>
								<img src="<?php 
                        echo $file;
                        ?>
" width="45px" height="45px" />
							</span>
						<?php 
                    }
                    ?>
						<span class="pawusers-td-user">
							<span class="pawusers-td-username"><?php 
示例#12
0
?>
</span><li>
                    <li>Email: <span><?php 
echo HTML::chars($user->email);
?>
</span><li>    
                    <li>Last Signed In: <span><?php 
echo date('F j, Y', $user->last_login);
?>
</span><li>
                </ul>
            </div>
            <div class="clear"></div>
            <div>
                <div class="upload-photo button"><a href="http://www.gravatar.com/<?php 
echo Gravatar::hash($user->email);
?>
">Change photo</a></div> <div class="reset-password button"><a href="auth/reset">Change Password</a></div>
            </div>
        </div>
        <div class="dashboard-top-right">
            <div>
                <h2>Recent Activity</h2>
            </div>
            <hr />
            <div id="user-stream">
                <?php 
if (isset($user_event_stream)) {
    ?>
                <?php 
    echo View::factory('partial/user/event/stream', array('stream' => $user_event_stream));
示例#13
0
 public function getAvatar($width)
 {
     if ($this->facebook) {
         return "http://graph.facebook.com/{$this->facebook->oauth_uid}/picture?type=large&width={$width}&height={$width}";
     }
     return Gravatar::src($this->email, 275);
 }
?>
</th>
    </tr>
  </thead>
  <tbody>
<?php 
foreach ($users as $user) {
    ?>
 
    <tr class="node <?php 
    echo odd_even();
    ?>
">
      <td class="user">
        <?php 
    echo Gravatar::img($user->email, array('align' => 'middle', 'alt' => 'user icon'), '32', URL_PUBLIC . 'wolf/admin/images/user.png', 'g', USE_HTTPS);
    ?>
        <a href="<?php 
    echo get_url('user/edit/' . $user->id);
    ?>
"><?php 
    echo $user->name;
    ?>
</a>
        <small><?php 
    echo $user->username;
    ?>
</small>
      </td>
      <td><?php 
    echo $user->email;
示例#15
0
 /**
  * FUNCTION USED TO GE USER THUMBNAIL
  * @param : thumb file
  * @param : size (NULL,small)
  */
 function getUserThumb($udetails, $size = '', $uid = NULL, $just_file = false)
 {
     $remote = false;
     if (empty($udetails['userid']) && $uid) {
         $udetails = $this->get_user_details($uid);
     }
     //$thumbnail = $udetails['avatar'] ? $udetails['avatar'] : NO_AVATAR;
     $thumbnail = $udetails['avatar'];
     $thumb_file = USER_THUMBS_DIR . '/' . $thumbnail;
     if (file_exists($thumb_file) && $thumbnail) {
         $thumb = USER_THUMBS_URL . '/' . $thumbnail;
     } elseif (!empty($udetails['avatar_url'])) {
         $thumb = $udetails['avatar_url'];
         $remote = true;
     } else {
         if (!USE_GAVATAR) {
             $thumb_file = $this->get_default_thumb();
         } else {
             switch ($size) {
                 case "small":
                     $thesize = AVATAR_SMALL_SIZE;
                     $default = $this->get_default_thumb('small');
                     break;
                 default:
                     $thesize = AVATAR_SIZE;
                     $default = $this->get_default_thumb();
             }
             $email = $udetails['email'];
             $email = $email ? $email : $udetails['anonym_email'];
             $gravatar = new Gravatar($email, $default);
             $gravatar->size = $thesize;
             $gravatar->rating = "G";
             $gravatar->border = "FF0000";
             $thumb = $gravatar->getSrc();
             //echo $gravatar->toHTML();
         }
     }
     $ext = GetExt($thumb_file);
     $file = getName($thumb_file);
     if (!$remote) {
         if (!empty($size) && !$thumb) {
             $thumb = $this->get_default_thumb('small');
         } elseif (!$thumb) {
             $thumb = $this->get_default_thumb();
         }
     }
     if ($just_file) {
         return $file . '.' . $ext;
     }
     return $thumb;
 }
示例#16
0
	<div class="lighter" style="float:right">
		<?php 
printf(l('Comment issued on %s'), $comment->human_readable_date());
?>
		<a href="<?php 
echo $comment->permalink();
?>
" title="<?php 
echo h(l('Permalink for comment'));
?>
 #<?php 
echo $comment->id;
?>
">#</a>
	</div>
	<h4><?php 
printf(l('%s says:'), empty($comment->URL) ? $comment->author : a($comment->author, array('href' => $comment->URL)));
?>
</h4>
	<img class="diario-gravatar" src="<?php 
echo Gravatar::gravatar_url($comment->email);
?>
" alt="Gravatar" />
	<div class="diario-comment-text">
		<p>
			<?php 
echo $comment->pretty_text();
?>
		</p>
	</div>
</div>
 public function getGavatarProfile($hashed_email, $default_name = null)
 {
     if (!\Request::wantsJson() && !\Request::ajax()) {
         \App::abort(404);
     }
     if (empty($hashed_email)) {
         \App::abort(404);
     }
     $profile = ['name' => $default_name, 'about' => '', 'location' => ''];
     $gravatar_profile = \Gravatar::profile($hashed_email, false);
     $gravatar_profile = $gravatar_profile['entry'][0];
     if ($gravatar_profile) {
         if (!empty($gravatar_profile['name']['formatted'])) {
             $profile['name'] = $gravatar_profile['name']['formatted'];
         }
         if (!empty($gravatar_profile['aboutMe'])) {
             $profile['about'] = $gravatar_profile['aboutMe'];
         }
         if (!empty($gravatar_profile['currentLocation'])) {
             $profile['location'] = $gravatar_profile['currentLocation'];
         }
     }
     //return json
     return \Response::json($profile);
 }
示例#18
0
文件: user.php 项目: ZerGabriel/cms-1
 /**
  * Получение аватара пользлователя из сервиса Gravatar
  * 
  * @param integer $size
  * @param string $default
  * @param array $attributes
  * @return string HTML::image
  */
 public function gravatar($size = 40, $default = NULL, array $attributes = NULL)
 {
     return Gravatar::load($this->email, $size, $default, $attributes);
 }
示例#19
0
<?php

/* FOR EE 2.x */
if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
$plugin_info = array('pi_name' => 'Gravatar', 'pi_version' => '2.1.2', 'pi_author' => 'Philip Zaengle', 'pi_author_url' => 'http://www.philipzaengle.com/', 'pi_description' => 'Returns gravatar URL', 'pi_usage' => Gravatar::usage());
/**
 * Memberlist Class
 *
 * @package			ExpressionEngine
 * @category		Plugin
 * @author			Philip Zaengle
 * @copyright		Copyright (c) 2009, Philip Zaengle
 * @link			http://www.philipzaengle.com/expressionengine_addons/gravatar
 */
class Gravatar
{
    var $return_data = "";
    /**
     * Gravatar
     *
     * This function returns the url of a gravatar image.
     *
     * @access	public
     * @return	string
     */
    function Gravatar()
    {
        $this->EE =& get_instance();
        $rating = $this->EE->TMPL->fetch_param('rating');
示例#20
0
 /**
  * Get user avatar, and creates a image link
  *
  * Optionally, if it is allowed, used [Gravatar].
  *
  * Example:
  * ~~~
  * $post = Post::dcache($id, 'page', $config);
  *
  * echo HTML::anchor($post->user->url, User::getAvatar($post->user));
  * ~~~
  *
  * @since   1.1.0
  *
  * @param   ORM      $user      User model
  * @param   array    $attrs     Default attributes + type = crop|ratio [Optional]
  * @param   mixed    $protocol  Protocol to pass to `URL::base()` [Optional]
  * @param   boolean  $index     Include the index page [Optional]
  *
  * @return  string
  *
  * @uses    Config::get
  * @uses    Gravatar::setSize
  * @uses    Gravatar::setDefaultImage
  * @uses    Gravatar::getImage
  * @uses    URL::site
  * @uses    Arr::merge
  */
 public static function getAvatar(ORM $user, array $attrs = array(), $protocol = NULL, $index = FALSE)
 {
     // Default user pic
     $avatar = 'media/images/avatar-user-400.png';
     // Set default attributes
     $attrs_default = array('size' => 32, 'type' => 'resize', 'itemprop' => 'image', 'default_image' => URL::site($avatar, TRUE));
     // Merge attributes
     $attrs = Arr::merge($attrs_default, $attrs);
     $use_gravatar = Config::get('site.use_gravatars', FALSE);
     if ($use_gravatar) {
         $avatar = Gravatar::instance($user->mail)->setSize($attrs['size'])->setDefaultImage($attrs['default_image'])->getImage(array('alt' => $user->nick, 'itemprop' => $attrs['itemprop'], 'width' => $attrs['size'], 'height' => $attrs['size']), $protocol, $index);
     } else {
         if (!empty($user->picture)) {
             $avatar = $user->picture;
         }
         $avatar = HTML::resize($avatar, array('alt' => $user->nick, 'height' => $attrs['size'], 'width' => $attrs['size'], 'type' => $attrs['type'], 'itemprop' => $attrs['itemprop']), $protocol, $index);
     }
     return $avatar;
 }
示例#21
0
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License along with this
 * program. If not, see <http://www.gnu.org/licenses/>.*/
?>

<td><?php 
echo $item->id;
?>
</td>
<td><a href="admin/users/<?php 
echo $item->id;
?>
"><?php 
echo Html::chars($item->username);
?>
</a></td>
<td><?php 
echo Html::chars($item->email);
?>
</td>
<td><img width="32px" height="32px" src="<?php 
echo Gravatar::avatar($item->email, 32);
?>
" /></td>
<form name="delete-users" method="post" action="admin/users/<?php 
echo $item->id;
?>
/delete_user">
<td><input type ="submit" value="delete" /></form></td>
示例#22
0
文件: Git.php 项目: kelvinj/Giiki
 function get_history($file = "")
 {
     $output = array();
     // FIXME: Find a better way to find the files that changed than --name-only
     $this->_cmd("log --name-only --pretty=format:'%H>%T>%an>%ae>%aD>%s' -- {$file}", $output);
     $history = array();
     $historyItem = array();
     foreach ($output as $line) {
         $logEntry = explode(">", $line, 6);
         if (sizeof($logEntry) > 1) {
             // Populate history structure
             $historyItem = array("author" => $logEntry[2], "email" => $logEntry[3], "linked-author" => $logEntry[3] == "" ? $logEntry[2] : "<a href=\"mailto:{$logEntry['3']}\">{$logEntry['2']}</a>", "date" => $logEntry[4], "message" => $logEntry[5], "commit" => $logEntry[0]);
             $grav = new Gravatar($historyItem['email']);
             $grav->size = 20;
             $historyItem['avatar'] = $grav->gravatarLink();
             $historyItem['diff'] = $this->show(' --unified=1 ' . $historyItem['commit'] . ' ' . $file);
         } else {
             if (!isset($historyItem["page"])) {
                 $historyItem["page"] = $line;
                 $history[] = $historyItem;
             }
         }
     }
     return $history;
 }
示例#23
0
function edit_profile()
{
    global $db, $err, $log, $website, $userid;
    try {
        $sql = "SELECT * FROM `members` WHERE `id` = :userid";
        $sql_do = $db->prepare($sql);
        $sql_do->bindParam(':userid', $userid, PDO::PARAM_INT);
        $sql_do->execute();
        $number = $db->query("SELECT FOUND_ROWS()")->fetchColumn();
    } catch (PDOException $e) {
        $log->logError($e . " - " . basename(__FILE__));
    }
    if (!empty($number)) {
        $f = $sql_do->fetch(PDO::FETCH_ASSOC);
        $email_user = cleanInput($f['email']);
        $first_name = cleanInput($f['first_name']);
        $last_name = cleanInput($f['last_name']);
        $joined_on = cleanInput($f['join']);
        $last_access = cleanInput($f['access']);
        $user_bio = cleanInput($f['bio']);
        /*
        displaying gravatar photo over here if email is associated with a gravatar account.
        */
        $default = $website . "/images/anonuser_50px.gif";
        $gravatar = new Gravatar($email_user, $default);
        $gravatar->size = 50;
        ?>
	<div class="page-header no-border">
		<h1><img class="profilephoto thumbnail" src="<?php 
        echo $gravatar->getSrc();
        ?>
" />&nbsp;&nbsp;<?php 
        echo $first_name . " " . $last_name;
        ?>
</h1>
	</div>

	<div class="tabs-left">
		<ul class="nav nav-tabs" id="usermanage">
			<li class="active"><a href="#general" data-toggle="tab"><i class="icon-cog"></i> <?php 
        echo _("General");
        ?>
</a></li>
			<li><a href="#profile" data-toggle="tab"><i class="icon-user"></i> <?php 
        echo _("Profile");
        ?>
</a></li>
		</ul>

	<form class="form-horizontal" method="POST" action="<?php 
        echo $website . "/" . USER_DIRECTORY;
        ?>
/editprofile">
	<div class="tab-content">
		<div class="tab-pane active" id="general">
			<fieldset>
				<legend><?php 
        echo _("General");
        ?>
</legend>
				<?php 
        echo $err;
        ?>
				<div class="control-group">
					<label class="control-label" for="first_name"><?php 
        echo _("First Name");
        ?>
</label>
					<div class="controls">
						<input type="text" class="input-xlarge" id="first_name" name="first_name" value="<?php 
        echo $first_name;
        ?>
">
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="last_name"><?php 
        echo _("Last Name");
        ?>
</label>
					<div class="controls">
						<input type="text" class="input-xlarge" id="last_name" name="last_name" value="<?php 
        echo $last_name;
        ?>
">
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="email"><?php 
        echo _("Email");
        ?>
</label>
					<div class="controls">
						<input type="text" class="input-xlarge disabled" id="email" name="email" value="<?php 
        echo $email_user;
        ?>
" disabled>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="pass"><?php 
        echo _("Password");
        ?>
</label>
					<div class="controls">
						<input type="text" class="input-xlarge disabled" id="pass" name="pass" value="<?php 
        echo $f['password'];
        ?>
" disabled>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="join"><?php 
        echo _("Joined On");
        ?>
</label>
					<div class="controls">
						<input type="text" class="input-xlarge disabled" id="join" name="join" value="<?php 
        echo $joined_on;
        ?>
" disabled>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="access"><?php 
        echo _("Last Access");
        ?>
</label>
					<div class="controls">
						<input type="text" class="input-xlarge disabled" id="access" name="access" value="<?php 
        echo $last_access;
        ?>
" disabled>
					</div>
				</div>
			</fieldset>
		</div>
		<div class="tab-pane" id="profile">
			<fieldset>
				<legend><?php 
        echo _("Profile");
        ?>
</legend>
				<?php 
        echo $err;
        ?>
				<div class="control-group">
					<label class="control-label" for="bio"><?php 
        echo _("Bio");
        ?>
</label>
					<div class="controls">
						<textarea class="input-xxlarge" id="bio" name="bio" rows="8"><?php 
        echo $user_bio;
        ?>
</textarea>
					</div>
				</div>
			</fieldset>
		</div>
		<div class="form-actions">
			<input type="submit" class="btn btn-primary" name="editprofile" value="<?php 
        echo _("Update Profile");
        ?>
">
		</div>
	</form>
	</div>
<?php 
    } else {
        echo "<div class=\"alert alert-error\"><strong>" . _("Oops!") . "</strong><br/>" . _("We are unable to find the user in our system. You can still try again later.") . "</div>";
    }
}
示例#24
0
文件: account.php 项目: sfrisk/iRPG
if (isset($_POST['submit'])) {
    $user->setAccount($username, $email, $passwords);
}
?>
		
		<?php 
include 'settings.php';
?>
		
		<div id="right_content">
		<h2>Account</h2>
		From here you can change your basic account info.
		<p></p>
		<p>
		<img src ="<?php 
echo Gravatar::creat($user->email);
?>
" />
		<br /> Change your avatar at <a href="http://www.gravatar.com">gravatar.com</a>
		<br />
		We are using <em><?php 
echo $user->email;
?>
</em>
		</p>
		</div>
		<div id="left_content">
	
		<form action="account.php" method="post">
		<p>
		<label for="username">Username</label>
示例#25
0
	<div id="lobby">
		<div class="caption">Lobby</div>
		<div id="chatbox">
			<form action="' . $_SERVER['REQUEST_URI'] . '" method="post"><div>
				<input type="hidden" name="lobby" value="1" />
				<input id="chat" type="text" name="chat" />
			</div></form>';
if (is_array($chat_data)) {
    $lobby .= '
			<dl id="chats">';
    foreach ($chat_data as $chat) {
        // preserve spaces in the chat text
        $chat['message'] = str_replace("\t", '    ', $chat['message']);
        $chat['message'] = str_replace('  ', ' &nbsp;', $chat['message']);
        if (!isset($gravatars[$chat['email']])) {
            $gravatars[$chat['email']] = Gravatar::src($chat['email']);
        }
        $grav_img = '<img src="' . $gravatars[$chat['email']] . '" alt="" /> ';
        if ('' == $chat['username']) {
            $chat['username'] = '******';
        }
        $lobby .= '
				<dt>' . $grav_img . '<span>' . ldate(Settings::read('short_date'), strtotime($chat['create_date'])) . '</span> ' . $chat['username'] . '</dt>
				<dd>' . htmlentities($chat['message'], ENT_QUOTES, 'UTF-8', false) . '</dd>';
    }
    $lobby .= '
			</dl> <!-- #chats -->';
}
$lobby .= '
		</div> <!-- #chatbox -->
	</div> <!-- #lobby -->';
示例#26
0
 public function action_create()
 {
     if (!Auth::instance()->get_user()) {
         Message::instance()->set('You must be signed in to create maps.');
         $this->request->redirect('auth');
     }
     $supplychain_id = '4';
     if (!is_numeric($supplychain_id)) {
         $supplychain_id = $this->_match_alias($supplychain_id);
     }
     $supplychain = ORM::factory('supplychain', $supplychain_id);
     if ($supplychain->loaded()) {
         $current_user_id = Auth::instance()->logged_in() ? (int) Auth::instance()->get_user()->id : 0;
         $owner_id = (int) $supplychain->user_id;
         if ($supplychain->user_can($current_user_id, Sourcemap::READ)) {
             $this->layout->supplychain_id = $supplychain_id;
             $this->template->supplychain_id = $supplychain_id;
             $this->layout->scripts = array('map-view');
             $this->layout->styles = array('sites/default/assets/styles/reset.css', 'assets/styles/base.less', 'assets/styles/general.less');
             // comments
             $c = $supplychain->comments->find_all();
             $comment_data = array();
             foreach ($c as $i => $comment) {
                 $arr = $comment->as_array();
                 $arr['username'] = $comment->user->username;
                 $arr['avatar'] = Gravatar::avatar($comment->user->email);
                 $comment_data[] = (object) $arr;
             }
             $this->template->comments = $comment_data;
             $this->template->can_comment = (bool) $current_user_id;
             // qrcode url
             $qrcode_query = URL::query(array('q' => URL::site('view/' . $supplychain->id, true), 'sz' => 8));
             $this->template->qrcode_url = URL::site('services/qrencode', true) . $qrcode_query;
         } else {
             Message::instance()->set('That map is private.');
             $this->request->redirect('browse');
         }
     } else {
         Message::instance()->set('That map could not be found.');
         $this->request->redirect('browse');
     }
 }
示例#27
0
 /** static public function get_instance
  *		Returns the singleton instance
  *		of the Gravatar Object as a reference
  *
  * @param array optional settings
  * @action optionally creates the instance
  * @return Log Object reference
  */
 public static function get_instance($settings = array())
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new Gravatar($settings);
     }
     return self::$_instance;
 }
示例#28
0
文件: common.php 项目: dasklney/traq
/**
 * Get a profile link with the users gravatar.
 *
 * @param  string  $userEmail
 * @param  string  $userName
 * @param  integer $userId
 * @param  integer $size
 *
 * @return string
 */
function gravatar_profile_link($userEmail, $userName, $userId, $size = null)
{
    return HTML::link(Gravatar::withString($userEmail, $userName, $size), routePath('user', ['id' => $userId]));
}
    return $first_name . ' ' . $last_name;
});
HTML::macro('loggedUserFullName', function () {
    $logged_user = AuthMgr::getLoggedUser();
    return HTML::userFullName($logged_user);
});
HTML::macro('loggedUserEmail', function () {
    $user = AuthMgr::getLoggedUser();
    return $user['email'];
});
HTML::macro('loggedUserGravatarImage', function ($alt = null, $attributes = []) {
    $logged_user = AuthMgr::getLoggedUser();
    if (empty($logged_user)) {
        return null;
    }
    return Gravatar::image($logged_user->email, $alt, $attributes);
});
/*
|--------------------------------------------------------------------------
| Helper Functions
|--------------------------------------------------------------------------
|
| Include helper functions file
|
*/
require_once 'helper_functions.php';
/*
|--------------------------------------------------------------------------
| Enable Sentry Throttling
|--------------------------------------------------------------------------
|
示例#30
0
<h1>Gravatar for <?php 
echo $grav1->get_email();
?>
</h1>

<h2>Basic usage</h2>

<?php 
echo $grav1;
?>

<h2>Testing all the options</h2>

<?php 
$grav2 = new Gravatar(array('default' => 'identicon', 'size' => 128, 'rating' => 'X', 'border' => 'F00', 'file_extension' => 'png', 'extra' => 'class="test"'));
$grav2->set_email($email);
// Testing __get() and isset
assert($grav2->rating == 'X');
assert(isset($grav2->border));
if ($grav2->avatar_exists()) {
    echo 'Image link is <a href="' . $grav2->get_src() . '">' . $grav2->get_src() . '</a><br/>';
    echo $grav2;
} else {
    echo 'No Gravatar exists for this email address<br/>';
    echo $grav2;
    // Showing the identicon
}
?>
</body>
</html>