Ejemplo n.º 1
0
 private function generateListe()
 {
     $vorlaeufigesArray = array();
     $punkteArray = array();
     $uidArray = User::getUIDArray(true);
     foreach ($uidArray as $uid) {
         $username = User::getNameById($uid);
         $u = new User($username);
         $vorlaeufigesArray[$uid] = array();
         $vorlaeufigesArray[$uid]['username'] = $username;
         $punkteDetail = $u->getPunkteDetail();
         $vorlaeufigesArray[$uid]['exakt'] = $punkteDetail['ergebnis']['anzahl'];
         $vorlaeufigesArray[$uid]['verhaeltnis'] = $punkteDetail['differenz']['anzahl'];
         $vorlaeufigesArray[$uid]['sieger'] = $punkteDetail['sieger']['anzahl'];
         $vorlaeufigesArray[$uid]['punkte'] = $punkteDetail['gesamt']['punkte'];
         $punkteArray[$uid] = $punkteDetail['gesamt']['punkte'];
     }
     unset($uid, $punkteDetail, $u);
     asort($punkteArray, SORT_NUMERIC);
     $punkteArray = array_reverse($punkteArray, true);
     $finalArray = array();
     $i = 1;
     foreach ($punkteArray as $uid => $punkte) {
         $finalArray[$i] = $vorlaeufigesArray[$uid];
         $i++;
     }
     unset($punkteArray, $uid, $punkte, $vorlaeufigesArray, $i);
     $this->tpl->assign('points', $finalArray);
 }
Ejemplo n.º 2
0
 /**
  * @param int $uid
  * @param int $spiel_id
  */
 public function __construct($uid, $spiel_id)
 {
     $this->uid = $uid;
     $this->spiel_id = $spiel_id;
     $this->spiel = new Spiel($this->spiel_id);
     $this->user = new User(User::getNameById($this->uid));
     $this->loadFromDatabase();
 }
Ejemplo n.º 3
0
 /**
  * 校验用户名
  */
 public function validateUserName($attribute, $params)
 {
     $count = User::model()->count("user_name = :user_name", array(":user_name" => $this->user_name));
     $user_name = User::getNameById(Yii::app()->user->id);
     if ($count > 0 && $user_name != $this->user_name && Yii::app()->controller->getAction()->getId() != "changelogin" && Yii::app()->controller->getAction()->getId() != "initpassword" && Yii::app()->controller->getAction()->getId() != "updateuser") {
         $this->addError($attribute, '用户名已经存在');
         return false;
     }
 }
Ejemplo n.º 4
0
 /**
  * @return string the hyperlink display for the current comment's author
  */
 public function getAuthorLink()
 {
     $url = Yii::app()->createUrl('/set/profile', array('id' => $this->author));
     $author = User::getNameById($this->author);
     if (!empty($url)) {
         return CHtml::link(CHtml::encode($author), $url);
     } else {
         return CHtml::encode($author);
     }
 }
Ejemplo n.º 5
0
 public function createLog($user_id)
 {
     $model = new SysLog();
     $time = time();
     $model->user_id = $user_id;
     $model->user_name = User::getNameById($user_id);
     $model->log_time = $time;
     $model->message = "登陆成功!";
     $model->log_ip = Yii::app()->request->userHostAddress;
     if (SysLog::model()->count("user_id=:user_id and log_time=:log_time", array(":user_id" => $user_id, ":lig_time" => $time)) == 0) {
         $model->save();
     }
 }
Ejemplo n.º 6
0
 /**
  * Displays the contact page
  */
 public function actionContact()
 {
     $model = new Contact();
     $model->unsetAttributes();
     if (isset($_POST['Contact'])) {
         if (!Yii::app()->user->isGuest) {
             $model->name = User::getNameById(Yii::app()->user->id);
             $model->email = Yii::app()->user->email;
         }
         $model->attributes = $_POST['Contact'];
         if ($model->validate() && $model->save()) {
             $headers = "From: {$model->email}\r\nReply-To: {$model->email}";
             mail(Yii::app()->params['adminEmail'], $model->subject, $model->body, $headers);
             Yii::app()->user->setFlash('contact', '感谢您的意见,我会尽快回复!');
             $this->refresh();
         } else {
             //var_dump($model->errors);
         }
     }
     $this->render('contact', array('model' => $model));
 }
Ejemplo n.º 7
0
        return Redirect::to('user/' . Input::get('name'));
    }
});
Route::post('timer', function () {
    $vRules = array('name' => 'required');
    $userRepo = new RepositoryUser();
    $username = $userRepo->getUserById(Input::get('id'))->name;
    $validator = Validator::make(Input::all(), $vRules);
    if ($validator->fails()) {
        $msg = $validator->messages();
        return Redirect::to('user/' . $username);
    } else {
        $start_time = time();
        $hours = intval(Input::get('hours'));
        $minutes = intval(Input::get('minutes'));
        $end_time = $start_time + 60 * $minutes + 3600 * $hours;
        $timer = new Timer();
        $timer->user_id = Input::get('id');
        $timer->start_time = $start_time;
        $timer->end_time = $end_time;
        $timer->name = Input::get('name');
        $timer->save();
        return Redirect::to('user/' . $username);
    }
});
Route::post('user', function () {
    return Redirect::to('user/' . Input::get('name'));
});
Route::get('test/{id}', function ($id) {
    return User::getNameById($id);
});
Ejemplo n.º 8
0
 /**
  * 获取JSON Portal数据
  */
 public static function getJSONData()
 {
     $criteria = new CDbCriteria();
     $criteria->order = 'create_time desc';
     $criteria->condition = '(to_uid = :to_uid and remind_flag = :to_remind_flag and delete_flag != :to_delete_flag)';
     $criteria->params = array(':to_uid' => Yii::app()->user->id, ':to_remind_flag' => self::$msg_stauts['to']['unread_remind_flag'], ':to_delete_flag' => self::$msg_stauts['to']['unread_delete_flag']);
     $models = self::model()->findAll($criteria);
     $data = array();
     foreach ($models as $model) {
         $data[] = array('content' => $model->content, 'createUser' => User::getNameById($model->create_user), 'createTime' => Comment::model()->timeintval($model->create_time), 'dataUrl' => Yii::app()->controller->createUrl("dialogue", array("id" => $model->create_user)));
     }
     return CJSON::encode($data);
 }
Ejemplo n.º 9
0
    .content{margin: 0 auto; width: 1030px; }
    .main-content{padding: 25px 0 50px 0;}
    .content .content-left{width: 690px; float: left;}
    /*右侧样式*/
    .content .content-right{width: 260px; float: right;}
    .content .content-right .content-sidebar h5{text-align: left;padding: 0; margin: 0;}
</style>
<?php 
$this->pageTitle = "私信 - " . Yii::app()->name;
?>
<div class="content clearfix">
    <div class="main-content">
        <div class="content-left">
            <fieldset>
                <legend style="margin-bottom:10px;font-size:15px;">我和<b> <?php 
echo User::getNameById($_GET["id"]);
?>
 </b> 的私信对话 共 <b class="total"><?php 
echo $total;
?>
</b> 条<a class="btn  btn-info btn-mini <?php 
echo Yii::app()->user->isGuest ? 'noLogin' : 'CreteMessage';
?>
" href="<?php 
echo isset($_GET["type"]) ? $this->createUrl('/default/notify', array("type" => "message")) : $this->createUrl('/default/inbox');
?>
" style="margin-top:10px;margin-right:5px;float:right;" href="javascript::">返回列表</a></legend>
            </fieldset>
            <div class="list-content">
                <?php 
echo $this->renderPartial('../_dialogue', array('model' => $data), true, false);
Ejemplo n.º 10
0
 public static function replyList($array, $padding = 60, $left = 20)
 {
     if (empty($array)) {
         return false;
     }
     foreach ($array as $key) {
         $result .= '<a name="sys_comment_' . $key['id'] . '"></a>';
         $result .= '<div class="comment-reply" style="border-top:1px dashed #ccc;position:relative;padding:10px 0  10px 60px;padding-left:' . $padding . 'px;"><a  href="' . Yii::app()->controller->createUrl('default/userinfo', array('user_id' => $key['reply_user'])) . '"  class="user-label" data-id="' . $key['reply_user'] . '" target="_blank" style="font-weight:bold;"><img src="' . Yii::app()->controller->createUrl('default/getimage', array('id' => $key['create_user'], 'type' => 'avatar')) . '" width="34" height="34" style="border:none;position: absolute;left:' . $left . 'px;top: 10px;"></a>' . ' <div><a  href="' . Yii::app()->controller->createUrl('default/userinfo', array('user_id' => $key['reply_user'])) . '"  class="user-label" data-id="' . $key['reply_user'] . '" target="_blank" style="font-weight:bold;">' . User::getNameById($key["reply_user"]) . '</a> 回复 <a href="' . Yii::app()->controller->createUrl('default/userinfo', array('user_id' => $key['create_user'])) . '"  class="user-label" data-id="' . $key['create_user'] . '" target="_blank"  style="font-weight:bold;">' . User::getNameById($key["create_user"]) . '</a> :' . $key['content'] . '<a class="pull-right reply" style="padding-right:16px;display:none;" id="' . $key["id"] . '">回复</a>';
         $result .= "<div>" . Comment::timeintval($key['create_time']);
         if (Yii::app()->user->name == "admin" || $key['model'] == "comment" && $key['pk_id'] == Yii::app()->user->id || Comment::model()->getIsCreateUser($key['pk_id'], $key['model'])) {
             $result .= '<a  href="#" title="删除" data-name="' . (Yii::app()->user->isGuest ? 'noLogin' : 'delete-reply') . '"  data-value="' . $key['id'] . '" style="float:right;margin-right:20px;display: none;">删除</a>';
         }
         if ($key['model'] != "comment" || $key['model'] == "comment" && $key['pk_id'] == Yii::app()->user->id && Yii::app()->controller->getAction()->getId() == "personal") {
             $result .= '<a user-value="' . $key['create_user'] . '" data-value="' . $key['id'] . '"  data-page="' . $_GET["page"] . '" href="" title="回复" name-value="' . User::getNameById($key['create_user']) . '" data-name="' . (Yii::app()->user->isGuest ? 'noLogin' : 'reply-comment') . '" style="float:right;margin-right:20px;display: none;">回复</a>';
         }
         $result .= '</div>';
         $result .= "</div></div>";
         $result .= self::replyList($key["chrildren"], $padding > 100 ? $padding : $padding + 40, $left > 80 ? $left : $left + 40);
     }
     return $result;
 }
Ejemplo n.º 11
0
        <div class="dialogue" style="width:100%;">
            <div class="dialogue-talk">
                <div class="talk-list clearfix">
                    <div class="item clearfix" style="margin-bottom: 10px;position: relative;"> 
                        <div class="user" style="width:6%;float: <?php 
        echo $v['is_me_send'] ? "right " : "left";
        ?>
;">      
                            <div class="u-icon"><a title="查看TA的个人信息" href="<?php 
        echo $this->createUrl("userinfo", array("user_id" => $v['create_user']));
        ?>
" target="_blank"><img height="50" width="50" src="<?php 
        echo $this->createUrl("getimage", array("id" => $v['create_user'], "type" => "avatar"));
        ?>
"  alt="<?php 
        echo User::getNameById($v['create_user']);
        ?>
"> </a>      
                            </div>      
                        </div>  
                        <div class="clearfix box-section" style="float:<?php 
        echo $v['is_me_send'] ? "right;margin-right:10px " : "left";
        ?>
">
                            <div class="clearfix  <?php 
        echo $v['is_me_send'] ? "left" : "right";
        ?>
  popover-style">
                                <div class="arrow" style="top:20px;"></div>
                                <div class="popover-content"> 
                                    <a class="msg_icon_close icon-close-2" action-type="delMessage" action-data-id="<?php 
Ejemplo n.º 12
0
		<div id="logo"><?php 
echo CHtml::encode(Yii::app()->name);
?>
</div>
		<div id="search">
			<form action="<?php 
echo Yii::app()->createURL('/post/search');
?>
" method="POST">
				<input placeholder="站内搜索" name="keyword" />
				<input type="submit" value="确认">
			</form>
		</div>
		<div id="mainmenu">
		<?php 
$this->widget('zii.widgets.CMenu', array('items' => array(array('label' => '主頁', 'url' => array('/post/index')), array('label' => '標籤', 'url' => array('/post/tags')), array('label' => '聊起來', 'url' => array('/chat/index')), array('label' => '關於', 'url' => array('/site/page', 'view' => 'about')), array('label' => '聯繫我們', 'url' => array('/site/contact')), array('label' => '個人主頁', 'url' => array('/set/profile'), 'visible' => !Yii::app()->user->isGuest), array('label' => '登陸', 'url' => array('/site/login'), 'visible' => Yii::app()->user->isGuest), array('label' => '註冊', 'url' => array('/site/regist'), 'visible' => Yii::app()->user->isGuest), array('label' => '退出 (' . User::getNameById(Yii::app()->user->id) . ')', 'url' => array('/site/logout'), 'visible' => !Yii::app()->user->isGuest), array('label' => '管理权限', 'url' => array('/srbac/authitem/assign'), 'visible' => Yii::app()->user->isAdmin))));
?>
		</div><!-- mainmenu -->

	</div><!-- header -->

	<?php 
$this->widget('zii.widgets.CBreadcrumbs', array('links' => $this->breadcrumbs));
?>
<!-- breadcrumbs -->
	<div class="panel panel-info online">
		<div class="panel-heading">在线<br><em><?php 
echo User::getOnlineNum();
?>
</em>人</div>
		<div class="panel-body">
Ejemplo n.º 13
0
 public function renderArticleVoteDiv($data, $row)
 {
     $articleModel = Article::model()->findByPk($data->pk_id);
     $comment = Comment::model()->find("pk_id=:pk_id and model=:model order by create_time desc", array(":pk_id" => $articleModel->id, ":model" => "article"));
     $userID = $comment == NULL ? $articleModel->create_user : $comment->user_id;
     $avatarUrl = $this->createUrl("default/getimage", array("id" => $userID, "type" => "avatar"));
     $userUrl = $this->createUrl("default/userinfo", array("user_id" => $userID));
     $viewUrl = $this->createUrl('default/article', array('id' => $articleModel->id));
     $topicArray = array();
     $topicArray = explode(",", trim($articleModel->topic_ids, ","));
     for ($i = 0; $i < count($topicArray); $i++) {
         $topicModel = Topic::model()->findByPk($topicArray[$i]);
         $topicUrl = $this->createUrl('default/topic', array('id' => $topicModel->id));
         $topLabel .= "<a href='" . $topicUrl . "' class='topic-label' data-id='" . $topicModel->id . "' title='" . $topicModel->name . "' style='margin-right:4px;'><span class='label'>" . $topicModel->name . "</a></a>";
     }
     $count = Comment::model()->count("pk_id=:pk_id and model=:model and parent_id=0", array(":pk_id" => $articleModel->id, ":model" => "article"));
     $class = $count != 0 ? "upvote" : "upvote danger";
     $desc = $comment == NULL ? Comment::timeintval($articleModel->create_time) . "发布" : Comment::timeintval($comment->create_time) . "评论";
     $html = '<div class="post">';
     $html .= '<a class="upvote"  href="' . $viewUrl . '" target="_blank" title="' . $data->num . '个人觉得很赞" rel="tooltip"><i class="icon icon-arrow-up-2"></i><span class="vote-count">' . $data->num . '</span></a>';
     $html .= '<a class="' . $class . '" href="' . $viewUrl . '" target="_blank" title="' . $count . '条评论" rel="tooltip"><i class="icon-bubble"></i><span class="vote-count">' . $count . '</span></a>';
     $html .= '<a class="upvote" href="' . $viewUrl . '" target="_blank" title="' . $articleModel->view_count . '个访问量" rel="tooltip"><i class="icon-eye-2"></i><span class="vote-count">' . $articleModel->view_count . '</span></a>';
     $html .= '<div class="url"><span class="ellipsis description"><a class="user-label" href="javascript:;" data-id="' . $userID . '" style="margin-right:10px;">' . User::getNameById($userID) . '</a> ' . $desc . '</span><div><a class="post-url title" href="' . $viewUrl . '" target="_blank" title="' . $articleModel->subject . '">' . $articleModel->subject . '</a>' . $topLabel . '</div></div>';
     //   $html .= '<a href="' . $viewUrl . '" target="_blank" class="view-discussion" title="浏览量"><i class="icon-eye-2"></i><p class="comment-count">' . $articleModel->view_count . '</p></a>';
     //$html .= '<a href="' . $viewUrl . '" target="_blank" class="view-discussion" title="回答数"><i class="icon-bubble"></i><p class="comment-count">' . Comment::model()->count("pk_id=:pk_id and parent_id=0 and model=:model order by create_time desc", array(":pk_id" => $articleModel->id, ":model" => "article")) . '</p></a>';
     $html .= '<div class="user-image-holder"><a class="user-label" href="javascript:;" data-id="' . $userID . '"><img alt="' . User::getNameById($userID) . ' - ' . $this->title . '" class="twitter-rounded user-image" height="30" src="' . $avatarUrl . '" width="30"></a></div>';
     $html .= '</div>';
     return $html;
 }
Ejemplo n.º 14
0
<div class="post">
	<img class="avatar" src="<?php 
echo Profile::avatarByUserId($data->author_id);
?>
" />
	<div class="title">
		<?php 
echo CHtml::link(CHtml::encode($data->title), $data->url);
?>
	</div>
	<div class="author">
		發佈人:<a href="<?php 
echo Yii::app()->createUrl('/set/profile', array('id' => $data->author_id));
?>
"><?php 
echo User::getNameById($data->author_id) . '</a> 發佈時間:' . date('F j, Y', $data->create_time);
?>
	</div>
	<div class="content">
		<?php 
$this->beginWidget('CMarkdown', array('purifyOutput' => true));
echo $data->content;
$this->endWidget();
?>
	</div>
	<div class="nav">
		<b>標籤:</b>
		<?php 
echo implode(', ', $data->tagLinks);
?>
		<br/>
Ejemplo n.º 15
0
     $(this).text("赞同");
 });
 $(document).delegate("a[name='agreeeAnswer']", 'click', function() {
     var self = $(this);
     var pk_id = self.attr("data-pk");
     var model = self.attr("data-model");
     $.post(agreeVoteUrl, {'pk_id': pk_id, 'model': model}, function(data) {
         if (data.message == "ok") {
             self.toggleClass("active");
             self.parent().find(".icon-arrow-down").parent().removeClass("active");
             self.find(".count").text(data.count);
             if (self.attr("data-original-title") == "赞同") {
                 self.attr("data-original-title", "取消赞同");
                 self.parent().find(".icon-arrow-down").parent().attr("data-original-title", "反对");
                 var someVotes = self.parents(".vote-number").next().find(".vote-info");
                 var aHtml = "<a href='javascript:;' class='user-label' data-value='<?php echo Yii::app()->user->id ?>' data-id='<?php echo Yii::app()->user->id ?>'><?php echo User::getNameById(Yii::app()->user->id); ?></a>";
                 if (someVotes.find("a[data-value='" +<?php echo Yii::app()->user->id; ?> + "']").length == 0) {
                     if (someVotes.find("a").length == 0) {
                         someVotes.text('');
                         someVotes.append(aHtml);
                         someVotes.append(" <a href='javascript:;' class='some'>赞同</a>");
                     } else {
                         someVotes.find('.vote-some').append(aHtml + "<span>、</span>");
                         someVotes.find('.vote-some').find("a[data-value='" +<?php echo Yii::app()->user->id; ?> + "']").next().insertBefore(someVotes.find('.vote-some').find("a:eq(0)"));
                         someVotes.find('.vote-some').find("a[data-value='" +<?php echo Yii::app()->user->id; ?> + "']").insertBefore(someVotes.find('.vote-some').find("a:eq(0)").prev());
                         someVotes.find('.vote-all').append(aHtml + "<span>、</span>");
                         someVotes.find('.vote-all').find("a[data-value='" +<?php echo Yii::app()->user->id; ?> + "']").next().insertBefore(someVotes.find('.vote-all').find("a:eq(0)"));
                         someVotes.find('.vote-all').find("a[data-value='" +<?php echo Yii::app()->user->id; ?> + "']").insertBefore(someVotes.find('.vote-all').find("a:eq(0)").prev());
                     }
                 }
             } else {
Ejemplo n.º 16
0
    if (empty($comment)) {
        echo "<div class='alert alert-block alert-info'>暂无点评排行榜.</div>";
    } else {
        foreach ($comment as $k) {
            $i++;
            if ($i == 6) {
                break;
            }
            ?>
            <ul style="padding-left: 6px;">
                <li style="position: relative;border-bottom:1px dotted #ccc;height: 30px;line-height: 30px;"><b class="T_total" style="margin-right:10px;"><?php 
            echo "第" . $i . "名";
            ?>
</b><a  target="_blank" href="<?php 
            echo $this->createUrl('default/userinfo', array('user_id' => $k['user_id']));
            ?>
" title="<?php 
            echo '查看' . User::getNameById($k['user_id']) . '信息';
            ?>
"><b><?php 
            echo User::getNameById($k['user_id']);
            ?>
</b></a><span style="position:absolute;right:0;">共<b class="T_total"><?php 
            echo $k['num'];
            ?>
</b>条点评</span></li>
            </ul>
        <?php 
        }
    }
}
Ejemplo n.º 17
0
$i = 0;
?>
    <?php 
if (!empty($requestion)) {
    ?>
        <div class="pull-left" style="height: 30px;line-height: 30px;margin-left: 4px;">
            您已经邀请
            <?php 
    foreach ($requestion as $key => $value) {
        $i++;
        ?>
                <a class="user-label" href="javascript:;" data-id="<?php 
        echo $value->to_user;
        ?>
"><?php 
        echo User::getNameById($value->to_user);
        ?>
</a>
                <?php 
        echo $i != count($requestion) ? "、" : "";
        ?>
        <?php 
    }
    ?>
        </div>
    <?php 
}
$this->endWidget();
?>
</div><!-- form -->
<script>
Ejemplo n.º 18
0
<?php

$this->renderPartial('_focus', array('ffocus' => $ffocus, 'tfocus' => $tfocus, 'model' => $user));
$this->widget('bootstrap.widgets.TbButton', array('label' => '關注', 'type' => "info", 'visible' => !$isFocus, 'url' => 'javascript:void(0);', 'htmlOptions' => array('style' => 'float:right;', 'class' => 'focus')));
$this->widget('bootstrap.widgets.TbButton', array('label' => '已關注', 'type' => "info", 'visible' => $isFocus, 'url' => 'javascript:void(0);', 'htmlOptions' => array('style' => 'float:right;', 'class' => 'cancel')));
?>
<div class="fans-body">
	<div class="page-header">
	    <h1><?php 
echo User::getNameById($user->id);
?>
 的<?php 
echo $type;
?>
 <small>(<?php 
echo Focus::$typefocus($user->id);
?>
)</small></h1>
	</div>
    <ul class="media-list">
    	<?php 
$this->widget('zii.widgets.CListView', array('dataProvider' => $model, 'itemView' => $typefocus == "countFfocus" ? '_list' : '_listfans', 'template' => "{items}\n{pager}"));
?>
    </ul>
</div>

<?php 
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl . "/static/js/focus.js", 2);
Ejemplo n.º 19
0
                if (data.message == "ok") {
                    self.toggleClass("active");
                    self.parent().find(".icon-arrow-down").parent().removeClass("active");
                    self.find(".count").text(data.count);
                    if (self.attr("data-original-title") == "赞同") {
                        self.attr("data-original-title", "取消赞同");
                        self.parent().find(".icon-arrow-down").parent().attr("data-original-title", "反对");
                        var someVotes = self.parents(".vote-number").next().find(".vote-info");
                        var aHtml = "<a href='javascript:;' class='user-label' data-value='<?php 
echo Yii::app()->user->id;
?>
' data-id='<?php 
echo Yii::app()->user->id;
?>
'><?php 
echo User::getNameById(Yii::app()->user->id);
?>
</a>";
                        if (someVotes.find("a[data-value='" +<?php 
echo Yii::app()->user->id;
?>
 + "']").length == 0) {
                            if (someVotes.find("a").length == 0) {
                                someVotes.text('');
                                someVotes.append(aHtml);
                                someVotes.append(" <a href='javascript:;' class='some'>赞同</a>");
                            } else {
                                someVotes.find('.vote-some').append(aHtml + "<span>、</span>");
                                someVotes.find('.vote-some').find("a[data-value='" +<?php 
echo Yii::app()->user->id;
?>
Ejemplo n.º 20
0
        ?>
 
        <li>
            <div class="pic">
                <a  class="user-label clearfix" href="javascript:;" data-id="<?php 
        echo $value->id;
        ?>
">
                    <img height="50" width="50"  src="<?php 
        echo $this->createUrl("getimage", array("id" => $value->id, "type" => "avatar"));
        ?>
" alt="<?php 
        echo User::getNameById($value->id) . " - " . $this->title;
        ?>
"> 
                </a>
            </div>
            <div class="name">
                <a   class="user-label clearfix" href="javascript:;" data-id="<?php 
        echo $value->id;
        ?>
"><?php 
        echo User::getNameById($value->id);
        ?>
</a>
            </div>
        </li>
        <?php 
    }
    echo "</ul>";
}
Ejemplo n.º 21
0
                            $requestModel = Request::model()->findByPk($data->pk_id);
                            $questionModel = Question::model()->findByPk($requestModel->question_id);
                            echo Yii::app()->user->id != $requestModel->to_user ? str_replace("你", CHtml::tag("img", array("style" => "margin:0 4px;", "height" => "20", "width" => "20", "src" => $this->createUrl("getimage", array("id" => $requestModel->to_user, "type" => "avatar")))) . CHtml::link(User::getNameById($requestModel->to_user), array("default/userinfo", 'user_id' => $requestModel->to_user), array('data-id' => $requestModel->to_user, 'class' => 'user-label', 'target' => '_blank')), $data->content) : $data->content;
                            $this->widget('bootstrap.widgets.TbButton', array('type' => 'info', 'label' => strlen($questionModel->title) > 40 ? mb_substr($questionModel->title, 0, 40, 'utf-8') . '...' : $questionModel->title, 'type' => 'link', 'url' => $this->createUrl("question", array("id" => $questionModel->id))));
                        } else {
                            if ($data->notification_type == "question") {
                                $answerModel = Answer::model()->findByPk($data->pk_id);
                                $questionModel = Question::model()->findByPk($answerModel->question_id);
                                echo Yii::app()->user->id != $questionModel->create_user ? str_replace("你", CHtml::tag("img", array("style" => "margin:0 4px;", "height" => "20", "width" => "20", "src" => $this->createUrl("getimage", array("id" => $questionModel->create_user, "type" => "avatar")))) . CHtml::link(User::getNameById($questionModel->create_user), array("default/userinfo", 'user_id' => $questionModel->create_user), array('data-id' => $questionModel->create_user, 'class' => 'user-label', 'target' => '_blank')), $data->content) : $data->content;
                                $this->widget('bootstrap.widgets.TbButton', array('type' => 'info', 'label' => strlen($questionModel->title) > 40 ? mb_substr($questionModel->title, 0, 40, 'utf-8') . '...' : $questionModel->title, 'type' => 'link', 'url' => $this->createUrl("answer", array("id" => $answerModel->id))));
                            } else {
                                if ($data->notification_type == "comment") {
                                    $commentModel = Comment::model()->findByPk($data->pk_id);
                                    $parentModel = Comment::model()->findByPk($commentModel->parent_id);
                                    $dataUrl = Yii::app()->controller->createUrl($commentModel->model, array("id" => $commentModel->pk_id, "pk_id" => $data->id));
                                    echo Yii::app()->user->id == $parentModel->user_id ? str_replace("你", CHtml::tag("img", array("style" => "margin:0 4px;", "height" => "20", "width" => "20", "src" => $this->createUrl("getimage", array("id" => $parentModel->user_id, "type" => "avatar")))) . CHtml::link(User::getNameById($parentModel->user_id), array("default/userinfo", 'user_id' => $parentModel->user_id), array('data-id' => $parentModel->user_id, 'class' => 'user-label', 'target' => '_blank')), $data->content) : $data->content;
                                    $this->widget('bootstrap.widgets.TbButton', array('type' => 'info', 'label' => strlen($parentModel->content) > 40 ? mb_substr($parentModel->content, 0, 40, 'utf-8') . '...' : $parentModel->content, 'type' => 'link', 'url' => $dataUrl));
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
?>
</span><span class="profile-setion-time pull-right"><?php 
echo Comment::model()->timeintval($data->send_time);
?>
</span>
Ejemplo n.º 22
0
 public function checkPermanentLogin()
 {
     if (!isset($_COOKIE['login_token'])) {
         return;
     }
     $regex = '/^[0-9a-f]{64}[0-9]{1,5}$/';
     if (!preg_match($regex, $_COOKIE['login_token'])) {
         return;
     }
     $series = substr($_COOKIE['login_token'], 0, 32);
     $token = substr($_COOKIE['login_token'], 32, 32);
     $uid = (int) substr($_COOKIE['login_token'], 64);
     $db = Database::getDbObject();
     $stmt = $db->prepare("SELECT `token`, `valid` FROM `login_token` WHERE `uid` = ? AND `series` = ?;");
     $stmt->bind_param('is', $uid, $series);
     if (!$stmt->execute()) {
         return;
     }
     $stmt->store_result();
     if ($stmt->num_rows < 1) {
         return;
     }
     $dbtoken = null;
     $valid = null;
     $stmt->bind_result($dbtoken, $valid);
     $stmt->fetch();
     if ($token === $dbtoken) {
         // valid: Login user
         $valid = new DateTime($valid);
         $now = new DateTime();
         if ($valid < $now) {
             $stmt = $db->prepare("DELETE FROM `login_token` WHERE `uid` = ? AND `series` = ?;");
             $stmt->bind_param('is', $uid, $series);
             $stmt->execute();
         } else {
             $username = User::getNameById($uid);
             $user = new User($username);
             $this->login = true;
             $this->userName = $user->getName();
             $newtoken = $this->token();
             $stmt = $db->prepare("UPDATE `login_token` SET `token` = ? WHERE `uid` = ? AND `series` = ?;");
             $stmt->bind_param('sis', $newtoken, $uid, $series);
             if ($stmt->execute()) {
                 $exp = $valid->format('U');
                 setcookie('login_token', $series . $token . $newtoken, $exp, TIPPSPIEL_CONF_PATH, TIPPSPIEL_CONF_DOMAIN, false, true);
             }
         }
     } else {
         // invalid: inform the user
         $this->errno = 1;
         $this->error = 'Anscheinend wurde Ihr Login-Cookie gestohlen. Aus Sicherheitsgründen wurden Sie ausgelogt' . '. Sollte dieser Fehler weiterhin auftreten, überprüfen Sie bitte Ihren Rechner auf Schadprogramme.';
         $stmt = $db->prepare("DELETE FROM `login_token` WHERE `uid` = ?;");
         $stmt->bind_param('i', $uid);
         $stmt->execute();
     }
 }
Ejemplo n.º 23
0
        ?>
" alt="<?php 
        echo User::getNameById($userId[$i]) . " - " . $this->title;
        ?>
"> 
                                            </a>
                                        </div>
                                        <div class="name">
                                            <a  title="<?php 
        echo User::getNameById($userId[$i]) . " - " . $this->title;
        ?>
" target="_blank" href="<?php 
        echo $this->createUrl('default/userinfo', array('user_id' => $userId[$i]));
        ?>
"><?php 
        echo User::getNameById($userId[$i]);
        ?>
</a>
                                        </div>
                                    </li>
                                <?php 
    }
    ?>
                            <?php 
}
?>
                        </ul>   
                    </div>
                </div> 
            </div>
        </div>
Ejemplo n.º 24
0
?>
">
            <span class="user-name"><?php 
echo User::getNameById($data->from_user);
?>
</span>
        </a>
       <?php 
if ($this->getAction()->getId() == "personal" || $this->getAction()->getId() == "userinfo" && $data->from_user == Yii::app()->user->id) {
    ?>
        <a class="remove-visit icon-close-2" action-type="delVisit" action-data-id="<?php 
    echo $data->id;
    ?>
"  href="javascript:;" title="删除"></a>
       <?php 
}
?>
    </div>
    <div class="name">
        <a  title="<?php 
echo User::getNameById($data->from_user) . " - " . $this->title;
?>
" target="_blank" href="<?php 
echo $this->createUrl('default/userinfo', array('user_id' => $data->from_user));
?>
"><?php 
echo Comment::timeintval($data->create_time, 'n月j日');
?>
</a>
    </div>
</div>
Ejemplo n.º 25
0
					<br><br>
				</div>
			<?php 
    }
    ?>

			<?php 
    if ($action->type == 'like') {
        ?>
				<div>
					<p>
						L'utilisateur <a href="<?php 
        echo WEBROOT . 'channel/' . User::find($action->user_id)->getMainChannel()->id;
        ?>
"><?php 
        echo User::getNameById($action->user_id);
        ?>
</a>
						a aimé votre vidéo <a href="<?php 
        echo WEBROOT . 'watch/' . $action->target;
        ?>
"><?php 
        echo Video::find($action->target)->title;
        ?>
</a>
					</p>
					<p><?php 
        echo Utils::relative_time($action->timestamp);
        ?>
</p>
					<br><br>
Ejemplo n.º 26
0
    echo $commentCount;
    ?>
条评论"><i class="icon-bubble-dots-4" style="margin-right: 4px;"></i><?php 
    echo $commentCount;
    ?>
</a>
                        <span class="pull-right">
                            <?php 
    if ($commentCount > 0) {
        $commentModel = Comment::model()->find("pk_id=:pk_id and model=:model and parent_id=0 order by create_time desc", array(":model" => "answer", ":pk_id" => $answerModel->id));
        ?>
                                <a class="user-label" href="javascript:;" data-id="<?php 
        echo $commentModel->user_id;
        ?>
"><?php 
        echo User::getNameById($commentModel->user_id);
        ?>
</a>
                                <?php 
        echo Comment::timeintval($commentModel->create_time) . "评论";
        ?>
                                <?php 
    } else {
        echo "暂无评论";
    }
    ?>
                        </span>
                    </p>
                <?php 
}
?>
Ejemplo n.º 27
0
 public static function getUserById($id)
 {
     return User::getNameById(self::model()->findByPk($id)->user_id);
 }
Ejemplo n.º 28
0
</p>
                            <p class="comment-content clearfix"> 
                                <?php 
if (Yii::app()->user->name == "admin" || $data->model == "comment" && $data->pk_id == Yii::app()->user->id || Comment::model()->getIsCreateUser($data->pk_id, $data->model)) {
    ?>
                                <?php 
    $this->widget('bootstrap.widgets.TbButton', array('label' => '删除', 'size' => 'small', 'icon' => 'icon-remove-2', 'block' => true, 'buttonType' => 'link', 'url' => '', 'htmlOptions' => array('style' => 'width:70px;float:right;margin-left:10px;margin-top:0 !important;', 'data-name' => Yii::app()->user->isGuest ? 'noLogin' : 'delete-comment', "data-value" => $data->id)));
    ?>
                                 <?php 
}
?>
                                 <?php 
if ($data->model != "comment" || $data->model == "comment" && $this->getAction()->getId() == "personal") {
    ?>
                                <?php 
    $this->widget('bootstrap.widgets.TbButton', array('label' => '回复', 'size' => 'small', 'icon' => 'icon-bubble-2', 'block' => true, 'htmlOptions' => array('style' => 'width:70px;float:right;margin-top:0 !important;', 'data-name' => Yii::app()->user->isGuest ? 'noLogin' : 'reply-comment', 'data-value' => $data->id, 'user-value' => $data->user_id, 'name-value' => User::getNameById($data->user_id), 'data-page' => $_GET["page"])));
    ?>
                               <?php 
}
?>
                            </p>
                           <?php 
echo Comment::replyList(Comment::model()->getComment($data->id, $data->model, $data->pk_id));
?>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>
Ejemplo n.º 29
0
echo $float;
?>
">
	<a href="<?php 
echo $data->user->url;
?>
" rhref="<?php 
echo Yii::app()->createUrl('/set/info', array('id' => $data->user->id));
?>
" rel="author" data-original-title="" title="">
	    <span class="name">
	    	<img src="<?php 
echo Profile::avatarByUserId($data->user_id);
?>
"/><?php 
echo User::getNameById($data->user_id);
?>
	    </span>
	</a>
	<?php 
echo empty($data->parent_id) ? '' : '回复 ' . Chat::getUserById($data->parent_id);
?>
:
    <span class="content"><?php 
echo $data->content;
?>
</span>
    <span class="time"><?php 
echo date("Y-m-d H:i:s", $data->date);
?>
</span>
Ejemplo n.º 30
0
 function getAuthorNameById($id)
 {
     $user = new User();
     return $user->getNameById($id);
 }