本文整理汇总了PHP中UserUtil::isLoggedIn方法的典型用法代码示例。如果您正苦于以下问题:PHP UserUtil::isLoggedIn方法的具体用法?PHP UserUtil::isLoggedIn怎么用?PHP UserUtil::isLoggedIn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserUtil
的用法示例。
在下文中一共展示了UserUtil::isLoggedIn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display()
{
$prevpage = null;
$nextpage = null;
$page = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $this->pageId));
$tables = DBUtil::getTables();
$pageTable = $tables['content_page'];
$pageColumn = $tables['content_page_column'];
$options = array('makeTree' => true);
$options['orderBy'] = 'position';
$options['orderDir'] = 'desc';
$options['pageSize'] = 1;
$options['filter']['superParentId'] = $page['parentPageId'];
if ($page['position'] > 0) {
$options['filter']['where'] = "{$pageColumn['level']} = {$page['level']} and {$pageColumn['position']} < {$page['position']}";
$pages = ModUtil::apiFunc('Content', 'Page', 'getPages', $options);
if (count($pages) > 0) {
$prevpage = $pages[0];
}
}
if (isset($page['position']) && $page['position'] >= 0) {
$options['orderDir'] = 'asc';
$options['filter']['where'] = "{$pageColumn['level']} = {$page['level']} and {$pageColumn['position']} > {$page['position']}";
$pages = ModUtil::apiFunc('Content', 'Page', 'getPages', $options);
if (count($pages) > 0) {
$nextpage = $pages[0];
}
}
$this->view->assign('loggedin', UserUtil::isLoggedIn());
$this->view->assign('prevpage', $prevpage);
$this->view->assign('nextpage', $nextpage);
return $this->view->fetch($this->getTemplate());
}
示例2: smarty_function_selector_user_category
/**
* User category selector.
*
* Available parameters:
* - btnText: If set, the results are assigned to the corresponding variable instead of printed out
* - cid: category ID
*
* Example
* {selector_user_category cid="1" assign="category"}
*
* @param array $params All attributes passed to this function from the template.
* @param Zikula_View $view Reference to the Zikula_View object.
*
* @return string HTML code of the selector.
*/
function smarty_function_selector_user_category($params, Zikula_View $view)
{
$field = isset($params['field']) ? $params['field'] : 'id';
$selectedValue = isset($params['selectedValue']) ? $params['selectedValue'] : 0;
$defaultValue = isset($params['defaultValue']) ? $params['defaultValue'] : 0;
$defaultText = isset($params['defaultText']) ? $params['defaultText'] : '';
$lang = isset($params['lang']) ? $params['lang'] : ZLanguage::getLanguageCode();
$name = isset($params['name']) ? $params['name'] : 'defautlselectorname';
$recurse = isset($params['recurse']) ? $params['recurse'] : true;
$relative = isset($params['relative']) ? $params['relative'] : true;
$includeRoot = isset($params['includeRoot']) ? $params['includeRoot'] : false;
$includeLeaf = isset($params['includeLeaf']) ? $params['includeLeaf'] : true;
$all = isset($params['all']) ? $params['all'] : false;
$displayPath = isset($params['displayPath']) ? $params['displayPath'] : false;
$attributes = isset($params['attributes']) ? $params['attributes'] : null;
$assign = isset($params['assign']) ? $params['assign'] : null;
$editLink = isset($params['editLink']) ? $params['editLink'] : true;
$submit = isset($params['submit']) ? $params['submit'] : false;
$multipleSize = isset($params['multipleSize']) ? $params['multipleSize'] : 1;
$doReplaceRootCat = false;
$userCats = ModUtil::apiFunc('ZikulaCategoriesModule', 'user', 'getusercategories', array('returnCategory' => 1, 'relative' => $relative));
$html = CategoryUtil::getSelector_Categories($userCats, $field, $selectedValue, $name, $defaultValue, $defaultText, $submit, $displayPath, $doReplaceRootCat, $multipleSize);
if ($editLink && $allowUserEdit && UserUtil::isLoggedIn() && SecurityUtil::checkPermission('ZikulaCategoriesModule::', "{$category['id']}::", ACCESS_EDIT)) {
$url = ModUtil::url('ZikulaCategoriesModule', 'user', 'edituser');
$html .= " <a href=\"{$url}\">" . __('Edit sub-categories') . '</a>';
}
if ($assign) {
$view->assign($assign, $html);
} else {
return $html;
}
}
示例3: display
/**
* Display the block.
*
* @param array $blockinfo the blockinfo structure
*
* @return string output of the rendered block
*/
public function display($blockinfo)
{
// only show block content if the user has the required permissions
if (!SecurityUtil::checkPermission('Reviews:ModerationBlock:', "{$blockinfo['title']}::", ACCESS_OVERVIEW)) {
return false;
}
// check if the module is available at all
if (!ModUtil::available('Reviews')) {
return false;
}
if (!UserUtil::isLoggedIn()) {
return false;
}
ModUtil::initOOModule('Reviews');
$this->view->setCaching(Zikula_View::CACHE_DISABLED);
$template = $this->getDisplayTemplate($vars);
$workflowHelper = new Reviews_Util_Workflow($this->serviceManager);
$amounts = $workflowHelper->collectAmountOfModerationItems();
// assign block vars and fetched data
$this->view->assign('moderationObjects', $amounts);
// set a block title
if (empty($blockinfo['title'])) {
$blockinfo['title'] = $this->__('Moderation');
}
$blockinfo['content'] = $this->view->fetch($template);
// return the block to the theme
return BlockUtil::themeBlock($blockinfo);
}
示例4: search
/**
* Performs the actual search processing.
*/
public function search($args)
{
ModUtil::dbInfoLoad('Search');
$dbtables = DBUtil::getTables();
$pageTable = $dbtables['content_page'];
$pageColumn = $dbtables['content_page_column'];
$contentTable = $dbtables['content_content'];
$contentColumn = $dbtables['content_content_column'];
$contentSearchTable = $dbtables['content_searchable'];
$contentSearchColumn = $dbtables['content_searchable_column'];
$translatedPageTable = $dbtables['content_translatedpage'];
$translatedPageColumn = $dbtables['content_translatedpage_column'];
$sessionId = session_id();
// check whether we need to search also in translated content
$multilingual = System::getVar('multilingual');
$currentLanguage = ZLanguage::getLanguageCode();
$searchWhereClauses = array();
$searchWhereClauses[] = '(' . Search_Api_User::construct_where($args, array($pageColumn['title']), $pageColumn['language']) . ')';
if ($multilingual) {
$searchWhereClauses[] = '(' . Search_Api_User::construct_where($args, array($translatedPageColumn['title']), $translatedPageColumn['language']) . ')';
}
$searchWhereClauses[] = '(' . Search_Api_User::construct_where($args, array($contentSearchColumn['text']), $contentSearchColumn['language']) . ')';
// add default filters
$whereClauses = array();
$whereClauses[] = '(' . implode(' OR ', $searchWhereClauses) . ')';
$whereClauses[] = $pageColumn['active'] . ' = 1';
$whereClauses[] = "({$pageColumn['activeFrom']} IS NULL OR {$pageColumn['activeFrom']} <= NOW())";
$whereClauses[] = "({$pageColumn['activeTo']} IS NULL OR {$pageColumn['activeTo']} >= NOW())";
$whereClauses[] = $contentColumn['active'] . ' = 1';
$whereClauses[] = $contentColumn['visiblefor'] . (UserUtil::isLoggedIn() ? ' <= 1' : ' >= 1');
$titleFields = $pageColumn['title'];
$additionalJoins = '';
if ($multilingual) {
// if searching in non-default languages, we need the translated title
$titleFields .= ', ' . $translatedPageColumn['title'] . ' AS translatedTitle';
// join also the translation table if required
$additionalJoins = "LEFT OUTER JOIN {$translatedPageTable} ON {$translatedPageColumn['pageId']} = {$pageColumn['id']} AND {$translatedPageColumn['language']} = '{$currentLanguage}'";
// prevent content snippets in other languages
$whereClauses[] = $contentSearchColumn['language'] . ' = \'' . $currentLanguage . '\'';
}
$where = implode(' AND ', $whereClauses);
$sql = "\n SELECT DISTINCT {$titleFields},\n {$contentSearchColumn['text']} AS description,\n {$pageColumn['id']} AS pageId,\n {$pageColumn['cr_date']} AS createdDate\n FROM {$pageTable}\n JOIN {$contentTable}\n ON {$contentColumn['pageId']} = {$pageColumn['id']}\n JOIN {$contentSearchTable}\n ON {$contentSearchColumn['contentId']} = {$contentColumn['id']}\n {$additionalJoins}\n WHERE {$where}\n ";
$result = DBUtil::executeSQL($sql);
if (!$result) {
return LogUtil::registerError($this->__('Error! Could not load items.'));
}
$objectArray = DBUtil::marshallObjects($result);
foreach ($objectArray as $object) {
$pageTitle = $object['page_title'];
if ($object['translatedTitle'] != '') {
$pageTitle = $object['translatedTitle'];
}
$searchItemData = array('title' => $pageTitle, 'text' => $object['description'], 'extra' => $object['pageId'], 'created' => $object['createdDate'], 'module' => 'Content', 'session' => $sessionId);
if (!\DBUtil::insertObject($searchItemData, 'search_result')) {
return \LogUtil::registerError($this->__('Error! Could not save the search results.'));
}
}
return true;
}
示例5: access
/**
* Check the user access to a forum
* @author: Albert Pérez Monfort (aperezm@xtec.cat)
* @param: Identity of the forum
* @return: 0 - No access
* 1 - Read
* 2 - Read and Write
* 3 - Read, write and topics creation
* 4 - Moderate
*/
public function access($args) {
$fid = FormUtil::getPassedValue('fid', isset($args['fid']) ? $args['fid'] : null, 'POST');
$uid = FormUtil::getPassedValue('uid', isset($args['uid']) ? $args['uid'] : UserUtil::getVar('uid'), 'POST');
$sv = FormUtil::getPassedValue('sv', isset($args['sv']) ? $args['sv'] : null, 'POST');
$requestByCron = false;
if (!ModUtil::func('IWmain', 'user', 'checkSecurityValue', array('sv' => $sv))) {
// security check
if (!SecurityUtil::checkPermission('IWforums::', '::', ACCESS_READ)) {
throw new Zikula_Exception_Forbidden();
}
} else {
$requestByCron = true;
}
// needed argument
if (!is_numeric($fid)) {
return false;
}
// get item
$sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
$item = ModUtil::apiFunc('IWforums', 'user', 'get', array('fid' => $fid,
'sv' => $sv));
if ($item == false) {
LogUtil::registerError($this->__('The forum upon which the ation had to be carried out hasn\'t been found'));
return System::redirect(ModUtil::url('IWforums', 'user', 'main'));
}
// if forum is not active deny access
if ($item['actiu'] != 1)
return 0;
$uid = (!UserUtil::isLoggedIn() && !$requestByCron) ? '-1' : $uid;
if ($uid != '-1') {
if ($uid != UserUtil::getVar('uid') && !$requestByCron)
return 0;
}
// check if the user can access the forum as moderator
if (strpos($item['mod'], '$' . $uid . '$') !== false)
return 4;
// if user is not registered check if can access the forum only in readtable mode
if ($uid == '-1' && strpos($item['grup'], '$-1|') !== false)
return 1;
// check if user can access the forum throug the group
// get user groups
$sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
$groups = ModUtil::func('IWmain', 'user', 'getAllUserGroups', array('sv' => $sv,
'uid' => $uid));
$accessType = 0;
foreach ($groups as $group) {
$pos = strpos($item['grup'], '$' . $group['id'] . '|');
if ($pos !== false) {
$access = substr($item['grup'], $pos + 1, strlen($group['id']) + 2);
$accessArray = explode('|', $access);
if ($accessType < $accessArray[1])
$accessType = $accessArray[1];
}
}
return $accessType;
}
示例6: getUser
/**
* get the User Links for this extension
*
* @return array
*/
private function getUser()
{
$links = array();
if (\UserUtil::isLoggedIn()) {
$links[] = array('url' => $this->router->generate('kaikmediagallerymodule_user_index'), 'text' => $this->translator->__('Gallery'), 'title' => $this->translator->__('Manage your media'), 'icon' => 'image');
}
return $links;
}
示例7: display
/**
* Display the output of the login block.
*
* @param array $blockInfo A blockinfo structure.
*
* @return string The output.
*/
public function display($blockInfo)
{
$renderedOutput = '';
if (SecurityUtil::checkPermission('Loginblock::', $blockInfo['title'].'::', ACCESS_READ)) {
if (!UserUtil::isLoggedIn()) {
if (empty($blockInfo['title'])) {
$blockInfo['title'] = DataUtil::formatForDisplay('Login');
}
$authenticationMethodList = new Users_Helper_AuthenticationMethodList($this);
if ($authenticationMethodList->countEnabledForAuthentication() > 1) {
$selectedAuthenticationMethod = $this->request->request->get('authentication_method', false);
} else {
// There is only one (or there is none), so auto-select it.
$authenticationMethod = $authenticationMethodList->getAuthenticationMethodForDefault();
$selectedAuthenticationMethod = array(
'modname' => $authenticationMethod->modname,
'method' => $authenticationMethod->method,
);
}
// TODO - The order and availability should be set by block configuration
$authenticationMethodDisplayOrder = array();
foreach ($authenticationMethodList as $authenticationMethod) {
if ($authenticationMethod->isEnabledForAuthentication()) {
$authenticationMethodDisplayOrder[] = array(
'modname' => $authenticationMethod->modname,
'method' => $authenticationMethod->method,
);
}
}
$this->view->assign('authentication_method_display_order', $authenticationMethodDisplayOrder)
->assign('selected_authentication_method', $selectedAuthenticationMethod);
// If the current page was reached via a POST or FILES then we don't want to return here.
// Only return if the current page was reached via a regular GET
if ($this->request->isGet()) {
$this->view->assign('returnpage', System::getCurrentUri());
} else {
$this->view->assign('returnpage', '');
}
$tplName = mb_strtolower("users_block_login_{$blockInfo['position']}.tpl");
if ($this->view->template_exists($tplName)) {
$blockInfo['content'] = $this->view->fetch($tplName);
} else {
$blockInfo['content'] = $this->view->fetch('users_block_login.tpl');
}
$renderedOutput = BlockUtil::themeBlock($blockInfo);
}
}
return $renderedOutput;
}
示例8: IWqv_qvsummaryblock_display
/**
* Gets qv summary information
*
* @author: Sara Arjona Téllez (sarjona@xtec.cat)
*/
function IWqv_qvsummaryblock_display($row) {
// Security check
if (!SecurityUtil::checkPermission('IWqv:summaryBlock:', $row['title'] . "::", ACCESS_READ) || !UserUtil::isLoggedIn()) {
return false;
}
$uid = UserUtil::getVar('uid');
if (!isset($uid))
$uid = '-1';
// Get the qvsummary saved in the user vars. It is renovate every 10 minutes
$sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
$exists = ModUtil::apiFunc('IWmain', 'user', 'userVarExists', array('name' => 'qvsummary',
'module' => 'IWqv',
'uid' => $uid,
'sv' => $sv));
if ($exists) {
$sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
$s = ModUtil::func('IWmain', 'user', 'userGetVar', array('uid' => $uid,
'name' => 'qvsummary',
'module' => 'IWqv',
'sv' => $sv,
'nult' => true));
} else {
$teacherassignments = ModUtil::apiFunc('IWqv', 'user', 'getall', array("teacher" => $uid));
$studentassignments = ModUtil::apiFunc('IWqv', 'user', 'getall', array("student" => $uid));
if (empty($teacherassignments) && empty($studentassignments)) {
}
$view = Zikula_View::getInstance('IWqv', false);
$view->assign('teacherassignments', $teacherassignments);
$view->assign('studentassignments', $studentassignments);
$view->assign('isblock', true);
$s = $view->fetch('IWqv_block_summary.htm');
if (empty($teacherassignments) && empty($studentassignments)) {
$s = '';
}
//Copy the block information into user vars
$sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
ModUtil::func('IWmain', 'user', 'userSetVar', array('uid' => $uid,
'name' => 'qvsummary',
'module' => 'IWqv',
'sv' => $sv,
'value' => $s,
'lifetime' => '2000'));
}
if ($s == '') {
return false;
}
$row['content'] = $s;
return BlockUtil::themesideblock($row);
}
示例9: smarty_function_userwelcome
/**
* Zikula_View function to display the welcome message
*
* Example
* {userwelcome}
*
* @param array $params All attributes passed to this function from the template.
* @param Zikula_View $view Reference to the Zikula_View object.
*
* @see function.userwelcome.php::smarty_function_userwelcome()
*
* @return string The welcome message.
*/
function smarty_function_userwelcome($params, Zikula_View $view)
{
if (UserUtil::isLoggedIn()) {
$username = UserUtil::getVar('uname');
} else {
$username = __('anonymous guest');
}
return __f('Welcome, %s!', $username);
}
示例10: smarty_function_user
/**
* Zikula_View function to display the user name
*
* Example
* {user}
*
* @param array $params All attributes passed to this function from the template.
* @param Zikula_View $view Reference to the Zikula_View object.
*
* @see function.userwelcome.php::smarty_function_user()
*
* @return string The username.
*/
function smarty_function_user($params, Zikula_View $view)
{
if (UserUtil::isLoggedIn()) {
$username = UserUtil::getVar('uname');
} else {
$username = __('anonymous guest');
}
return DataUtil::formatForDisplayHTML($username);
}
示例11: reloadFlaggedBlock
public function reloadFlaggedBlock() {
// Security check
if (!SecurityUtil::checkPermission('IWmain:flaggedBlock:', "::", ACCESS_READ) || !UserUtil::isLoggedIn()) {
AjaxUtil::error(DataUtil::formatForDisplayHTML($this->__('Sorry! No authorization to access this module.')));
}
//get the headlines saved in the user vars. It is renovate every 10 minutes
$sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
$exists = ModUtil::apiFunc('IWmain', 'user', 'userVarExists',
array('name' => 'flagged',
'module' => 'IWmain_block_flagged',
'uid' => UserUtil::getVar('uid'),
'sv' => $sv));
$chars = 15;
if (!$exists) {
ModUtil::func('IWmain', 'user', 'flagged',
array('where' => '',
'chars' => $chars));
}
$sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
$have_flags = ModUtil::func('IWmain', 'user', 'userGetVar',
array('uid' => UserUtil::getVar('uid'),
'name' => 'have_flags',
'module' => 'IWmain_block_flagged',
'sv' => $sv));
if ($have_flags != '0') {
ModUtil::func('IWmain', 'user', 'flagged',
array('where' => $have_flags,
'chars' => $chars));
//Posa la variable d'usuari have_news en blanc per no haver-la de tornar a llegir a la propera reiteraci�
$sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
ModUtil::func('IWmain', 'user', 'userSetVar',
array('uid' => UserUtil::getVar('uid'),
'name' => 'have_flags',
'module' => 'IWmain_block_flagged',
'sv' => $sv,
'value' => '0'));
}
$sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
$flags = ModUtil::func('IWmain', 'user', 'userGetVar',
array('uid' => UserUtil::getVar('uid'),
'name' => 'flagged',
'module' => 'IWmain_block_flagged',
'sv' => $sv,
'nult' => true));
$view = Zikula_View::getInstance('IWmain', false);
$view->assign('flags', $flags);
$content = $view->fetch('IWmain_block_iwflagged.tpl');
return new Zikula_Response_Ajax(array('content' => $content,
));
}
示例12: infoAction
/**
* @Route("/info")
* @Theme("admin")
* the main administration function
*
* @return RedirectResponse
*/
public function infoAction(Request $request)
{
// Permission check
if (!$this->get('kaikmedia_gallery_module.access_manager')->hasPermission()) {
throw new AccessDeniedException();
}
$request->attributes->set('_legacy', true);
// forces template to render inside old theme
return $this->render('KaikmediaGalleryModule:Admin:info.html.twig', ['ZUserLoggedIn' => \UserUtil::isLoggedIn()]);
}
示例13: smarty_function_userloggedin
/**
* Zikula_View function to determine whether the current user is logged in.
*
* This function will return true if that is true and false otherwise
*
* available parameters:
* - assign if set, the loggedin status will be assigned to this variable
*
* @param array $params All attributes passed to this function from the template.
* @param Zikula_View $view Reference to the Zikula_View object.
*
* @return bool the logged in status
*/
function smarty_function_userloggedin($params, Zikula_View $view)
{
$assign = isset($params['assign']) ? $params['assign'] : null;
$return = UserUtil::isLoggedIn();
if ($assign) {
$view->assign($assign, $return);
} else {
return $return;
}
}
示例14: display
/**
* Show the month calendar into a bloc
*
* @param array $blockinfo The month and the year to show
*
* @return The calendar content
*/
public function display($blockinfo)
{
$mes = FormUtil::getPassedValue('mes', isset($args['mes']) ? $args['mes'] : 0, 'REQUEST');
$any = FormUtil::getPassedValue('any', isset($args['any']) ? $args['any'] : 0, 'REQUEST');
// Security check
if (!SecurityUtil::checkPermission("IWagendas:calendarblock:", $blockinfo['title'] . "::", ACCESS_READ)) return;
// Check if the module is available
if (!ModUtil::available('IWagendas')) return;
$user = (UserUtil::isLoggedIn()) ? UserUtil::getVar('uid') : '-1';
//get the calendar saved in the user vars.
$sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
$exists = ModUtil::apiFunc('IWmain', 'user', 'userVarExists',
array('name' => 'Calendar',
'module' => 'IWagendas',
'uid' => $user,
'sv' => $sv));
/*
if ($exists) {
$sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
$s = ModUtil::func('IWmain', 'user', 'userGetVar',
array('uid' => $user,
'name' => 'calendar',
'module' => 'IWagendas',
'sv' => $sv,
'nult' => true));
$blockinfo['content'] = $s;
return BlockUtil::themesideblock($blockinfo);
}
*
*/
$s = ModUtil::func('IWagendas', 'user', 'getCalendarContent',
array('mes' => $mes,
'any' => $any));
//Copy the block information into user vars
$sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
ModUtil::func('IWmain', 'user', 'userSetVar',
array('uid' => $user,
'name' => 'calendar',
'module' => 'IWagendas',
'sv' => $sv,
'value' => $s,
'lifetime' => '700'));
//Copy the block information into user vars
$sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
ModUtil::func('IWmain', 'user', 'userSetVar',
array('uid' => $user,
'name' => 'month',
'module' => 'IWagendas',
'sv' => $sv,
'value' => $mes));
// Populate block info and pass to theme
$blockinfo['content'] = $s;
return BlockUtil::themesideblock($blockinfo);
}
示例15: sessionLogging
/**
* If enabled and logged in, save login name of user in Apache session variable for Apache logs.
*
* Implements 'core.init' event when Zikula_Core::STAGE_SESSIONS.
*
* @param Zikula_Event $event The event handler.
*
* @return void
*/
public function sessionLogging(Zikula_Event $event)
{
if ($event['stage'] & Zikula_Core::STAGE_SESSIONS) {
// If enabled and logged in, save login name of user in Apache session variable for Apache logs
if (isset($GLOBALS['ZConfig']['Log']['log.apache_uname']) && $GLOBALS['ZConfig']['Log']['log.apache_uname'] && UserUtil::isLoggedIn()) {
if (function_exists('apache_setenv')) {
apache_setenv('Zikula-Username', UserUtil::getVar('uname'));
}
}
}
}