本文整理汇总了PHP中Current_User::isLogged方法的典型用法代码示例。如果您正苦于以下问题:PHP Current_User::isLogged方法的具体用法?PHP Current_User::isLogged怎么用?PHP Current_User::isLogged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Current_User
的用法示例。
在下文中一共展示了Current_User::isLogged方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
public function main()
{
$auth = Current_User::getAuthorization();
if (!Current_User::isLogged() || !$auth->local_user) {
PHPWS_Core::errorPage('403');
}
$result = $this->init();
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
Layout::add(PHPWS_ControlPanel::display(dgettext('users', 'The is a problem with My Page.')));
return;
} elseif (!$result) {
Layout::add(PHPWS_ControlPanel::display(dgettext('users', 'No modules are registered to My Page.')));
return;
}
$panel = My_Page::cpanel();
$module = $panel->getCurrentTab();
if (!$this->moduleIsRegistered($module)) {
Layout::add(dgettext('users', 'This module is not registered with My Page'));
return;
}
$content = My_Page::userOption($module);
if (PHPWS_Error::isError($content)) {
$content = $content->getMessage();
}
Layout::add(PHPWS_ControlPanel::display($content));
}
示例2: runTime
public function runTime(\Request $request)
{
if (\Current_User::isLogged()) {
\election\Controller\User::loadNavBar();
}
if (\PHPWS_Core::atHome()) {
\election\Controller\User::welcomeScreen($this);
}
}
示例3: getActive
public static function getActive()
{
$db = self::initDb();
$db->addWhere('active', 1);
// Exclude certain trackers if the user is logged in
if (Current_User::isLogged()) {
$db->addWhere('disable_if_logged', 0);
}
return self::runQuery($db);
}
示例4: runTime
public function runTime(\Request $request)
{
if (\Current_User::allow('sysinventory')) {
\systemsinventory\Controller\System::loadAdminBar();
}
if (\PHPWS_Core::atHome() && \Current_User::isLogged()) {
$path = $_SERVER['SCRIPT_NAME'] . '?module=systemsinventory';
header('HTTP/1.1 303 See Other');
header("Location: {$path}");
exit;
}
}
示例5: checkinForm
public function checkinForm()
{
$form = new PHPWS_Form('checkin');
$form->turnOffAutoComplete();
$form->setProtected(false);
$form->addHidden('module', 'checkin');
$form->addHidden('uop', 'post_checkin');
$form->addText('first_name', isset($_POST['first_name']) ? trim($_POST['first_name']) : null);
$form->setLabel('first_name', dgettext('checkin', 'First name'));
$form->setRequired('first_name');
$form->addText('last_name', isset($_POST['last_name']) ? trim($_POST['last_name']) : null);
$form->setLabel('last_name', dgettext('checkin', 'Last name'));
$form->setRequired('last_name');
if (PHPWS_Settings::get('checkin', 'email')) {
$form->addText('email', isset($_POST['email']) ? trim($_POST['email']) : null);
$form->setLabel('email', dgettext('checkin', 'Email address'));
$form->setRequired('email');
}
// If gender is requested
if (PHPWS_Settings::get('checkin', 'gender')) {
$sex = array('male' => 'Male', 'female' => 'Female');
$form->addRadioAssoc('gender', $sex);
$form->addTplTag('GENDER_LABEL', dgettext('checkin', 'Gender'));
}
// If birthdate is requested
if (PHPWS_Settings::get('checkin', 'birthdate')) {
/*
* Minimum representable date is 12-13-1901, and instead of doing
* lots of math to ensure that all selected dates in 1901 are after
* 12-13-1901, just make the minimum year always be 1902
*/
$yearsPrior = date('Y', time()) - 1902;
// current year - minimum full year (1902)
$form->dateSelect('birthdate', 0, '%B', $yearsPrior, 0);
$form->addTplTag('BIRTHDATE_LABEL', dgettext('checkin', 'Date of birth'));
}
$reasons = $this->getReasons();
if (!empty($reasons)) {
$reasons = array_reverse($reasons, true);
$reasons[0] = dgettext('checkin', '-- Please choose a reason from the list below --');
$reasons = array_reverse($reasons, true);
$form->addSelect('reason_id', $reasons);
$form->setLabel('reason_id', dgettext('checkin', 'Reason for visit'));
}
$form->addSubmit(dgettext('checkin', 'Check in'));
$tpl = $form->getTemplate();
$this->title = dgettext('checkin', 'Please check in using the form below');
$this->content = PHPWS_Template::process($tpl, 'checkin', 'signin.tpl');
if (!Current_User::isLogged() && PHPWS_Settings::get('checkin', 'collapse_signin')) {
Layout::collapse();
}
}
示例6: process
public function process()
{
// This hack is the most awful hack ever. Fix phpWebSite so that
// user logins are logged separately.
if (Current_User::isLogged() && !isset($_SESSION['HMS_LOGGED_THE_LOGIN'])) {
$username = strtolower(Current_User::getUsername());
HMS_Activity_Log::log_activity($username, ACTIVITY_LOGIN, $username, NULL);
$_SESSION['HMS_LOGGED_THE_LOGIN'] = $username;
}
if (!Current_User::isLogged() && $this->context->get('action') != 'ShowFrontPage') {
NQ::simple('hms', hms\NotificationView::ERROR, 'You must be logged in to do that.');
$action = 'ShowFrontPage';
} else {
$action = $this->context->get('action');
}
$cmd = CommandFactory::getCommand($action);
if (HMS_DEBUG) {
$cmd->execute($this->context);
} else {
try {
$cmd->execute($this->context);
} catch (PermissionException $p) {
NQ::Simple('hms', hms\NotificationView::ERROR, 'You do not have permission to perform that action. If you believe this is an error, please contact University Housing.');
$nv = new hms\NotificationView();
$nv->popNotifications();
Layout::add($nv->show());
} catch (Exception $e) {
try {
$message = $this->formatException($e);
NQ::Simple('hms', hms\NotificationView::ERROR, 'An internal error has occurred, and the authorities have been notified. We apologize for the inconvenience.');
$this->emailError($message);
$nv = new hms\NotificationView();
$nv->popNotifications();
Layout::add($nv->show());
} catch (Exception $e) {
$message2 = $this->formatException($e);
echo "HMS has experienced a major internal error. Attempting to email an admin and then exit.";
$message = "Something terrible has happened, and the exception catch-all threw an exception.\n\nThe first exception was:\n\n{$message}\n\nThe second exception was:\n\n{$message2}";
mail(FROM_ADDRESS, 'A Major HMS Error Has Occurred', $message);
exit;
}
}
}
}
示例7: landing
private function landing()
{
$factory = new Factory();
if (\Current_User::isLogged()) {
if (!\Current_User::allow('tailgate') && !$factory->isStudent(\Current_User::getUsername())) {
return $this->notStudentMessage();
}
$student = $factory->getCurrentStudent();
if ($student) {
// student is logged in and has account
return $this->showStatus($student->getId());
} else {
// student is logged in but doesn't have an account
return $this->createAccount();
}
} else {
// student is not logged in
return $this->newAccountInformation();
}
}
示例8: logBox
public static function logBox($logged = TRUE)
{
$auth = Current_User::getAuthorization();
if (PHPWS_Settings::get('users', 'user_menu') == 'none') {
return null;
}
if (Current_User::isLogged()) {
$username = Current_User::getUsername();
return User_Form::loggedIn();
} else {
if (PHPWS_Settings::get('users', 'show_login')) {
if ($auth->showLoginForm()) {
return User_Form::loggedOut();
} else {
return $auth->getLoginLink();
}
} else {
return NULL;
}
}
}
示例9: get
public static function get()
{
if (!\Current_User::isLogged()) {
return;
}
$modlist = PHPWS_Core::getModuleNames();
$tpl['MINIADMIN_TITLE'] = dgettext('miniadmin', 'MiniAdmin');
$tpl['MINIADMIN_TITLE_ALT'] = dgettext('miniadmin', 'Administrate');
if (isset($GLOBALS['MiniAdmin'])) {
foreach ($GLOBALS['MiniAdmin'] as $module => $links) {
$mod_title = $modlist[$module];
if (isset($links['title_link'])) {
$mod_title = sprintf('<a href="%s">%s</a>', $links['title_link'], $mod_title);
}
$module_links[$mod_title] = $links;
}
$tpl['module_links'] = $module_links;
}
$template = new \Template($tpl);
$template->setModuleTemplate('miniadmin', MINIADMIN_TEMPLATE);
$content = $template->get();
Layout::set($content, 'miniadmin', 'mini_admin');
}
示例10: userSignup
public function userSignup()
{
if (!$this->signup->sheet->id) {
PHPWS_Core::errorPage('404');
}
$sheet = $this->signup->sheet;
$peep = $this->signup->peep;
if (Current_User::isLogged() && empty($peep->email)) {
$peep->email = Current_User::getEmail();
}
if ($sheet->end_time < time()) {
$this->signup->title = dgettext('signup', 'Sorry');
$this->signup->content = dgettext('signup', 'We are no longer accepting applications.');
return;
}
$slots = $sheet->getAllSlots();
$slots_filled = $sheet->totalSlotsFilled();
if (empty($slots)) {
$this->signup->title = dgettext('signup', 'Sorry');
$this->signup->content = dgettext('signup', 'There is a problem with this signup sheet. Please check back later.');
return;
}
$this->signup->title =& $sheet->title;
foreach ($slots as $slot) {
// if the slots are filled, don't offer it
if ($slots_filled && isset($slots_filled[$slot->id])) {
$filled =& $slots_filled[$slot->id];
if ($filled >= $slot->openings) {
continue;
} else {
$openings_left = $slot->openings - $filled;
}
} else {
$openings_left =& $slot->openings;
}
$options[$slot->id] = sprintf(dngettext('signup', '%s (%s opening)', '%s (%s openings)', $openings_left), $slot->title, $openings_left);
}
if (!isset($options)) {
$this->signup->content = dgettext('signup', 'Sorry, but all available slots are full. Please check back later for possible cancellations.');
return;
} else {
$form = new PHPWS_Form('slots');
$form->useFieldset();
$form->setLegend(dgettext('signup', 'Signup form'));
$form->addHidden('module', 'signup');
$form->addHidden('uop', 'slot_signup');
$form->addHidden('sheet_id', $this->signup->sheet->id);
$form->addSelect('slot_id', $options);
$form->setLabel('slot_id', dgettext('signup', 'Available slots'));
$form->setMatch('slot_id', $peep->slot_id);
$form->addText('first_name', $peep->first_name);
$form->setLabel('first_name', dgettext('signup', 'First name'));
$form->addText('last_name', $peep->last_name);
$form->setLabel('last_name', dgettext('signup', 'Last name'));
$form->addText('email', $peep->email);
$form->setSize('email', 30);
$form->setLabel('email', dgettext('signup', 'Email address'));
$form->addText('phone', $peep->getPhone());
$form->setSize('phone', 15);
$form->setLabel('phone', dgettext('signup', 'Phone number'));
if (!empty($this->signup->sheet->extra1)) {
$form->addText('extra1', $peep->extra1);
$form->setLabel('extra1', $this->signup->sheet->extra1);
}
if (!empty($this->signup->sheet->extra2)) {
$form->addText('extra2', $peep->extra2);
$form->setLabel('extra2', $this->signup->sheet->extra2);
}
if (!empty($this->signup->sheet->extra3)) {
$form->addText('extra3', $peep->extra3);
$form->setLabel('extra3', $this->signup->sheet->extra3);
}
$form->addSubmit(dgettext('signup', 'Submit'));
$tpl = $form->getTemplate();
}
$tpl['DESCRIPTION'] = $sheet->getDescription();
$this->signup->content = PHPWS_Template::process($tpl, 'signup', 'signup_form.tpl');
$this->signup->sheet->flag();
}
示例11: _formAction
function _formAction()
{
if (PHATFORM_CAPTCHA) {
PHPWS_Core::initCoreClass('Captcha.php');
}
if (isset($_REQUEST['PHAT_Next'])) {
if ($this->isSaved()) {
$error = $this->_saveFormData();
if (PHPWS_Error::isError($error)) {
javascript('alert', array('content' => PHPWS_Error::printError($error)));
}
} else {
$this->_position += $this->_pageLimit;
}
if (Current_User::allow('phatform')) {
$content = $_SESSION['PHAT_FormManager']->menu() . $this->view();
} else {
$content = $this->view();
}
return $content;
} elseif (isset($_REQUEST['PHAT_Back'])) {
$this->_position = $this->_position - $this->_pageLimit;
if (Current_User::allow('phatform')) {
$content = $_SESSION['PHAT_FormManager']->menu() . $this->view();
} else {
$content = $this->view();
}
return $content;
} elseif ($_REQUEST['PHAT_Submit']) {
if (PHATFORM_CAPTCHA && $this->_anonymous && !Current_User::isLogged() && !Captcha::verify()) {
javascript('alert', array('content' => dgettext('phatform', 'CAPTCHA word was not correct.')));
return $this->view(false);
}
if ($this->isSaved()) {
$error = $this->_saveFormData();
if (PHPWS_Error::isError($error)) {
javascript('alert', array('content' => PHPWS_Error::printError($error)));
if (Current_User::allow('phatform')) {
$content = $_SESSION['PHAT_FormManager']->menu() . $this->view(false, $error);
} else {
$content = $this->view(false, $error);
}
return $content;
} else {
if (Current_User::allow('phatform')) {
$content = $_SESSION['PHAT_FormManager']->menu() . $this->_thanks();
} else {
$content = $this->_thanks();
}
$this->_emailData();
return $content;
}
} else {
$_SESSION['PHAT_FormManager']->_list();
return NULL;
}
}
}
示例12: restrictView
/**
* added limitations to a select query to only pull rows that
* the user is allowed to see. This function does does not work alone.
* it requires a database object to already be started.
*
* The user module MUST be active for this function to work.
* This Key function cannot be called without it.
*
* If the user is a deity or an unrestricted user, no change will be made
* to your db object.
*
*/
public static function restrictView($db, $module = null, $check_dates = true, $source_table = null)
{
$now = time();
if (empty($source_table)) {
$source_table = $db->tables[0];
}
if ($source_table == 'phpws_key') {
if (!isset($db->tables[1])) {
return PHPWS_Error::get(KEY_RESTRICT_NO_TABLE, 'core', 'Key::restrictView');
}
$source_table = $db->tables[1];
$key_table = true;
} else {
$key_table = false;
}
if (!$key_table) {
$db->addJoin('left', $source_table, 'phpws_key', 'key_id', 'id');
} else {
$db->addJoin('left', 'phpws_key', $source_table, 'id', 'key_id');
}
$db->addWhere("{$source_table}.key_id", '0', null, null, 'base');
$db->addWhere('phpws_key.active', 1, null, null, 'active');
$db->groupIn('active', 'base');
$db->setGroupConj('active', 'or');
if (Current_User::isDeity() || isset($module) && Current_User::isUnrestricted($module)) {
return;
}
if ($check_dates) {
$db->addWhere('phpws_key.show_after', $now, '<', null, 'active');
$db->addWhere('phpws_key.hide_after', $now, '>', null, 'active');
}
if (!Current_User::isLogged()) {
$db->addWhere('phpws_key.restricted', 0, null, 'and', 'active');
return;
} else {
$groups = Current_User::getGroups();
if (empty($groups)) {
return;
}
$db->addJoin('left', 'phpws_key', 'phpws_key_view', 'id', 'key_id');
// if key only has a level 1 restriction, a logged user can view it
$db->addWhere('phpws_key.restricted', KEY_LOGGED_RESTRICTED, '<=', null, 'restrict_1');
$db->setGroupConj('restrict_1', 'and');
// at level 2, the user must be in a group given view permissions
$db->addWhere('phpws_key.restricted', KEY_GROUP_RESTRICTED, '=', null, 'restrict_2');
$db->addWhere('phpws_key_view.group_id', $groups, 'in', null, 'restrict_2');
$db->setGroupConj('restrict_2', 'or');
if (empty($module)) {
$levels = Current_User::getUnrestrictedLevels();
if (!empty($levels)) {
$db->addWhere('phpws_key.module', $levels, null, null, 'permission');
$db->groupIn('permission', 'restrict_2');
}
}
$db->groupIn('restrict_1', 'base');
$db->groupIn('restrict_2', 'restrict_1');
}
}
示例13: Faxmaster
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @author Jeremy Booker <jbooker at tux dot appstate dot edu>
*/
if (!defined('PHPWS_SOURCE_DIR')) {
include '../../config/core/404.html';
exit;
}
# Include configuration and defines
PHPWS_Core::requireInc('faxmaster', 'defines.php');
PHPWS_Core::requireInc('faxmaster', 'errordefines.php');
PHPWS_Core::requireConfig('faxmaster');
Layout::addStyle('faxmaster');
/* The user must be logged in to use this module. So, if
* there's no user session, or the user is not logged
* in, then return here
*/
if ((!isset($_SESSION['User']) || !Current_User::isLogged()) && (!isset($_REQUEST['op']) || $_REQUEST['op'] != 'new_fax')) {
return;
}
# Create the Faxmaster
PHPWS_Core::initModClass('faxmaster', 'Faxmaster.php');
$fm = new Faxmaster();
示例14: whatsnewBlock
public static function whatsnewBlock()
{
if (PHPWS_Settings::get('whatsnew', 'cache_timeout') > 0) {
$cache_key = 'whatsnew_cache_key';
$content = PHPWS_Cache::get($cache_key, PHPWS_Settings::get('whatsnew', 'cache_timeout'));
if (!empty($content)) {
return $content;
}
}
$link = null;
$summary = null;
$date = null;
$module_name = null;
$exclude = unserialize(PHPWS_Settings::get('whatsnew', 'exclude'));
$db = new PHPWS_DB('phpws_key');
$db->addJoin('left', 'phpws_key', 'modules', 'module', 'title');
$db->addWhere('active', 1);
$db->addWhere('restricted', 0);
if ($exclude) {
foreach ($exclude as $module) {
$db->addWhere('module', $module, '!=');
}
}
$db->addOrder('update_date desc');
$db->setLimit(PHPWS_Settings::get('whatsnew', 'qty_items'));
$db->setIndexBy('id');
$db->addColumn('phpws_key.url');
$db->addColumn('phpws_key.title');
$db->addColumn('phpws_key.summary');
$db->addColumn('phpws_key.update_date');
$db->addColumn('modules.title', null, 'module_title');
$db->addColumn('modules.proper_name');
// $db->setTestMode();
$result = $db->select();
$tpl['TITLE'] = PHPWS_Text::parseOutput(PHPWS_Settings::get('whatsnew', 'title'));
$tpl['TEXT'] = PHPWS_Text::parseOutput(PHPWS_Settings::get('whatsnew', 'text'));
if (!PHPWS_Error::logIfError($result) && !empty($result)) {
foreach ($result as $item) {
$link = '<a href="' . $item['url'] . '">' . $item['title'] . '</a>';
if (PHPWS_Settings::get('whatsnew', 'show_summaries')) {
$summary = PHPWS_Text::parseOutput($item['summary']);
}
if (PHPWS_Settings::get('whatsnew', 'show_dates')) {
$date = strftime(WHATSNEW_DATE_FORMAT, $item['update_date']);
}
if (PHPWS_Settings::get('whatsnew', 'show_source_modules')) {
$module_name = dgettext($item['module_title'], PHPWS_Text::parseOutput($item['proper_name']));
}
$tpl['new-items'][] = array('LINK' => $link, 'SUMMARY' => $summary, 'DATE' => $date, 'MODULE_NAME' => $module_name);
}
} else {
$tpl['new-items'][] = array('LINK' => dgettext('whatsnew', 'Sorry, no results'));
}
$content = PHPWS_Template::process($tpl, 'whatsnew', 'block.tpl');
if (PHPWS_Settings::get('whatsnew', 'cache_timeout') > 0 && !Current_User::isLogged() && !Current_User::allow('whatsnew')) {
PHPWS_Cache::save($cache_key, $content);
}
return $content;
}
示例15: getStudentStatus
public static function getStudentStatus()
{
if (\Current_User::isLogged()) {
$content = '<a class="btn btn-primary btn-sm" href="./tailgate">Check lottery status</a>';
} else {
$content = '<a class="btn btn-primary btn-sm" href="./admin">Login</a>';
}
return $content;
}