本文整理汇总了PHP中jAuth::getUserSession方法的典型用法代码示例。如果您正苦于以下问题:PHP jAuth::getUserSession方法的具体用法?PHP jAuth::getUserSession怎么用?PHP jAuth::getUserSession使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jAuth
的用法示例。
在下文中一共展示了jAuth::getUserSession方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareTpl
protected function _prepareTpl()
{
$config = new \Jelix\JCommunity\Config();
$this->_tpl->assign('canRegister', $config->isRegistrationEnabled());
$this->_tpl->assign('canResetPassword', $config->isResetPasswordEnabled());
if (jAuth::isConnected()) {
$this->_tpl->assign('login', jAuth::getUserSession()->login);
} else {
$conf = jAuth::loadConfig();
$this->_tpl->assign('persistance_ok', jAuth::isPersistant());
$form = jForms::get("jcommunity~login");
if (!$form) {
$form = jForms::create("jcommunity~login");
}
$this->_tpl->assign('form', $form);
$this->_tpl->assign('url_return', '');
if ($conf['enable_after_login_override']) {
$req = jApp::coord()->request;
if ($req->getParam('auth_url_return')) {
$this->_tpl->assign('url_return', $req->getParam('auth_url_return'));
} else {
if ($this->param('as_main_content')) {
if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] && $_SERVER['HTTP_REFERER'] != jUrl::getCurrentUrl(false, true)) {
$this->_tpl->assign('url_return', $_SERVER['HTTP_REFERER']);
}
} else {
if ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD') {
$this->_tpl->assign('url_return', jUrl::getCurrentUrl(false, true));
}
}
}
}
}
}
示例2: update
/**
*
*/
function update()
{
$id = $this->param('j_user_login');
$pwd = $this->param('pwd');
$pwdconf = $this->param('pwd_confirm');
$rep = $this->getResponse('redirect');
if ($this->personalView && $id != jAuth::getUserSession()->login) {
jMessage::add(jLocale::get('jelix~errors.acl.action.right.needed'), 'error');
$rep->action = 'master_admin~default:index';
return $rep;
}
if (trim($pwd) == '' || $pwd != $pwdconf) {
jMessage::add(jLocale::get('crud.message.bad.password'), 'error');
$rep->action = 'password:index';
$rep->params['j_user_login'] = $id;
return $rep;
}
if (jAuth::changePassword($id, $pwd)) {
jMessage::add(jLocale::get('crud.message.change.password.ok', $id), 'notice');
if ($this->personalView) {
$rep->action = 'user:index';
} else {
$rep->action = 'default:view';
}
$rep->params['j_user_login'] = $id;
return $rep;
} else {
jMessage::add(jLocale::get('crud.message.change.password.notok'), 'error');
$rep->action = 'password:index';
$rep->params['j_user_login'] = $id;
}
return $rep;
}
示例3: index
/**
* Displays a list of project for a given repository.
*
* @param string $repository. Name of the repository.
* @return Html page with a list of projects.
*/
function index()
{
if ($this->param('theme')) {
jApp::config()->theme = $this->param('theme');
}
$rep = $this->getResponse('html');
// Get lizmap services
$services = lizmap::getServices();
// only maps
if ($services->onlyMaps) {
$repository = lizmap::getRepository($services->defaultRepository);
if ($repository && jAcl2::check('lizmap.repositories.view', $repository->getKey())) {
$project = lizmap::getProject($repository->getKey() . '~' . $services->defaultProject);
if ($project) {
// test redirection to an other controller
$items = jEvent::notify('mainviewGetMaps')->getResponse();
foreach ($items as $item) {
if ($item->parentId == $repository->getKey() && $item->id == $services->defaultProject) {
$rep = $this->getResponse('redirectUrl');
$rep->url = $item->url;
return $rep;
}
}
// redirection to default controller
$rep = $this->getResponse('redirect');
$rep->action = 'view~map:index';
return $rep;
}
}
}
// Get repository data
$repository = $this->param('repository');
$repositoryList = array();
if ($repository) {
if (!jAcl2::check('lizmap.repositories.view', $repository)) {
$rep = $this->getResponse('redirect');
$rep->action = 'view~default:index';
jMessage::add(jLocale::get('view~default.repository.access.denied'), 'error');
return $rep;
}
}
$title = jLocale::get("view~default.repository.list.title");
$rep->body->assign('repositoryLabel', $title);
$rep->body->assign('isConnected', jAuth::isConnected());
$rep->body->assign('user', jAuth::getUserSession());
if ($services->allowUserAccountRequests) {
$rep->body->assign('allowUserAccountRequests', True);
}
if ($repository) {
$lrep = lizmap::getRepository($repository);
$title .= ' - ' . $lrep->getData('label');
}
$rep->title = $title;
$rep->body->assignZone('MAIN', 'main_view', array('repository' => $repository));
$rep->addJSCode("\n \$(window).load(function() {\n \$('.liz-project-img').parent().mouseenter(function(){\n var self = \$(this);\n self.find('.liz-project-desc').slideDown();\n self.css('cursor','pointer');\n }).mouseleave(function(){\n var self = \$(this);\n self.find('.liz-project-desc').hide();\n }).click(function(){\n var self = \$(this);\n window.location = self.parent().find('a.liz-project-view').attr('href');\n return false;\n });\n });\n ");
// Js hack to normalize the height of the project thumbnails to avoid line breaks with long project titles
$bp = jApp::config()->urlengine['basePath'];
$rep->addJSLink($bp . 'js/view.js');
return $rep;
}
示例4: sendMail
/**
* Send an email to the members that have subsribe to this post
* @param integer $id of the subscribed post
* @return void
*/
public static function sendMail($id)
{
if (!jAuth::isConnected()) {
return;
}
$dao = jDao::get(self::$daoSub);
$memberDao = jDao::get('havefnubb~member');
//get all the members that subscribe to this thread except "ME" !!!
$records = $dao->findSubscribedPost($id, jAuth::getUserSession()->id);
$gJConfig = jApp::config();
// then send them a mail
foreach ($records as $record) {
//get all the member that subscribe to the thread id $id (called by hfnupost -> savereply )
$thread = jClasses::getService('havefnubb~hfnuposts')->getThread($id);
$post = jClasses::getService('havefnubb~hfnuposts')->getPost($thread->id_last_msg);
//get the email of the member that subscribes this thread
$member = $memberDao->getById($record->id_user);
$subject = jLocale::get('havefnubb~post.new.comment.received') . " : " . $post->subject;
$mail = new jMailer();
$mail->From = $gJConfig->mailer['webmasterEmail'];
$mail->FromName = $gJConfig->mailer['webmasterName'];
$mail->Sender = $gJConfig->mailer['webmasterEmail'];
$mail->Subject = $subject;
$tpl = new jTpl();
$tpl->assign('server', $_SERVER['SERVER_NAME']);
$tpl->assign('post', $post);
$tpl->assign('login', $member->login);
$mail->Body = $tpl->fetch('havefnubb~new_comment_received', 'text');
$mail->AddAddress($member->email);
$mail->Send();
}
}
示例5: create
/**
*
*/
function create()
{
$rep = $this->getResponse('json');
$category_id = $this->intParam('category_id', null, true);
$title = $this->param('title', '', true);
$url = $this->param('url', '', true);
//$description=$this->param('description', '', true);
//insert
if (!empty($url) && !empty($title) && !empty($category_id)) {
$this->msg = 'link non ajouté';
// instanciation de la factory
$tb = jDao::get("link");
// creation d'un record correspondant au dao foo
$record = jDao::createRecord("link");
// on remplit le record
$record->title = $title;
$record->url = $url;
$record->category_id = $category_id;
$record->user_id = jAuth::getUserSession()->id;
// on le sauvegarde dans la base
try {
$tb->insert($record);
$this->success = true;
$this->msg = "Lien ajouté ";
} catch (Exception $e) {
$this->success = false;
$this->msg = "lien non ajouté ";
}
}
$rep->data = array('success' => $this->success, 'msg' => $this->msg);
return $rep;
}
示例6: check
/**
* check if there is a flood
* @param integer $timeInterval time between two actions
* @param integer $onlySameIp true: the flood is checked only between same ip
* @return boolean true if flood is detected
*/
public static function check($timeInterval, $onlySameIp)
{
// since we don't store data of anonymous user, and anonymous user
// are not allowed to post, we don't check
if (!jAuth::isConnected()) {
return false;
}
// check if the user is member of Admins (groupid 0) / Moderators (groupid 3)
// if so, no need to stop the action of this group of users
// FIXME we should check, not the group, but the rights !
foreach (jAcl2DbUserGroup::getGroupList() as $grp) {
if ($grp->id_aclgrp == 'admins' or $grp->id_aclgrp == 'moderators') {
return false;
}
}
$dao = jDao::get('havefnubb~posts');
$rec = $dao->getMyLastEditedPost(jAuth::getUserSession()->id);
if ($rec->member_last_post + $timeInterval > time()) {
return false;
}
if ($onlySameIp && isset($_SERVER['REMOTE_ADDR']) && $rec->poster_ip != $_SERVER['REMOTE_ADDR']) {
return false;
}
return true;
}
示例7: _prepareTpl
protected function _prepareTpl()
{
// Get the project and repository params
$project = $this->param('project');
$repository = $this->param('repository');
$auth_url_return = $this->param('auth_url_return');
if (!$auth_url_return) {
$auth_url_return = jUrl::get('view~map:index', array("repository" => $repository, "project" => $project));
}
// Get lizmapProject class
$assign = array('isConnected' => jAuth::isConnected(), 'user' => jAuth::getUserSession(), 'auth_url_return' => $auth_url_return, "externalSearch" => "", "edition" => false, "measure" => false, "locate" => false, "geolocation" => false, "timemanager" => false, "print" => false, "attributeLayers" => false);
try {
$lproj = lizmap::getProject($repository . '~' . $project);
$configOptions = $lproj->getOptions();
if (property_exists($configOptions, 'externalSearch')) {
$assign['externalSearch'] = $configOptions->externalSearch;
}
} catch (UnknownLizmapProjectException $e) {
jLog::logEx($e, 'error');
}
$this->_tpl->assign($assign);
// Get lizmap services
$services = lizmap::getServices();
if ($services->allowUserAccountRequests) {
$this->_tpl->assign('allowUserAccountRequests', True);
}
}
示例8: _prepareTpl
protected function _prepareTpl()
{
jClasses::inc('masterAdminMenuItem');
$items = jEvent::notify('masteradminGetInfoBoxContent')->getResponse();
usort($items, "masterAdminItemSort");
$this->_tpl->assign('infoboxitems', $items);
$this->_tpl->assign('user', jAuth::getUserSession());
}
示例9: _prepareTpl
protected function _prepareTpl()
{
$id = jAuth::getUserSession()->id;
$title = jLocale::get("jmessenger~message.msg.inbox");
$dao = jDao::get($this->dao);
$msg = $dao->getRecus($id);
$this->_tpl->assign(compact('msg', 'id', 'title'));
}
示例10: _prepareTpl
protected function _prepareTpl()
{
$this->_tpl->assign('login', $this->param('login'));
$this->_tpl->assign('failed', $this->param('failed'));
$this->_tpl->assign('auth_url_return', $this->param('auth_url_return', ''));
$this->_tpl->assign('user', jAuth::getUserSession());
$this->_tpl->assign('isLogged', jAuth::isConnected());
$this->_tpl->assign('showRememberMe', $this->param('showRememberMe'));
}
示例11: _prepareTpl
protected function _prepareTpl()
{
$id = $this->getParam("id", jAuth::getUserSession()->id);
$title = jLocale::get("jmessenger~message.msg.archived");
$dao = jDao::get($this->dao);
$msg = $dao->getArchive($id);
$send = true;
$this->_tpl->assign(compact('msg', 'id', 'title', 'send'));
}
示例12: _prepareTpl
protected function _prepareTpl()
{
$config = new \Jelix\JCommunity\Config();
$this->_tpl->assign('canRegister', $config->isRegistrationEnabled());
$this->_tpl->assign('canResetPassword', $config->isResetPasswordEnabled());
if (jAuth::isConnected()) {
$this->_tpl->assign('login', jAuth::getUserSession()->login);
}
}
示例13: doAfterActions
protected function doAfterActions()
{
$this->body->assignIfNone('MAIN', '<p>no content</p>');
$this->body->assignIfNone('repositoryLabel', 'Lizmap');
$this->body->assignIfNone('isConnected', jAuth::isConnected());
$this->body->assignIfNone('user', jAuth::getUserSession());
$this->body->assignIfNone('auth_url_return', '');
$this->body->assignIfNone('googleAnalyticsID', '');
}
示例14: _markAsRead
protected function _markAsRead()
{
$dao = jDao::get($this->dao);
$m = $dao->get($this->param("id", 0));
if ($m && $m->id_for == jAuth::getUserSession()->id) {
$m->isSeen = 1;
$dao->update($m);
}
}
示例15: getPrivateGroup
/**
* get the private group for the current user or for the given login
* @param string $login The user's login
* @return string the id of the private group
* @since 1.2
*/
public static function getPrivateGroup($login = null)
{
if (!$login) {
if (!jAuth::isConnected()) {
return null;
}
$login = jAuth::getUserSession()->login;
}
return jDao::get('jacl2db~jacl2group', 'jacl2_profile')->getPrivateGroup($login)->id_aclgrp;
}