• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP fSession类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: submit

 public function submit($problem_id)
 {
     try {
         $problem = new Problem($problem_id);
         $language = fRequest::get('language', 'integer');
         if (!array_key_exists($language, static::$languages)) {
             throw new fValidationException('Invalid language.');
         }
         fSession::set('last_language', $language);
         $code = trim(fRequest::get('code', 'string'));
         if (strlen($code) == 0) {
             throw new fValidationException('Code cannot be empty.');
         }
         if ($problem->isSecretNow()) {
             if (!User::can('view-any-problem')) {
                 throw new fAuthorizationException('Problem is secret now. You are not allowed to submit this problem.');
             }
         }
         $record = new Record();
         $record->setOwner(fAuthorization::getUserToken());
         $record->setProblemId($problem->getId());
         $record->setSubmitCode($code);
         $record->setCodeLanguage($language);
         $record->setSubmitDatetime(Util::currentTime());
         $record->setJudgeStatus(JudgeStatus::PENDING);
         $record->setJudgeMessage('Judging... PROB=' . $problem->getId() . ' LANG=' . static::$languages[$language]);
         $record->setVerdict(Verdict::UNKNOWN);
         $record->store();
         Util::redirect('/status');
     } catch (fException $e) {
         fMessaging::create('error', $e->getMessage());
         fMessaging::create('code', '/submit', fRequest::get('code', 'string'));
         Util::redirect("/submit?problem={$problem_id}");
     }
 }
开发者ID:daerduoCarey,项目名称:oj,代码行数:35,代码来源:SubmitController.php


示例2: findAll

	/**
	 * Returns all checks on the system
	 * 
	 * @param  string  $sort_column  The column to sort by
	 * @param  string  $sort_dir     The direction to sort the column
	 * @return fRecordSet  An object containing all meetups
	 */
	static function findAll($sort_column = 'name', $sort_dir = 'desc')
	{
       return fRecordSet::build(
          __CLASS__,
          array('enabled=' => true,'user_id=|visibility=' => array(fSession::get('user_id'),0)),
          array($sort_column => $sort_dir)
          );
	}    
开发者ID:rberger,项目名称:Graphite-Tattle,代码行数:15,代码来源:Check.php


示例3: findActive

 static function findActive($check_id = NULL)
 {
     if (!is_null($check_id) && is_numeric($check_id)) {
         $filter = ' AND check_id=' . $check_id;
     } else {
         $filter = '';
     }
     return fRecordSet::buildFromSQL(__CLASS__, array('SELECT subscriptions.* FROM subscriptions WHERE user_id = ' . fSession::get('user_id') . $filter));
 }
开发者ID:nagyist,项目名称:Tattle,代码行数:9,代码来源:Subscription.php


示例4: setPreviousSortDirection

 /**
  * Set the sort direction to be used on returning pages
  *
  * @param  string $sort_direction  The sort direction to save
  * @return void
  */
 private static function setPreviousSortDirection($sort_direction)
 {
     fSession::set(__CLASS__ . '::' . fURL::get() . '::previous_sort_direction', $sort_direction);
 }
开发者ID:gopalgrover23,项目名称:flourish-classes,代码行数:10,代码来源:fCRUD.php


示例5: Check

        fMessaging::create('error', fURL::get(), $e->getMessage());
    }
    include VIEW_PATH . '/ackAll_results.php';
} else {
    if ($action == 'notifyAll') {
        try {
            $check = new Check($check_id);
            $subject_mail = fRequest::get('subject_mail');
            $content_mail = fRequest::get('content_mail');
            if (fRequest::isPost()) {
                if (empty($subject_mail) || empty($content_mail)) {
                    fMessaging::create('error', fURL::get(), "You have to fill the subject and the content to send this mail");
                } else {
                    fRequest::validateCSRFToken(fRequest::get('token'));
                    $recipients = array();
                    $id_user_session = fSession::get('user_id');
                    $user_session = new User($id_user_session);
                    $recipients[] = array("mail" => $user_session->getEmail(), "name" => $user_session->getUsername());
                    $alt_ids = array();
                    $subscription_alt = Subscription::findAll($check_id, NULL, NULL, NULL, TRUE);
                    foreach ($subscription_alt as $alt) {
                        $user = new User($alt->getUserId());
                        $recipients[] = array("mail" => usr_var('alt_email', $user->getUserId()), "name" => $user->getUsername());
                        $alt_ids[] = $alt->getUserId();
                    }
                    $subscriptions = $db->query("SELECT DISTINCT user_id,check_id FROM subscriptions WHERE check_id=" . $check_id . ";");
                    foreach ($subscriptions as $sub) {
                        $user_id = $sub['user_id'];
                        if (!in_array($user_id, $alt_ids) && $user_id != $id_user_session) {
                            $user = new User($sub['user_id']);
                            $recipients[] = array("mail" => $user->getEmail(), "name" => $user->getUsername());
开发者ID:nagyist,项目名称:Tattle,代码行数:31,代码来源:result.php


示例6: validateCSRFToken

 /**
  * Validates a request token generated by ::generateCSRFToken()
  * 
  * This method takes a request token and ensures it is valid, otherwise
  * it will throw an fValidationException.
  * 
  * @throws fValidationException  When the CSRF token specified is invalid
  * 
  * @param  string $token  The request token to validate
  * @param  string $url    The URL to validate the token for, default to the current page
  * @return void
  */
 public static function validateCSRFToken($token, $url = NULL)
 {
     if ($url === NULL) {
         $url = fURL::get();
     }
     $key = __CLASS__ . '::' . $url . '::csrf_tokens';
     $tokens = fSession::get($key, array());
     if (!in_array($token, $tokens)) {
         throw new fValidationException('The form submitted could not be validated as authentic, please try submitting it again');
     }
     $tokens = array_diff($tokens, array($token));
     fSession::set($key, $tokens);
 }
开发者ID:hibble,项目名称:printmaster,代码行数:25,代码来源:fRequest.php


示例7: fValidation

        $validator = new fValidation();
        $validator->addRequiredFields('password', 'email');
        $validator->addEmailFields('email');
        $validator->validate();
        $users = fRecordSet::build('User', array('email=' => strtolower($_POST['email'])));
        if ($users->count() == 0) {
            throw new fValidationException('Invalid username or password.');
        }
        $rec = $users->getRecords();
        $user = $rec[0];
        if (!fCryptography::checkPasswordHash($_POST['password'], $user->getPassword())) {
            throw new fValidationException('Invalid username or password.');
        }
        fSession::set('user', $user->getId());
        if (fRequest::get('persistent_login', 'boolean')) {
            fSession::enablePersistence();
        }
        if (isset($_POST['forward'])) {
            fURL::redirect('http://' . $_SERVER['SERVER_NAME'] . $_POST['forward']);
        } else {
            fURL::redirect('/members');
        }
        exit;
    } catch (fValidationException $e) {
        echo "<p>" . $e->printMessage() . "</p>";
    } catch (fSQLException $e) {
        echo "<p>An unexpected error occurred, please try again later</p>";
        trigger_error($e);
    }
}
?>
开发者ID:russss,项目名称:hackspace-foundation-sites,代码行数:31,代码来源:login.php


示例8: setUserToken

 /**
  * Sets some piece of information to use to identify the current user
  *
  * @param  mixed $token  The user's token. This could be a user id, an email address, a user object, etc.
  * @return void
  */
 public static function setUserToken($token)
 {
     fSession::set(__CLASS__ . '::user_token', $token);
     fSession::regenerateID();
 }
开发者ID:gopalgrover23,项目名称:flourish-classes,代码行数:11,代码来源:fAuthorization.php


示例9:

    echo Subscription::makeURL('add', $check);
    ?>
" class="btn btn-default">Subscribe</a>
             <?php 
}
?>
             <div class="required"><em>*</em> Required field</div>
             <input type="hidden" name="token" value="<?php 
echo fRequest::generateCSRFToken();
?>
" />
<?php 
if ($action == 'add') {
    ?>
             <input type="hidden" name="user_id" value="<?php 
    echo fSession::get('user_id');
    ?>
" />
             <input type="hidden" name="type" value="<?php 
    echo $check_type;
    ?>
" />
<?php 
}
?>
           </div>
           </div>
         </fieldset>
     </form>
    </div>
    <div id="check_graph" class="col-md-9">
开发者ID:nagyist,项目名称:Tattle,代码行数:31,代码来源:add_edit_predictive_check.php


示例10: findAllByGroupId

 /**
  * Returns all checks on the system that matches the group id
  *
  * @param  string  $type         The type of check to return 'threshold', 'predictive'
  * @param  string  $sort_column  The column to sort by
  * @param  string  $sort_dir     The direction to sort the column
  * @param  int     $limit        The max number of records to show
  * @param  int     $page         The offset
  * @return fRecordSet  An object containing all meetups
  */
 static function findAllByGroupId($type, $group_id, $sort_column = 'name', $sort_dir = 'desc', $limit = NULL, $page = NULL)
 {
     return fRecordSet::build(__CLASS__, array('type=' => $type, 'group_id=' => $group_id, 'enabled=' => true, 'user_id=|visibility=' => array(fSession::get('user_id'), 0)), array($sort_column => $sort_dir), $limit, $page);
 }
开发者ID:nagyist,项目名称:Tattle,代码行数:14,代码来源:Check.php


示例11: exit

<?php

fSession::open();
$idUser = fSession::get(SESSION_ID_USER);
if (empty($idUser) || !fAuthorization::checkACL('geolocation', 'edit')) {
    exit("No se ha podido acceder a esta secci&oacite;n");
}
$id = fRequest::encode('id', 'integer');
if (empty($id)) {
    exit("Ha ocurrido un error");
}
if (!fAuthorization::checkAuthLevel('super')) {
    $isOwner = fRecordSet::build('EconomicUnit', array('economic_unit_id =' => $id, 'economic_unit_region=' => fSession::get('regs')));
    $count = $isxOwner->count() > 0;
    if (!$count) {
        header('Location: ' . SITE);
    }
}
try {
    $av = new EconomicUnit($id);
} catch (Exception $e) {
    header("Location: " . SITE);
}
$av->setEconomicUnitName(fRequest::encode('title', 'string'));
//$av->setCreatedAt(date('Y-m-d H:m:s'));
$av->setEconomicUnitStreetType(fRequest::encode('type', 'string'));
$av->setEconomicUnitLatitude(fRequest::encode('latitude', 'string'));
$av->setEconomicUnitLongitude(fRequest::encode('longitude', 'string'));
$av->setEconomicUnitDescription(fRequest::encode('description', 'string'));
$av->setEconomicUnitStreetName(fRequest::encode('street', 'string'));
$av->setEconomicUnitLocationNumber(fRequest::encode('number', 'string'));
开发者ID:nevermind89x,项目名称:Mi-morelia,代码行数:31,代码来源:geolocation_edit.php


示例12: fValidationException

        $validator->addRequiredFields('fullname', 'password', 'email', 'address');
        $validator->addEmailFields('email');
        $validator->validate();
        if ($_POST['password'] != $_POST['passwordconfirm']) {
            throw new fValidationException('Passwords do not match');
        }
        $user = new User();
        $user->setEmail(strtolower($_POST['email']));
        $user->setFullName($_POST['fullname']);
        $user->setAddress($_POST['address']);
        $user->setPassword(fCryptography::hashPassword($_POST['password']));
        if (isset($_POST['hackney'])) {
            $user->setHackney(true);
        }
        $user->store();
        fSession::set('user', $user->getId());
        fURL::redirect('/members');
        exit;
    } catch (fValidationException $e) {
        echo "<p>" . $e->printMessage() . "</p>";
    } catch (fSQLException $e) {
        echo "<p>An unexpected error occurred, please try again later</p>";
        trigger_error($e);
    }
}
?>
<h2>Membership</h2>
<p>The London Hackspace is a members-owned non-profit association. Members have a hand in the running of the
organisation as well as 24/7 access to the space.</p>

<p>Membership is paid monthly by standing order. We ask that you pay what you think the space is worth to you. Running an
开发者ID:russss,项目名称:hackspace-foundation-sites,代码行数:31,代码来源:signup.php


示例13: tearDown

 public function tearDown()
 {
     if (defined('SKIPPING')) {
         return;
     }
     fSession::reset();
 }
开发者ID:nurulimamnotes,项目名称:flourish-old,代码行数:7,代码来源:fSessionTest.php


示例14: catch

        try {
            $user->populate();
        } catch (fExpectedException $e) {
            fMessaging::create('error', fURL::get(), $e - getMessage());
        }
    }
    include VIEW_PATH . '/add_edit_user_settings.php';
} elseif ('delete' == $action) {
    try {
        $user = new User($user_id);
        if (fRequest::isPost()) {
            fRequest::validateCSRFToken(fRequest::get('token'));
            $user->delete();
            fMessaging::create('success', User::makeUrl('edit', $user), 'The user ' . $user->getName() . ' was successfully deleted');
            fURL::redirect(User::makeUrl('edit', $user));
        }
    } catch (fNotFoundException $e) {
        fMessaging::create('error', User::makeUrl('edit', $user), 'The line requested could not be found');
        fURL::redirect(User::makeUrl('edit', $user));
    } catch (fExpectedException $e) {
        fMessaging::create('error', fURL::get(), $e->getMessage());
    }
    include VIEW_PATH . '/delete.php';
} else {
    if (!fAuthorization::checkAuthLevel('admin')) {
        fURL::redirect(User::makeURL('edit', fSession::get('user_id')));
    } else {
        $users = User::findAll();
        include VIEW_PATH . '/list_users.php';
    }
}
开发者ID:nleskiw,项目名称:Graphite-Tattle,代码行数:31,代码来源:user.php


示例15: dirname

<?
include dirname(__FILE__) . '/inc/init.php';

fAuthorization::requireLoggedIn();
$breadcrumbs[] = array('name' => 'Alerts', 'url' => '#','active' => false);

$latest_alerts = 'SELECT c.check_id,name,r.status,count(c.check_id) as count, r.timestamp '.
                 'FROM subscriptions s '. 
                 'JOIN checks c ON s.check_id = c.check_id '.
                 'JOIN check_results r ON s.check_id = r.check_id '.
                 'WHERE r.timestamp >= DATE_SUB(CURDATE(),INTERVAL 1 DAY) '.
                 'AND r.status IS NOT NULL '.
                 'AND acknowledged = 0 '.
                 'AND s.user_id = ' . fSession::get('user_id') . ' ' .
                 'Group by c.check_id;';
$results = $mysql_db->query($latest_alerts);

include dirname(__FILE__) . '/inc/views/index.php';
开发者ID:rberger,项目名称:Graphite-Tattle,代码行数:18,代码来源:index.php


示例16: login_get_referer

$errmsg = '';
if (fRequest::isPost()) {
    $old_password = fRequest::get('old-password');
    $new_password = fRequest::get('new-password');
    $confirm_password = fRequest::get('confirm-password');
    $token = fAuthorization::getUserToken();
    $username = $token['name'];
    $user_id = $token['id'];
    if (empty($old_password) or empty($new_password) or empty($confirm_password)) {
        $errmsg = '密码不能为空';
    } else {
        if ($new_password != $confirm_password) {
            $errmsg = '两次输入的新密码不一致';
        } else {
            if (login_check_credential($db, $username, $old_password) == false) {
                $errmsg = '旧密码错误';
            } else {
                if (login_change_password($db, $user_id, $new_password)) {
                    fURL::redirect(fSession::delete('change-password-referer', SITE_BASE));
                } else {
                    $errmsg = '修改密码失败';
                }
            }
        }
    }
} else {
    if (fSession::get('change-password-referer') == null) {
        fSession::set('change-password-referer', login_get_referer(SITE_BASE));
    }
}
include __DIR__ . '/tpl/change-password.php';
开发者ID:daerduoCarey,项目名称:xiaoyou,代码行数:31,代码来源:change-password.php


示例17: show

 /**
  * Retrieves a message, removes it from the session and prints it - will not print if no content
  *
  * The message will be printed in a `p` tag if it does not contain
  * any block level HTML, otherwise it will be printed in a `div` tag.
  *
  * @param  mixed  $name       The name or array of names of the message(s) to show, or `'*'` to show all
  * @param  string $recipient  The intended recipient
  * @param  string $css_class  Overrides using the `$name` as the CSS class when displaying the message - only used if a single `$name` is specified
  * @return boolean  If one or more messages was shown
  */
 public static function show($name, $recipient = NULL, $css_class = NULL)
 {
     if ($recipient === NULL) {
         $recipient = '{default}';
     }
     // Find all messages if * is specified
     if (is_string($name) && $name == '*') {
         fSession::open();
         $prefix = __CLASS__ . '::' . $recipient . '::';
         $keys = array_keys($_SESSION);
         $name = array();
         foreach ($keys as $key) {
             if (strpos($key, $prefix) === 0) {
                 $name[] = substr($key, strlen($prefix));
             }
         }
     }
     // Handle showing multiple messages
     if (is_array($name)) {
         $shown = FALSE;
         $names = $name;
         foreach ($names as $name) {
             $class = trim(self::$class . ' ' . $name);
             $class = $css_class === NULL ? $class : $css_class;
             $shown = fHTML::show(self::retrieve($name, $recipient), $class, TRUE) || $shown;
         }
         return $shown;
     }
     $class = self::$class . ' ' . $name;
     $class = $css_class === NULL ? $class : $css_class;
     // Handle a single message
     return fHTML::show(self::retrieve($name, $recipient), $class, TRUE);
 }
开发者ID:gopalgrover23,项目名称:flourish-classes,代码行数:44,代码来源:fMessaging.php


示例18: fTemplating

//Set the Template root, and set the header and footer
$tmpl = new fTemplating($root_path . '/views/');

$tmpl->enableMinification('development', dirname(__FILE__) . '/../js_cache/',dirname(__FILE__) . '/..');

$tmpl->add('css','/bootstrap/bootstrap.min.css'); 
$tmpl->add('css','/assets/css/jquery-ui.css');

$tmpl->add('js','/assets/js/jquery.min.js'); 
$tmpl->add('js','/assets/js/jquery-ui.min.js'); 
$tmpl->add('js','/assets/js/jquery.collapsible.js'); 
$tmpl->add('js','/assets/js/jquery.graphite.js');

$tmpl->add('js','/bootstrap/js/bootstrap-modal.js');
$tmpl->add('js','/bootstrap/js/bootstrap-twipsy.js');
$tmpl->add('js','/bootstrap/js/bootstrap-popover.js');


$tmpl->set('header', 'header.php');
$tmpl->set('footer', 'footer.php');

//Set DB connection (using flourish it isn't actually connected to until the first use)
$mysql_db  = new fDatabase('mysql', $database_name, $database_user, $database_password);

//Connect the db to the ORM functions
fORMDatabase::attach($mysql_db);

//Start the Flourish Session
fSession::open();
开发者ID:rberger,项目名称:Graphite-Tattle,代码行数:29,代码来源:init.php


示例19:

              echo '<li' . ($current_url == $setting_list ? ' class="active"' : '') . '><a href="' . $setting_list . '" >Settings</a></li>' . "\n";
if (fAuthorization::checkAuthLevel('admin')) {
              $user_list = User::makeURL('list'); 
              echo '<li><a href="' . User::makeURL('list') . '" >Users</a></li>';
}              
?>
          </ul>
 <?php 
    if (is_numeric(fSession::get('user_id'))) {
        ?>
 <p class="pull-right">
     Logged in as <a href="<?php 
        echo User::makeUrl('edit', fSession::get('user_id'));
        ?>
"><?php 
        echo fSession::get('user_name');
        ?>
</a>
</p>
    <?php 
    }
    ?>
 
</div> 
        </div>
      </div>
<?php 
}
?>
<div class="container-fluid">
<?php 
开发者ID:nleskiw,项目名称:Graphite-Tattle,代码行数:31,代码来源:header.php


示例20: findUsersResults

 static public function findUsersResults()
 {
  return fRecordSet::buildFromSQL(
    __CLASS__,
    array('SELECT check_results.* FROM check_results JOIN subscriptions ON check_results.check_id = subscriptions.check_id and subscriptions.user_id = ' . fSession::get('user_id')));
  }
开发者ID:rberger,项目名称:Graphite-Tattle,代码行数:6,代码来源:CheckResult.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP fURL类代码示例发布时间:2022-05-23
下一篇:
PHP fRequest类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap