当前位置: 首页>>代码示例>>PHP>>正文


PHP jAuth::isConnected方法代码示例

本文整理汇总了PHP中jAuth::isConnected方法的典型用法代码示例。如果您正苦于以下问题:PHP jAuth::isConnected方法的具体用法?PHP jAuth::isConnected怎么用?PHP jAuth::isConnected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jAuth的用法示例。


在下文中一共展示了jAuth::isConnected方法的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));
                     }
                 }
             }
         }
     }
 }
开发者ID:jelix,项目名称:jcommunity-module,代码行数:34,代码来源:login.zone.php

示例2: getRight

 /**
  * return the value of the right on the given subject (and on the optional resource)
  * @param string $subject the key of the subject
  * @param string $resource the id of a resource
  * @return array list of values corresponding to the right
  */
 public function getRight($subject, $resource = null)
 {
     if ($resource === null && isset(self::$acl[$subject])) {
         return self::$acl[$subject];
     } elseif (isset(self::$aclres[$subject][$resource])) {
         return self::$aclres[$subject][$resource];
     }
     if (!jAuth::isConnected()) {
         // not authificated = no rights
         return array();
     }
     $groups = jAclDbUserGroup::getGroups();
     if (count($groups) == 0) {
         self::$acl[$subject] = array();
         self::$aclres[$subject][$resource] = array();
         return array();
     }
     // get all the values corresponding to the groups which the user has access to,
     //  with the subject and resource indicated
     $values = array();
     $dao = jDao::get('jacldb~jaclrights', 'jacl_profile');
     $list = $dao->getAllGroupRights($subject, $groups);
     foreach ($list as $right) {
         $values[] = $right->value;
     }
     self::$acl[$subject] = $values;
     if ($resource !== null) {
         $list = $dao->getAllGroupRightsWithRes($subject, $groups, $resource);
         foreach ($list as $right) {
             $values[] = $right->value;
         }
         self::$aclres[$subject][$resource] = $values = array_unique($values);
     }
     return $values;
 }
开发者ID:CREASIG,项目名称:lizmap-web-client,代码行数:41,代码来源:db.acl.php

示例3: 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();
     }
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:37,代码来源:hfnusub.class.php

示例4: 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;
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:31,代码来源:flood.class.php

示例5: 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;
 }
开发者ID:jonniedeb,项目名称:lizmap-web-client,代码行数:66,代码来源:default.classic.php

示例6: _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);
     }
 }
开发者ID:laurentj,项目名称:lizmap-web-client,代码行数:27,代码来源:map_headermenu.zone.php

示例7: getRight

 /**
  * return the value of the right on the given subject (and on the optional resource)
  * @param string $subject the key of the subject
  * @param string $resource the id of a resource
  * @return array list of values corresponding to the right
  */
 public function getRight($subject, $resource = null)
 {
     if ($resource === null && isset(self::$acl[$subject])) {
         return self::$acl[$subject];
     } elseif (isset(self::$aclres[$subject][$resource])) {
         return self::$aclres[$subject][$resource];
     }
     if (!jAuth::isConnected()) {
         // not authificated = no rights
         return array();
     }
     $groups = jAclDbUserGroup::getGroups();
     if (count($groups) == 0) {
         self::$acl[$subject] = array();
         self::$aclres[$subject][$resource] = array();
         return array();
     }
     // recupère toutes les valeurs correspondant aux groupes auquel appartient le user,
     //   avec le sujet et ressource indiqué
     $values = array();
     $dao = jDao::get('jelix~jaclrights', jAclDb::getProfile());
     $list = $dao->getAllGroupRights($subject, $groups);
     foreach ($list as $right) {
         $values[] = $right->value;
     }
     self::$acl[$subject] = $values;
     if ($resource !== null) {
         $list = $dao->getAllGroupRightsWithRes($subject, $groups, $resource);
         foreach ($list as $right) {
             $values[] = $right->value;
         }
         self::$aclres[$subject][$resource] = $values = array_unique($values);
     }
     return $values;
 }
开发者ID:alienpham,项目名称:helenekling,代码行数:41,代码来源:db.acl.php

示例8: beforeAction

 /**
  * @param    array  $params   plugin parameters for the current action
  * @return null or jSelectorAct  if action should change
  */
 public function beforeAction($params)
 {
     $notLogged = false;
     $badip = false;
     $selector = null;
     // Check if auth cookie exist and user isn't logged on
     jAuth::checkCookieToken();
     //Do we check the ip ?
     if ($this->config['secure_with_ip']) {
         if (!isset($_SESSION['JELIX_AUTH_SECURE_WITH_IP'])) {
             $_SESSION['JELIX_AUTH_SECURE_WITH_IP'] = $this->_getIpForSecure();
         } else {
             if ($_SESSION['JELIX_AUTH_SECURE_WITH_IP'] != $this->_getIpForSecure()) {
                 session_destroy();
                 $selector = new jSelectorAct($this->config['bad_ip_action']);
                 $notLogged = true;
                 $badip = true;
             }
         }
     }
     //Creating the user's object if needed
     if (!isset($_SESSION[$this->config['session_name']])) {
         $notLogged = true;
         $_SESSION[$this->config['session_name']] = new jAuthDummyUser();
     } else {
         $notLogged = !jAuth::isConnected();
     }
     if (!$notLogged && $this->config['timeout']) {
         if (isset($_SESSION['JELIX_AUTH_LASTTIME'])) {
             if (time() - $_SESSION['JELIX_AUTH_LASTTIME'] > $this->config['timeout'] * 60) {
                 $notLogged = true;
                 jAuth::logout();
                 unset($_SESSION['JELIX_AUTH_LASTTIME']);
             } else {
                 $_SESSION['JELIX_AUTH_LASTTIME'] = time();
             }
         } else {
             $_SESSION['JELIX_AUTH_LASTTIME'] = time();
         }
     }
     $needAuth = isset($params['auth.required']) ? $params['auth.required'] == true : $this->config['auth_required'];
     $authok = false;
     if ($needAuth) {
         if ($notLogged) {
             if (jApp::coord()->request->isAjax() || $this->config['on_error'] == 1 || !jApp::coord()->request->isAllowedResponse('jResponseRedirect')) {
                 throw new jException($this->config['error_message']);
             } else {
                 if (!$badip) {
                     $selector = new jSelectorAct($this->config['on_error_action']);
                 }
             }
         } else {
             $authok = true;
         }
     } else {
         $authok = true;
     }
     return $selector;
 }
开发者ID:medali1990,项目名称:medsite,代码行数:63,代码来源:auth.coord.php

示例9: 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', '');
 }
开发者ID:laurentj,项目名称:lizmap-web-client,代码行数:9,代码来源:myHtmlResponse.class.php

示例10: _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);
     }
 }
开发者ID:jelix,项目名称:jcommunity-module,代码行数:9,代码来源:status.zone.php

示例11: _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'));
 }
开发者ID:CREASIG,项目名称:lizmap-web-client,代码行数:9,代码来源:loginform.zone.php

示例12: getRight

 /**
  * return the value of the right on the given subject (and on the optional resource).
  *
  * The resource "-" (meaning 'all resources') has the priority over specific resources.
  * It means that if you give a specific resource, it will be ignored if there is a positive right
  * with "-". The right on the given resource will be checked if there is no rights for "-".
  * 
  * @param string $subject the key of the subject
  * @param string $resource the id of a resource
  * @return boolean true if the user has the right on the given subject
  */
 public function getRight($subject, $resource = '-')
 {
     if (empty($resource)) {
         $resource = '-';
     }
     if (!jAuth::isConnected()) {
         return self::getAnonymousRight($subject, $resource);
     }
     $groups = null;
     if (self::$acl === null) {
         // let's load all rights for the groups on which the current user is attached
         $groups = jAcl2DbUserGroup::getGroups();
         self::$acl = array();
         if (count($groups)) {
             $dao = jDao::get('jacl2db~jacl2rights', 'jacl2_profile');
             foreach ($dao->getRightsByGroups($groups) as $rec) {
                 // if there is already a right on a same subject on an other group
                 // we should take care when this rights says "cancel"
                 if (isset(self::$acl[$rec->id_aclsbj])) {
                     if ($rec->canceled) {
                         self::$acl[$rec->id_aclsbj] = false;
                     }
                 } else {
                     self::$acl[$rec->id_aclsbj] = $rec->canceled ? false : true;
                 }
             }
         }
     }
     if (!isset(self::$acl[$subject])) {
         self::$acl[$subject] = false;
     }
     // no resource given, just return the global right for the given subject
     if ($resource == '-') {
         return self::$acl[$subject];
     }
     // if we already have loaded the corresponding right, returns it
     if (isset(self::$aclres[$subject][$resource])) {
         return self::$aclres[$subject][$resource];
     }
     // default right for the resource is the global right
     self::$aclres[$subject][$resource] = self::$acl[$subject];
     // if the general right is not given, check the specific right for the resource
     if (!self::$acl[$subject]) {
         if ($groups === null) {
             $groups = jAcl2DbUserGroup::getGroups();
         }
         if (count($groups)) {
             $dao = jDao::get('jacl2db~jacl2rights', 'jacl2_profile');
             $right = $dao->getRightWithRes($subject, $groups, $resource);
             self::$aclres[$subject][$resource] = $right != false ? $right->canceled ? false : true : false;
         }
         return self::$aclres[$subject][$resource];
     } else {
         return true;
     }
 }
开发者ID:CREASIG,项目名称:lizmap-web-client,代码行数:67,代码来源:db.acl2.php

示例13: 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;
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:16,代码来源:jAcl2DbUserGroup.class.php

示例14: updateMember

 /**
  * Function that updates member's datas
  */
 private function updateMember()
 {
     $daoUser = jDao::get('havefnubb~member');
     if (jAuth::isConnected()) {
         $id_user = jAuth::getUserSession()->id;
         $daoUser->updateNbMsg($id_user);
     } else {
         $id_user = 0;
     }
     $daoUser->updateLastPostedMsg($id_user, time());
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:14,代码来源:postStuff.listener.php

示例15: _check

 protected function _check()
 {
     if ($this->configMethodCheck) {
         $method = $this->configMethodCheck;
         if (!$this->config->{$method}()) {
             return $this->notavailable();
         }
     }
     if (\jAuth::isConnected()) {
         return $this->noaccess();
     }
     return null;
 }
开发者ID:jelix,项目名称:jcommunity-module,代码行数:13,代码来源:AbstractController.php


注:本文中的jAuth::isConnected方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。