/** * Carries out the specified action */ function perform() { // get the parameters, which have already been validated $this->_userName = Textfilter::filterAllHTML($this->_request->getValue("userName")); $this->_userPassword = $this->_request->getValue("userPassword"); $this->_op = Textfilter::filterAllHTML($this->_request->getValue("op")); // create a plugin manager $pm =& PluginManager::getPluginManager(); // try to authenticate the user $users = new Users(); if (!$users->authenticateUser($this->_userName, $this->_userPassword)) { $this->_view = new AdminDefaultView(); $this->_view->setErrorMessage($this->_locale->tr("error_incorrect_username_or_password")); $this->setCommonData(); $pm->notifyEvent(EVENT_LOGIN_FAILURE, array("user" => $this->_userName)); return false; } // if the user is correct, get and put his or her information in the session $userInfo = $users->getUserInfo($this->_userName, $this->_userPassword); if (!$userInfo) { $this->_view = new AdminDefaultView(); $this->_view->setErrorMessage($this->_locale->tr("error_incorrect_username_or_password")); $this->setCommonData(); $pm->notifyEvent(EVENT_LOGIN_FAILURE, array("user" => $this->_userName)); return false; } $pm->notifyEvent(EVENT_USER_LOADED, array("user" => &$userInfo, "from" => "Login")); //$sessionInfo = $_SESSION["SessionInfo"]; $session = HttpVars::getSession(); $sessionInfo = $session["SessionInfo"]; $sessionInfo->setValue("userInfo", $userInfo); $session["SessionInfo"] = $sessionInfo; HttpVars::setSession($session); // get the list of blogs to which the user belongs $userBlogs = $users->getUsersBlogs($userInfo->getId(), BLOG_STATUS_ACTIVE); // but if he or she does not belong to any yet, we quit if (empty($userBlogs)) { $this->_view = new AdminDefaultView(); $this->_view->setErrorMessage($this->_locale->tr("error_dont_belong_to_any_blog")); $this->setCommonData(); return false; } $pm->notifyEvent(EVENT_BLOGS_LOADED, array("blogs" => &$userBlogs, "from" => "Login")); // check if we are skipping the dashboard if ($this->_config->getValue("skip_dashboard")) { // get the first blog that came $this->_blogInfo = end($userBlogs); // set it in the session $session = HttpVars::getSession(); $session["SessionInfo"]->setValue("blogInfo", $this->_blogInfo); HttpVars::setSession($session); // and then continue... AdminController::setForwardAction("newPost"); } else { $this->_view = new AdminDashboardView($userInfo, $userBlogs); } // better to return true if everything's fine return true; }
function init() { parent::init(); if (zmf::config('closeSite')) { header("Content-type: text/html; charset=utf-8"); exit(zmf::config('closeSiteReason')); } $this->uid = zmf::uid(); if (!Yii::app()->user->isGuest) { $uid = Yii::app()->user->id; $userInfo = Users::getUserInfo($uid); $this->truename = $userInfo['username']; $this->userInfo = $userInfo; } $this->pageTitle = zmf::config('sitename'); self::_referer(); $this->mobileTitle = zmf::config('sitename'); }
public function init() { Yii::app()->language = 'zh_cn'; if (zmf::config('mobile')) { if (tools::checkmobile($this->platform)) { Yii::app()->theme = 'frozen'; $this->isMobile = 'yes'; $this->layout = '//layouts/mobile'; $this->currentModule = 'frozen'; } } if (zmf::uid()) { $this->uid = zmf::uid(); $userInfo = Users::getUserInfo($this->uid); $this->truename = $userInfo['truename']; $this->userInfo = $userInfo; } self::_referer(); }
function init() { parent::init(); if (zmf::config('closeSite')) { header("Content-type: text/html; charset=utf-8"); exit(zmf::config('closeSiteReason')); } $this->uid = zmf::uid(); if ($this->uid) { $uid = $this->uid; $userInfo = Users::getUserInfo($uid); $this->truename = $userInfo['truename']; $this->userInfo = $userInfo; $this->userCode = zmf::jiaMi('zmf#' . $this->uid); } $this->pageTitle = zmf::config('sitename'); $this->mobileTitle = zmf::config('sitename'); if ($this->isMobile == 'yes') { Yii::app()->theme = 'mobile'; } else { Yii::app()->theme = 'naodong'; } self::_referer(); }
<?php if (!$userInfo) { $userInfo = Users::getUserInfo($data['uid']); } $_uname = $userInfo['truename']; $_imgsize = isset($imgsize) ? $imgsize : 170; $formatTime = ''; if ($data['lastupdate'] > $data['cTime']) { $formatTime = '更新于' . tools::formatTime($data['lastupdate']); } else { $formatTime = tools::formatTime($data['cTime']); } $areaInfo = Area::getOneInfo($data['areaid']); $toAreaInfo = Area::getOneInfo($data['toAreaid']); ?> <div class="media <?php echo $noborder == 'yes' ? '' : 'zmf-border-bottom'; ?> "> <div class="media-left"> <?php $this->renderPartial('/common/_user', array('uid' => $data['uid'], 'uname' => $_uname, 'type' => 'a')); ?> </div> <div class="media-body poi-tips-body"> <p class="author"> <?php $this->renderPartial('/common/_user', array('uid' => $data['uid'], 'uname' => $_uname, 'type' => 'l', 'lcss' => '')); ?> <?php
if (!empty($_REQUEST['email']) && empty($_REQUEST['register'])) { //LOGGING IN //LOGGING IN $db = Database::obtain(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE); $db->connect(); $password = $_REQUEST['password']; $email = $_REQUEST['email']; $u = new Users('unknown', BASE_DOMAIN); $login = $u->login($email, $password); //print_r($login); //$avatar = $u->my_avatar($_SESSION['uid']); //sessions set in users class on login //get user data $uid = $_SESSION['uid']; $u = new Users('member', BASE_DOMAIN); $user_info = $u->getUserInfo($uid); //4 is customers, 3 is employee 2 is admin //print_r($user_info); $first = $user_info[0]['first']; $last = $user_info[0]['last']; $email = $user_info[0]['email']; $avatar = $user_info[0]['avatar']; $pwd_reset_code = $user_info[0]['pwd_reset_code']; if ($avatar === "") { $settings_avatar = "<img src=\"img/generic.png\" width=\"50\" class=\"img-circle\" alt=\"User Image\"/>"; } else { $settings_avatar = "<img src=\"avatars/" . $avatar . "\" width=\"50\" class=\"img-circle\" alt=\"User Image\"/>"; } } if (!empty($_SESSION['uid'])) { $first = $_SESSION['first'];
public function actionConfig() { if (Yii::app()->user->isGuest) { $this->message(0, Yii::t('default', 'loginfirst'), Yii::app()->createUrl('site/login'), 1); } $keyid = zmf::uid(); $info = Users::getUserInfo($keyid); if (!$info) { $this->message(0, '该用户不存在,请核实'); } $config = zmf::userConfig($keyid); $data = array('info' => $info, 'config' => $config); $this->pageTitle = '个人设置 - ' . zmf::config('sitename'); $this->render('config', $data); }
/** * 验证用户具体发帖权限,并不影响其他权限 * @param type $uid 验证的用户 * @param type $type 验证的类型 * @param type $field 是否检查总数 * @return type */ public static function check($type, $field = false, $uid = '') { if (!$uid) { $uid = Yii::app()->user->id; } if (!$uid) { if (zmf::config('officalUid')) { return array('status' => 1, 'msg' => ''); } return array('status' => 0, 'msg' => '用户不存在'); } $uinfo = Users::getUserInfo($uid); if (!$uinfo) { return array('status' => 0, 'msg' => '用户不存在'); } if (!$uinfo['groupid']) { return array('status' => 0, 'msg' => '无组织用户'); } $groupInfo = UserPower::model()->find('groupid=:gid', array(':gid' => $uinfo['groupid'])); if (!$groupInfo) { return array('status' => 0, 'msg' => '无组织用户'); } $num = $groupInfo->getAttribute($type); if ($num === null) { return array('status' => 0, 'msg' => '无法完成验证的type:' . $type); } elseif ($num === 0) { return array('status' => 0, 'msg' => '不允许'); } elseif ($field) { switch ($field) { case 'addPost': $totalNum = $groupInfo['postNum']; $hasNum = Posts::model()->count('uid=:uid AND cTime>=:cTime', array(':uid' => $uid, ':cTime' => $ctime)); break; case 'addQuestion': $totalNum = $groupInfo['questionNum']; $hasNum = Question::model()->count('uid=:uid AND cTime>=:cTime', array(':uid' => $uid, ':cTime' => $ctime)); break; case 'addAnswer': $totalNum = $groupInfo['answerNum']; $hasNum = Answer::model()->count('uid=:uid AND cTime>=:cTime', array(':uid' => $uid, ':cTime' => $ctime)); break; case 'addPoiPost': $totalNum = $groupInfo['poiPostNum']; $hasNum = PoiPost::model()->count('uid=:uid AND cTime>=:cTime', array(':uid' => $uid, ':cTime' => $ctime)); break; case 'addPoiTips': $totalNum = $groupInfo['poiTipsNum']; $hasNum = PoiTips::model()->count('uid=:uid AND cTime>=:cTime', array(':uid' => $uid, ':cTime' => $ctime)); break; case 'addImage': $totalNum = $groupInfo['imageNum']; $hasNum = Attachments::model()->count('uid=:uid AND cTime>=:cTime', array(':uid' => $uid, ':cTime' => $ctime)); break; case 'addComment': $totalNum = $groupInfo['commentNum']; $hasNum = Comments::model()->count('uid=:uid AND cTime>=:cTime', array(':uid' => $uid, ':cTime' => $ctime)); break; case 'addPlan': $totalNum = $groupInfo['planNum']; $hasNum = Plans::model()->count('uid=:uid AND cTime>=:cTime', array(':uid' => $uid, ':cTime' => $ctime)); break; case 'yueban': $totalNum = $groupInfo['yuebanNum']; $hasNum = Posts::model()->count('uid=:uid AND cTime>=:cTime', array(':uid' => $uid, ':cTime' => $ctime)); break; } if (!$totalNum) { return array('status' => 1, 'msg' => '无限制'); } else { if ($hasNum >= $totalNum) { return array('status' => 0, 'msg' => '已超出限制:' . $totalNum); } else { return array('status' => 1, 'msg' => ''); } } } else { return array('status' => 1, 'msg' => ''); } }
</span> </div> <p><img src="<?php echo zmf::imgurl($data['logid'], $data['filePath'], 600, $data['classify']); ?> " alt="<?php echo $data['fileDesc']; ?> " width="550px"/></p> <div class="photo_desc"> <p></p> </div> <div class="photo_info"> <span> <?php echo CHtml::link(Users::getUserInfo($data['uid'], 'truename'), array('users/index', 'id' => $data['uid'])); ?> 上传于<?php echo date(zmf::config('dateFormat'), $data['cTime']); ?> ,<a href="<?php echo zmf::imgurl($data['logid'], $data['filePath'], 'origin', $data['classify']); ?> " target="_blank">查看原图</a> </span> <span style="float:right"> <?php if ($data['uid'] == Yii::app()->user->id || Users::checkPower('delattachment', false, true)) { ?> <?php
function getCurrentHashedUId() { $userID = getCurrentClasUserId(); $user = new Users(); $userInfo = $user->getUserInfo(array($userID)); return $userInfo[0]['hash_user_id']; }
/** * 权限判断 * @param type $type 权限名 * @param type $json 是否以json返回 * @param type $return 是否不终止运行 * @return boolean */ public function checkPower($type, $json = false, $return = false) { if (Yii::app()->user->isGuest) { if ($return) { return false; } elseif (!$json and !Yii::app()->request->isAjaxRequest) { T::message(0, Yii::t('default', 'loginfirst'), Yii::app()->createUrl('site/login')); } else { T::jsonOutPut(0, Yii::t('default', 'loginfirst')); } } else { $uid = Yii::app()->user->id; } if ($type == 'login') { return true; } $userinfo = Users::getUserInfo($uid); if (!$userinfo) { if ($return) { return false; } elseif (!$json and !Yii::app()->request->isAjaxRequest) { T::message(0, '不存在的用户,请核实', Yii::app()->createUrl('site/logout')); } else { T::jsonOutPut(0, '不存在的用户,请核实'); } } $gid = $userinfo['groupid']; $groupinfo = UserPower::getInfo($gid); if (!$groupinfo) { if ($return) { return false; } elseif (!$json and !Yii::app()->request->isAjaxRequest) { T::message(0, '您所在用户组不存在,请核实', Yii::app()->createUrl('site/logout')); } else { T::jsonOutPut(0, '您所在用户组不存在,请核实'); } } $power = GroupPowers::model()->findByAttributes(array('powers' => $type), 'gid=:gid', array(':gid' => $gid)); if (!$power) { $power = GroupPowers::model()->findByAttributes(array('powers' => 'all'), 'gid=:gid', array(':gid' => $gid)); } if (!$power) { if ($return) { return false; } elseif (!$json and !Yii::app()->request->isAjaxRequest) { T::message(0, '您所在用户组【' . $groupinfo['title'] . '】无权该操作'); } else { T::jsonOutPut(0, '您所在用户组【' . $groupinfo['title'] . '】无权该操作'); } } return true; }
<?php $_uname = Users::getUserInfo($data['uid'], 'truename'); $_favored = false; if (!Yii::app()->user->isGuest) { if (UserAction::checkAction($data['id'], 'favor' . $type)) { $_favored = true; } } $_imgsize = isset($imgsize) ? $imgsize : 170; $formatTime = ''; if ($data['lastupdate'] > $data['cTime']) { $formatTime = '更新于' . tools::formatTime($data['lastupdate']); } else { $formatTime = tools::formatTime($data['cTime']); } ?> <div class="media <?php echo $noborder == 'yes' ? '' : 'zmf-border-bottom'; ?> "> <div class="media-left"> <?php $this->renderPartial('/common/_user', array('uid' => $data['uid'], 'uname' => $_uname, 'type' => 'a')); ?> <br/> <?php echo CHtml::link($data['favor'], 'javascript:;', array('title' => '此点评对我有帮助', 'class' => 'btn btn-xs btn-' . ($_favored ? 'success' : 'default') . ' btn-block', 'action' => 'favor', 'action-data' => $data['id'], 'action-type' => $type, 'id' => 'favor-' . $type . '-' . $data['id'])); ?> </div> <div class="media-body poi-tips-body">
<?php if ($uid) { if (!$userInfo) { $userInfo = Users::getUserInfo($uid); } } $size = isset($size) ? $size : 'small'; $width = isset($width) ? $width : 34; $acss = isset($acss) ? $acss : ''; //avatar css $lcss = isset($lcss) ? $lcss : ''; //link css if (!isset($userInfo->avatarImg)) { $userInfo->avatarImg = Users::getAvatar($userInfo['avatar']); } if ($type == 'l') { //link echo CHtml::link($userInfo['truename'], array('users/index', 'id' => $userInfo['id']), array('action' => 'card', 'action-type' => 'user', 'action-data' => $userInfo['id'], 'class' => $lcss, 'target' => '_blank')); } elseif ($type == 'a') { //avatar echo CHtml::link(CHtml::image($userInfo->avatarImg, $userInfo['truename'], array('width' => $width, 'class' => $acss)), array('users/index', 'id' => $userInfo['id']), array('action' => 'card', 'action-type' => 'user', 'action-data' => $userInfo['id'], 'class' => $lcss, 'target' => '_blank')); }
public function actionMedia() { $id = tools::val('id'); if (!$id || !is_numeric($id)) { throw new CHttpException(404, 'The requested page does not exist.'); } $userInfo = Users::getUserInfo($id); if (!$userInfo || $userInfo['status'] != Posts::STATUS_PASSED) { throw new CHttpException(404, '您所查看的页面不存在或已删除'); } $criteria = new CDbCriteria(); $criteria->order = 'hits DESC'; // $criteria->select='id,truename,`desc`,avatar,posts,hits'; $criteria->condition = "uid='{$id}' AND status=" . Posts::STATUS_PASSED; $count = Naodong::model()->count($criteria); $pager = new CPagination($count); $pager->pageSize = $this->pageSize; $pager->applyLimit($criteria); $posts = Naodong::model()->findAll($criteria); $posts = self::foreachNaodong($posts); Posts::updateCount($id, 'Users'); $this->pageTitle = $userInfo['truename'] . ' - ' . zmf::config('sitename'); $this->mobileTitle = $userInfo['truename']; $this->pageDescription = $userInfo['desc'] != '' ? $userInfo['desc'] : zmf::config('siteDesc'); $this->render('media', array('pages' => $pager, 'posts' => $posts, 'userInfo' => $userInfo)); }
<?php $_userInfo = Users::getUserInfo($data['uid']); $_uname = $_userInfo['truename']; ?> <div class="media zmf-border-bottom" id="comment_<?php echo $data['id']; ?> "><?php $this->renderPartial('/common/_user', array('uid' => $data['uid'], 'userInfo' => $_userInfo, 'type' => 'a', 'width' => 25, 'lcss' => 'pull-left', 'acss' => 'media-object')); ?> <div class="media-body"><p><?php $this->renderPartial('/common/_user', array('uid' => $data['uid'], 'userInfo' => $_userInfo, 'type' => 'l')); if ($data['tocommentid'] > 0) { $cominfo = Comments::getSimpleInfo($data['tocommentid']); $_cuInfo = Users::getUserInfo($cominfo['uid']); ?> 回复 <?php $this->renderPartial('/common/_user', array('uid' => $cominfo['uid'], 'userInfo' => $_cuInfo, 'type' => 'l')); } ?> </p><p><?php echo zmf::filterOutput($data['content'], true); ?> </p><p class="color-grey"><?php echo tools::formatTime($data['cTime']); ?> <span class="pull-right action-bar"><?php if ($data['uid'] != zmf::uid()) { echo CHtml::link('举报', 'javascript:void(0)', array('onclick' => 'report(' . $data['id'] . ',"comments");')); }
function getUserInfo($args) { $appkeyp = $args[0]; $username = $args[1]; $password = $args[2]; /* "nickname" => "firstname" => "lastname" => "email" => "userid" => "url" => */ $users = new Users(); $erg = $users->getUserInfo($username, $password); if ($erg != false) { $ret = array(); $ret["nickname"] = $erg["_username"]; $ret["firstname"] = $erg["_username"]; $ret["lastname"] = ""; $ret["email"] = $erg["_email"]; $ret["userid"] = $erg["_id"]; $ret["url"] = ""; return $ret; } else { return new IXR_Error(-1, 'You did not provide the correct password'); } }
public function actionConfig() { $keyid = zmf::uid(); if (!$keyid) { $this->redirect(array('site/login')); } $type = zmf::filterInput($_GET['type'], 't', 1); if (!$type || !in_array($type, array('info', 'third', 'avatar'))) { $type = 'info'; } $this->userInfo = Users::getUserInfo($keyid); if (!$this->userInfo) { $this->message(0, '该用户不存在,请核实'); } $data = array('info' => $this->userInfo, 'type' => $type); $this->pageTitle = '个人设置 - ' . zmf::config('sitename'); $this->render('config', $data); }
<?php include 'manager/users.php'; $purchase = $_POST; $username = $_POST['username']; $password = $_POST['password']; $users = new Users(); $user = $users->getUserInfo($username, $password); session_start(); $_SESSION['normalSeats'] = $purchase['normalSeats']; $_SESSION['discountSeats'] = $purchase['discountSeats']; $rows = $user->num_rows; if ($rows == '1') { while ($row = $user->fetch_assoc()) { $_SESSION['usr'] = $row['username']; $_SESSION['pw'] = $row['password']; $_SESSION['loggedin'] = true; $_SESSION['wrongInfo'] = false; echo "<script type='text/javascript'>location.href ='buy.php';</script>"; } } else { if (!empty($username)) { $_SESSION['wrongInfo'] = true; } } ?> <!DOCTYPE html> <html> <head> <title>NOPM | Autobuses de la Mayab</title> <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<tbody> <?php for ($i = 0; $i < count($reports); $i++) { $id = $reports[$i]['id']; $name = $reports[$i]['name']; $location = $reports[$i]['location']; $file_info = $reports[$i]['file_info']; $description = $reports[$i]['description']; $client_id = $reports[$i]['client_id']; //get first and last from users where client_id = id $u = new Users('unkown', BASE_DOMAIN); $user_info = $u->getUserInfo($client_id); //print_r($user_info); if (!empty($user_info)) { $first = $user_info[0]['first']; $last = $user_info[0]['last']; $email = $user_info[0]['email']; } else { $first = ""; $last = ""; $email = ""; } echo "<tr id=\"" . $id . "\">"; // next field client_id //not editable echo "<td>"; echo $first . " " . $last . "<br /> (" . $email . ")";
// let's see what we get... MoblogLogger::log("user = '******'"); // uncomment the following if you want to see passwords... :) //MoblogLogger::log( "pass = "******"'"); MoblogLogger::log("blog id = " . $request->getBlogId()); MoblogLogger::log("topic = " . $request->getTopic()); MoblogLogger::log("reply to = " . $request->getReplyTo()); MoblogLogger::log("body = " . $request->getBody()); // // start processing the message... // // // first, try to authenticate the user // $users = new Users(); $userInfo = $users->getUserInfo($request->getUser(), $request->getPassword()); if (!$userInfo) { $response = new MoblogResponse($request->getReplyTo(), "pLog Moblog: Error", "User or password are not correct."); MoblogLogger::log("User " . $request->getUser() . " did not authenticate correctly."); $response->send(); return false; } // // if user was authenticated, then proceed... and the first thing we should do // is see if the blog id is correct and if the user has permissions in that // blog // $blogs = new Blogs(); if ($request->getBlogId() == "") { // user gave a blog name instead of a blog id $allBlogs = $blogs->getAllBlogs();
<?php $_uname = Users::getUserInfo($data['uid'], 'truename'); ?> <div class="media zmf-border-bottom" id="comment_<?php echo $data['id']; ?> "> <div class="media-body"> <p><?php echo CHtml::link($_uname, array('index/media', 'id' => $data['uid']), array('target' => '_blank')); if ($data['tocommentid'] > 0) { $cominfo = Posts::getSimpleInfo($data['tocommentid'], 'comments'); $_cuname = Users::getUserInfo($cominfo['uid'], 'truename'); ?> 回复 <?php $this->renderPartial('/common/_user', array('uid' => $cominfo['uid'], 'uname' => $_cuname, 'type' => 'l')); } ?> </p> <p><?php echo zmf::filterOutput($data['content'], true); ?> </p> <p class="color-grey"><?php echo tools::formatTime($data['cTime']); ?> </p> </div> </div>
/** * 卡片,包括用户及提到的坐标 */ public function actionCard() { $type = zmf::filterInput($_GET['type'], 't', 1); $id = zmf::filterInput($_POST['id']); if (!$type || !$id) { $this->jsonOutPut(0, '缺少参数'); } if ($type == 'user') { $info = Users::getUserInfo($id); if (!$info) { $this->jsonOutPut(0, '用户不存在'); } if ($id == zmf::uid()) { $itself = 1; } else { $itself = 0; } $favored = 0; if (zmf::uid() && $id != zmf::uid()) { $_info = Favorites::checkFavored($id, 'user'); if ($_info) { $favored = 1; } } $count = Users::getCounts($id, $info); $data = array('avatar' => zmf::avatar($id, 'small', true), 'userurl' => Yii::app()->createUrl('users/index', array('id' => $id)), 'username' => $info['truename'], 'posts' => $count['posts'], 'answers' => $count['answers'], 'tips' => $count['tips'], 'reputation' => $info['reputation'], 'badge' => $info['badge'], 'itself' => $itself, 'favored' => $favored, 'uid' => $id, 'desc' => $info['desc'], 'p_url' => Yii::app()->createUrl('users/index', array('id' => $id, 'type' => 'posts')), 'a_url' => Yii::app()->createUrl('users/index', array('id' => $id, 'type' => 'answer')), 't_url' => Yii::app()->createUrl('users/index', array('id' => $id, 'type' => 'tips'))); } $this->jsonOutPut(1, $data); }