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


PHP App::user方法代码示例

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


在下文中一共展示了App::user方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: authenticate

function authenticate()
{
    $app = Slim::getInstance();
    if (!App::user()) {
        $app->redirect("/connect/");
    }
}
开发者ID:ryanj,项目名称:The-Event-Day,代码行数:7,代码来源:index.php

示例2: __toString

 /**
  * @return string
  */
 public function __toString()
 {
     $skin = \App::user()->get()->config()->skin;
     if ($this->isModule) {
         return $this->getModuleImage($skin);
     }
     return $this->getThemeImage($skin);
 }
开发者ID:professor93,项目名称:mobicms,代码行数:11,代码来源:Image.php

示例3: links

 private function links($file)
 {
     $url = \App::request()->getBaseUrl();
     $skin = \App::user()->get()->config()->skin;
     $type = strtolower(pathinfo($file, PATHINFO_EXTENSION));
     $moduleDir = \App::router()->dir;
     $themeLink = $url . '/themes/';
     $skinLink = $themeLink . $skin . '/';
     $skinPath = THEMES_PATH . $skin . DS;
     return [[$skinPath . 'modules' . DS . $moduleDir . DS . $type . DS . $file, $skinLink . 'modules/' . $moduleDir . '/' . $type . '/' . $file], [ASSETS_PATH . 'modules' . DS . $moduleDir . DS . $type . DS . $file, $url . '/assets/modules/' . $moduleDir . '/' . $type . '/' . $file], [$skinPath . $type . DS . $file, $skinLink . $type . '/' . $file], [ASSETS_PATH . 'template' . DS . $type . DS . $file, $url . '/assets/template/' . $type . '/' . $file]];
 }
开发者ID:professor93,项目名称:mobicms,代码行数:11,代码来源:PathTrait.php

示例4: __construct

 public function __construct()
 {
     $size = \App::user()->get()->config()->pageSize;
     // Obtain variables
     if (filter_has_var(INPUT_ENV, 'page')) {
         $this->page = filter_input(INPUT_ENV, 'page', FILTER_SANITIZE_NUMBER_INT);
         $this->start = intval($this->page * $size - $size);
     } elseif (filter_has_var(INPUT_ENV, 'start')) {
         $this->start = filter_input(INPUT_ENV, 'start', FILTER_SANITIZE_NUMBER_INT);
     }
 }
开发者ID:professor93,项目名称:mobicms,代码行数:11,代码来源:Vars.php

示例5: setUser

 /**
  * 
  * @todo: test this functionality.
  * Sets App::$user and App::$real_user
  * @param string $identifier Optional - the nt_login or roswell id of the user you wish to act as
  */
 public static function setUser($identifier = '')
 {
     if (Gateway::$command_line) {
         App::$real_user = new \Models\User();
         App::$real_user->uname = 'commandline';
         App::$real_user->dname = 'Command Line';
         App::$real_user->roswell_id = 0;
         App::$real_user->is_admin = 1;
         App::$user = App::$real_user;
     } else {
         if (is_subclass_of(Gateway::$controller_class, '\\Controllers\\NoAuth')) {
             self::$real_user = new \Models\User();
             self::$real_user->uname = 'noauth';
             self::$real_user->dname = 'noauth';
             self::$real_user->roswell_id = 0;
             self::$user = self::$real_user;
         } else {
             if (!isset(Settings::$dev_group)) {
                 return false;
             }
             if (isset($_SESSION['real_user']) && isset($_SESSION['user'])) {
                 App::$real_user = unserialize($_SESSION['real_user']);
                 App::$user = unserialize($_SESSION['user']);
             } else {
                 App::$real_user = App::$directory->currentUser();
                 App::$real_user->is_admin = in_array(Settings::$dev_group, App::$real_user->workgroups);
                 if ($identifier) {
                     App::$user = App::$directory->currentUser($identifier);
                     App::$user->is_admin = in_array(Settings::$dev_group, App::$user->workgroups);
                 } else {
                     App::$user = App::$real_user;
                 }
             }
         }
     }
     $_SESSION['real_user'] = serialize(App::$real_user);
     $_SESSION['user'] = serialize(App::$user);
     if (App::$user->roswell_id == App::$real_user->roswell_id) {
         App::$user->acting_as_self = true;
     } else {
         App::$user->acting_as_self = false;
     }
 }
开发者ID:enknot,项目名称:bonetool,代码行数:49,代码来源:RoswellApp.php

示例6: _g

?>
</a>
        </li>
        <li>
            <a href="../ip/"><i class="bolt fw"></i><?php 
echo _g('IP Activity');
?>
</a>
        </li>
    </ul>
</div>

<!-- Список онлайн -->
<div class="content box m-list">
    <?php 
if (App::user()->isValid() || Config\System::$usrViewOnline) {
    ?>
        <h2><?php 
    echo _g('Guests');
    ?>
</h2>
        <ul class="striped">
            <?php 
    if (isset($this->list)) {
        ?>
                <?php 
        foreach ($this->list as $guest) {
            ?>
                    <li>
                        <!-- Кнопка выпадающего меню -->
                        <div>
开发者ID:eskrano,项目名称:mobicms,代码行数:31,代码来源:guests.php

示例7: defined

<?php

/*
 * mobiCMS Content Management System (http://mobicms.net)
 *
 * For copyright and license information, please see the LICENSE.md
 * Installing the system or redistributions of files must retain the above copyright notice.
 *
 * @link        http://mobicms.net mobiCMS Project
 * @copyright   Copyright (C) mobiCMS Community
 * @license     LICENSE.md (see attached file)
 */
defined('MOBICMS') or die('Error: restricted access');
$homeUrl = App::request()->getBaseUrl();
$form = new Mobicms\Form\Form(['action' => App::request()->getUri()]);
$form->title(_s('Leave the site?'))->element('checkbox', 'clear', ['label_inline' => _s('Remove authorization from all devices')])->divider(12)->element('submit', 'submit', ['value' => '   ' . _s('Exit') . '   ', 'class' => 'btn btn-primary btn-lg btn-block'])->html('<br/><a class="btn btn-default btn-lg btn-block" href="' . $homeUrl . '/profile/' . App::user()->get()->id . '/">' . _s('Back') . '</a>');
if ($form->process() === true) {
    App::user()->logout($form->output['clear']);
    App::redirect($homeUrl);
}
App::view()->form = $form->display();
App::view()->setTemplate('login.php');
开发者ID:professor93,项目名称:mobicms,代码行数:22,代码来源:logout.php

示例8: authenticateUser

 public function authenticateUser($authMap = array())
 {
     App::$user = new User();
     // attempt the authentication methods in the order given
     // the first one that succeeds is the one we use
     foreach ($authMap as $method) {
         if (isset($this->authenticationMethods[$method])) {
             $authenticatorClass = $this->authenticationMethods[$method];
             $authenticator = new $authenticatorClass();
             if ($authenticator->authenticateUser(App::$user)) {
                 App::$user->authType = $method;
                 return true;
             }
         }
     }
     // if we get here, we have not authenticated the user
     // we explicitly call the anonymous user authenticator,
     // in case it does any specific setup at all
     $authenticatorClass = $this->authenticationMethods[User::AUTHTYPE_ANON];
     $authenticator = new $authenticatorClass();
     $authenticator->authenticateUser(App::$user);
     App::$user->authType = User::AUTHTYPE_ANON;
     // all done
 }
开发者ID:stuartherbert,项目名称:mf,代码行数:24,代码来源:User.classes.php

示例9: defined

<?php

/*
 * mobiCMS Content Management System (http://mobicms.net)
 *
 * For copyright and license information, please see the LICENSE.md
 * Installing the system or redistributions of files must retain the above copyright notice.
 *
 * @link        http://mobicms.net mobiCMS Project
 * @copyright   Copyright (C) mobiCMS Community
 * @license     LICENSE.md (see attached file)
 */
defined('MOBICMS') or die('Error: restricted access');
$form = new Mobicms\Form\Form(['action' => App::request()->getUri()]);
$form->title(_dg('Add Article'))->element('text', 'title', ['label' => _g('Title'), 'required' => true])->element('textarea', 'text', ['label' => _g('Text'), 'editor' => true, 'required' => true])->element('checkbox', 'comments', ['label_inline' => _dg('Enable comments'), 'checked' => true])->divider()->element('submit', 'submit', ['value' => _g('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _g('Back') . '</a>');
$form->validate('title', 'lenght', ['min' => 3, 'max' => 100])->validate('text', 'lenght', ['min' => 3]);
if ($form->process() === true) {
    $stmt = App::db()->prepare("\n        INSERT INTO `news` SET\n        `time`        = ?,\n        `author`      = ?,\n        `author_id`   = ?,\n        `title`       = ?,\n        `text`        = ?,\n        `comm_enable` = ?\n    ");
    $user = App::user()->get();
    $stmt->execute([time(), $user->nickname, $user->id, App::filter($form->output['title'])->specialchars(), App::purify($form->output['text']), $form->output['comments']]);
    $user->lastpost = time();
    $user->save();
    App::redirect('../');
}
App::view()->form = $form->display();
App::view()->setTemplate('edit_form.php');
开发者ID:eskrano,项目名称:mobicms,代码行数:26,代码来源:add.php

示例10: prepareTextarea

 /**
  * @return string
  */
 private function prepareTextarea()
 {
     if (!empty($this->option['editor'])) {
         $config = \App::user()->get()->config();
         // Initialize editor
         $this->option['id'] = 'editor';
         $editor = new Editor($config->editor);
         $lng = \Config\System::$lng;
         //TODO: разобраться
         $editor->setLanguage($lng);
         $this->option['style'] = $editor->getStyle();
         if (empty($this->option['description'])) {
             $this->option['description'] = $editor->getHelp();
         } else {
             $this->option['description'] = $editor->getHelp() . '<br>' . $this->option['description'];
         }
         $editor->display();
     }
     return $this->build($this->option['type'], $this->option);
 }
开发者ID:professor93,项目名称:mobicms,代码行数:23,代码来源:Fields.php

示例11: defined

<?php

/*
 * mobiCMS Content Management System (http://mobicms.net)
 *
 * For copyright and license information, please see the LICENSE.md
 * Installing the system or redistributions of files must retain the above copyright notice.
 *
 * @link        http://mobicms.net mobiCMS Project
 * @copyright   Copyright (C) mobiCMS Community
 * @license     LICENSE.md (see attached file)
 */
defined('MOBICMS') or die('Error: restricted access');
use Config\System as Config;
$uri = App::request()->getUri();
$form = new Mobicms\Form\Form(['action' => $uri]);
$form->title(_g('Registration'))->element('checkbox', 'usrRegAllow', ['label_inline' => _dg('Allow registration'), 'checked' => Config::$usrRegAllow])->element('checkbox', 'usrRegModeration', ['label_inline' => _dg('Enable moderation'), 'checked' => Config::$usrRegModeration])->element('checkbox', 'usrRegEmail', ['label_inline' => _dg('Confirmation by Email'), 'checked' => Config::$usrRegEmail])->element('checkbox', 'usrRegQuarantine', ['label_inline' => _dg('Enable Quarantine'), 'checked' => Config::$usrRegQuarantine]);
if (App::user()->get()->rights == 9) {
    $form->title(_dg('For Users'))->element('checkbox', 'usrChangeSex', ['label_inline' => _dg('Change Sex'), 'checked' => Config::$usrChangeSex])->element('checkbox', 'usrChangeStatus', ['label_inline' => _dg('Change Status'), 'checked' => Config::$usrChangeStatus])->element('checkbox', 'usrUploadAvatars', ['label_inline' => _dg('Upload Avatars'), 'checked' => Config::$usrUploadAvatars])->element('checkbox', 'usrGravatar', ['label_inline' => _dg('Use Gravatar'), 'checked' => Config::$usrGravatar])->element('checkbox', 'usrNicknameDigitsOnly', ['label_inline' => _dg('Allow Nicknames, consisting of digits'), 'checked' => Config::$usrNicknameDigitsOnly])->element('checkbox', 'usrChangeNickname', ['label_inline' => _dg('Allow to change Nickname'), 'checked' => Config::$usrChangeNickname])->element('text', 'usrChangeNicknamePeriod', ['label_inline' => _dg('After how many days?') . ' <span class="note">(0-90)</span>', 'value' => Config::$usrChangeNicknamePeriod, 'class' => 'mini', 'limit' => ['type' => 'int', 'min' => 0, 'max' => 90]])->title(_dg('For Guests'))->element('checkbox', 'usrViewOnline', ['label_inline' => _dg('Online Lists'), 'checked' => Config::$usrViewOnline])->element('checkbox', 'usrViewUserlist', ['label_inline' => _dg('List of Users'), 'checked' => Config::$usrViewUserlist])->element('checkbox', 'usrViewProfiles', ['label_inline' => _dg('View Profiles'), 'checked' => Config::$usrViewProfiles])->title(_dg('Antiflood'))->element('radio', 'usrFloodMode', ['checked' => Config::$usrFloodMode, 'items' => ['3' => _dg('Day'), '4' => _dg('Night'), '2' => _dg('Autoswitch'), '1' => _dg('Adaptive')]])->element('text', 'usrFloodDay', ['value' => Config::$usrFloodDay, 'class' => 'small', 'label_inline' => _dg('Sec.') . ', ' . _dg('Day') . ' <span class="note">(3-300)</span>', 'limit' => ['type' => 'int', 'min' => 3, 'max' => 300]])->element('text', 'usrFloodNight', ['value' => Config::$usrFloodNight, 'class' => 'small', 'label_inline' => _dg('Sec.') . ', ' . _dg('Night') . ' <span class="note">(3-300)</span>', 'limit' => ['type' => 'int', 'min' => 3, 'max' => 300]]);
}
$form->divider()->element('submit', 'submit', ['value' => _g('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _g('Back') . '</a>');
if ($form->process() === true) {
    // Записываем настройки
    (new Mobicms\Config\WriteHandler())->write('System', $form->output);
    App::redirect($uri . '?saved');
}
App::view()->form = $form->display();
App::view()->setTemplate('edit_form.php');
开发者ID:eskrano,项目名称:mobicms,代码行数:28,代码来源:users_settings.php

示例12: isset

<?php

$url = App::request()->getBaseUrl();
$profile = isset($profile) ? $profile : App::profile();
$rights = App::user()->get()->rights;
$proxy = App::request()->isProxyIp();
?>
<li>
    <!-- Кнопка выпадающего меню -->
    <?php 
if ($rights) {
    ?>
        <div>
            <a href="#" class="lbtn dropdown dropdown-toggle" data-toggle="dropdown"></a>
            <ul class="dropdown-menu" role="menu">
                <li class="dropdown-header"><?php 
    echo _g('IP Management');
    ?>
</li>
                <li><a href="<?php 
    echo $url;
    ?>
/whois/<?php 
    echo $profile['ip'];
    ?>
"><i class="search fw"></i>IP Whois</a></li>
                <?php 
    if ($proxy) {
        ?>
                    <li><a href="#"><i class="cogs fw"></i><?php 
        echo _g('Proxy Management');
开发者ID:eskrano,项目名称:mobicms,代码行数:31,代码来源:include.user.php

示例13: defined

 * @copyright   Copyright (C) mobiCMS Community
 * @license     LICENSE.md (see attached file)
 */
defined('MOBICMS') or die('Error: restricted access');
use Config\System as Config;
$user = App::user()->get();
$form = new Mobicms\Form\Form(['action' => App::request()->getUri()]);
if ($user->rights >= 7 || $user->change_time < time() - Config::$usrChangeNicknamePeriod * 86400) {
    $form->title(_dg('Change Nickname'))->element('text', 'nickname', ['label' => _dg('New Nickname'), 'maxlength' => 20, 'required' => true])->element('text', 'repeat', ['label' => _dg('Repeat Nickname'), 'maxlength' => 20, 'description' => _g('Min. 2, Max. 20 Characters.<br>Allowed letters are Cyrillic and Latin alphabet, numbers, spaces and punctuation - = @ ! ? ~ . _ ( ) [ ] *') . '<br/>' . _dg('Please note that while changing the nickname is changing your Login on the site.<br>The next change of nickname is allowed through') . ' ' . Config::$usrChangeNicknamePeriod . ' ' . _n('Day', 'Days', Config::$usrChangeNicknamePeriod) . '.', 'required' => true])->element('password', 'password', ['label' => _dg('Your Password'), 'required' => true])->divider()->element('submit', 'submit', ['value' => _g('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _g('Back') . '</a>')->validate('nickname', 'lenght', ['min' => 2, 'max' => 20])->validate('repeat', 'compare', ['compare_field' => 'nickname']);
} else {
    $form->html('<div class="alert alert-danger">' . '<strong>' . _dg('Nickname can not change more than once a') . ' ' . Config::$usrChangeNicknamePeriod . ' ' . _n('Day', 'Days', Config::$usrChangeNicknamePeriod) . '</strong><br/><br/>' . _dg('You have already changed their nickname:') . ' ' . Includes\Functions::displayDate($user->change_time) . '<br/>' . _dg('Next time will be able to change:') . ' ' . Includes\Functions::displayDate($user->change_time + Config::$usrChangeNicknamePeriod * 86400) . '</div>')->html('<a class="btn btn-primary" href="../">' . _g('Back') . '</a>');
}
if ($form->process() === true) {
    try {
        // Проверяем ник
        App::user()->validate()->checkNickname($form->output['nickname']);
        // Проверяем пароль
        if (!$user->checkPassword($form->output['password'])) {
            $form->setError('password', _g('Invalid password'));
        }
    } catch (Mobicms\Checkpoint\Exceptions\UserExceptionInterface $e) {
        $form->setError('nickname', $e->getMessage());
    }
    // Если все проверки пройдены, записываем данные
    if ($form->isValid) {
        $profile = App::profile();
        $profile->nickname = $form->output['nickname'];
        $profile->change_time = time();
        $profile->save();
        $form->continueLink = '../';
        $form->successMessage = _dg('Nickname successfully changed');
开发者ID:eskrano,项目名称:mobicms,代码行数:31,代码来源:option_nickname.php

示例14: defined

 *
 * For copyright and license information, please see the LICENSE.md
 * Installing the system or redistributions of files must retain the above copyright notice.
 *
 * @link        http://mobicms.net mobiCMS Project
 * @copyright   Copyright (C) mobiCMS Community
 * @license     LICENSE.md (see attached file)
 */
defined('MOBICMS') or die('Error: restricted access');
$user = App::user()->get();
$profile = App::profile();
$form = new Mobicms\Form\Form(['action' => App::request()->getUri()]);
$form->title(_m('Change Password'))->element('password', 'oldpass', ['label' => $profile->id == $user->id ? _m('Old Password') : _m('Admin Password'), 'required' => true])->element('password', 'newpass', ['label' => _m('New Password'), 'description' => _s('The password length min. 3 characters'), 'required' => true])->element('password', 'newconf', ['label' => _s('Repeat password'), 'required' => true])->divider()->element('submit', 'submit', ['value' => _s('Save'), 'class' => 'btn btn-primary'])->html('<a class="btn btn-link" href="../">' . _s('Back') . '</a>')->validate('oldpass', 'lenght', ['continue' => false, 'min' => 3])->validate('newpass', 'lenght', ['continue' => false, 'min' => 3])->validate('newconf', 'compare', ['compare_field' => 'newpass', 'error' => _s("Passwords don't coincide")]);
if ($form->process() === true) {
    if ($user->checkPassword($form->output['oldpass'])) {
        $profile->setPassword($form->output['newpass']);
        $profile->setToken(App::user()->generateToken());
        $profile->save();
        if ($profile->id == $user->id) {
            $remember = filter_has_var(INPUT_COOKIE, App::user()->domain);
            App::user()->login($user->nickname, $form->output['newpass'], $remember);
        }
        $form->continueLink = '../';
        $form->successMessage = _m('The password is successfully changed');
        $form->confirmation = true;
    } else {
        $form->setError('oldpass', _s('Invalid password'));
    }
}
App::view()->form = $form->display();
App::view()->setTemplate('edit_form.php');
开发者ID:professor93,项目名称:mobicms,代码行数:31,代码来源:option_password.php

示例15: write

 /**
  * Write session data
  *
  * @param string $sessionId
  * @param string $data
  * @return bool
  */
 public function write($sessionId, $data)
 {
     try {
         $stmt = $this->db->prepare('UPDATE `system__sessions` SET
             `data` = :data,
             `timestamp` = :time,
             `ip` = :ip,
             `user_agent` = :ua,
             `place` = :place,
             `views` = :views,
             `movings` = :movings,
             `user_id` = :uid
             WHERE `id` = :id');
         $stmt->bindParam(':id', $sessionId, \PDO::PARAM_STR);
         $stmt->bindParam(':data', $data, \PDO::PARAM_LOB);
         $stmt->bindValue(':time', time(), \PDO::PARAM_INT);
         $stmt->bindValue(':ip', $this->request->getClientIp(), \PDO::PARAM_STR);
         $stmt->bindValue(':ua', $this->request->getUserAgent(), \PDO::PARAM_STR);
         $stmt->bindValue(':place', \App::router()->getCurrentModule(), \PDO::PARAM_STR);
         $stmt->bindValue(':views', $this->views, \PDO::PARAM_INT);
         $stmt->bindValue(':movings', $this->movings, \PDO::PARAM_INT);
         $stmt->bindValue(':uid', \App::user()->get()->id, \PDO::PARAM_INT);
         $stmt->execute();
         return true;
     } catch (\PDOException $e) {
         $this->rollback();
         throw $e;
     }
 }
开发者ID:eskrano,项目名称:mobicms,代码行数:36,代码来源:PdoSessionHandler.php


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