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


PHP Web::session方法代码示例

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


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

示例1: login_POST

function login_POST(Web &$w)
{
    if ($_POST['login'] && $_POST['password']) {
        $client_timezone = "Australia/Sydney";
        //$_POST['user_timezone'];
        $user = $w->Auth->login($_POST['login'], $_POST['password'], $client_timezone);
        if ($user) {
            if ($w->session('orig_path') != "auth/login") {
                $url = $w->session('orig_path');
                $w->Log->debug("Original path: " . $url);
                // If no url specified, go to the users defined url
                if (empty($url) || $url == "/") {
                    $url = $user->redirect_url;
                }
                $w->sessionUnset('orig_path');
                $w->redirect($w->localUrl($url));
            } else {
                $w->redirect(!empty($user->redirect_url) ? $w->localUrl($user->redirect_url) : $w->localUrl());
            }
        } else {
            $w->error("Login or Password incorrect", "/auth/login");
        }
    } else {
        $w->error("Please enter your login and password", "/auth/login");
    }
}
开发者ID:itillawarra,项目名称:cmfive,代码行数:26,代码来源:login.php

示例2: reportAjaxCategorytoType_ALL

function reportAjaxCategorytoType_ALL(Web $w)
{
    $type = array();
    list($category, $module) = preg_split('/_/', $w->request('id'));
    // organise criteria
    $who = $w->session('user_id');
    $where = array();
    if (!empty($module)) {
        $where['report.module'] = $module;
    }
    if (!empty($category)) {
        $where['report.category'] = $category;
    }
    // get report categories from available report list
    $reports = $w->Report->getReportsbyUserWhere($who, $where);
    if ($reports) {
        foreach ($reports as $report) {
            $arrtype = preg_split("/,/", $report->sqltype);
            foreach ($arrtype as $rtype) {
                $rtype = trim($rtype);
                if (!array_key_exists(strtolower($rtype), $type)) {
                    $type[strtolower($rtype)] = array(strtolower($rtype), strtolower($rtype));
                }
            }
        }
    }
    if (empty($type)) {
        $type = array(array("No Reports", ""));
    }
    $w->setLayout(null);
    $w->out(json_encode(Html::select("type", $type)));
}
开发者ID:itillawarra,项目名称:cmfive,代码行数:32,代码来源:reportAjaxCategorytoType.php

示例3: reportAjaxModuletoCategory_ALL

function reportAjaxModuletoCategory_ALL(Web $w)
{
    $category = array();
    $module = $w->request('id');
    // organise criteria
    $who = $w->session('user_id');
    $where = array();
    if ($module != "") {
        $where['report.module'] = $module;
    }
    // get report categories from available report list
    $reports = $w->Report->getReportsbyUserWhere($who, $where);
    if ($reports) {
        foreach ($reports as $report) {
            if (!array_key_exists($report->category, $category)) {
                $category[$report->category] = array($report->getCategoryTitle(), $report->category);
            }
        }
    }
    if (!$category) {
        $category = array(array("No Reports", ""));
    }
    // load Category dropdown and return
    $category = Html::select("category", $category);
    $w->setLayout(null);
    $w->out(json_encode($category));
}
开发者ID:itillawarra,项目名称:cmfive,代码行数:27,代码来源:reportAjaxModuletoCategory.php

示例4: groupmember_POST

function groupmember_POST(Web $w)
{
    $p = $w->pathMatch("group_id");
    $member_id = $w->request('member_id');
    $group_id = $p['group_id'];
    $is_owner = $w->request('is_owner');
    $exceptions = array();
    // store all parent groups in session
    $groupUsers = $w->Auth->getUser($group_id)->isInGroups();
    if ($groupUsers) {
        foreach ($groupUsers as $groupUser) {
            $groupUser->getParents();
        }
    }
    // add member to the group only if it isn't already in there
    // this logic should move to the model!
    $existUser = $w->Auth->getUser($member_id)->isInGroups($group_id);
    if (!$existUser) {
        if (!$w->session('parents') || !in_array($member_id, $w->session('parents'))) {
            $groupMember = new GroupUser($w);
            $groupMember->group_id = $group_id;
            $groupMember->user_id = $member_id;
            $groupMember->role = $is_owner && $is_owner == 1 ? "owner" : "member";
            $groupMember->insert();
        }
        if ($w->session('parents') && in_array($member_id, $w->session('parents'))) {
            $exceptions[] = $w->Auth->getUser($member_id)->login;
        }
    } else {
        $user = $existUser[0]->getUser();
        $exceptions[] = $user->is_group == 1 ? $user->login : $user->getContact()->getFullName();
    }
    $w->sessionUnset('parents');
    if (!empty($exceptions)) {
        $w->error(implode(", ", $exceptions) . " can not be added!", "/admin/moreInfo/" . $group_id);
    } else {
        $w->msg("New members are added!", "/admin/moreInfo/" . $group_id);
    }
}
开发者ID:itillawarra,项目名称:cmfive,代码行数:39,代码来源:groupmember.php

示例5: reportAjaxListModules_ALL

function reportAjaxListModules_ALL(Web $w)
{
    $modules = array();
    // organise criteria
    $who = $w->session('user_id');
    $where = "";
    // get report categories from available report list
    $reports = $w->Report->getReportsbyUserWhere($who, $where);
    if ($reports) {
        foreach ($reports as $report) {
            if (!array_key_exists($report->module, $modules)) {
                $modules[$report->module] = array(ucfirst($report->module), $report->module);
            }
        }
    }
    if (!$modules) {
        $modules = array(array("No Reports", ""));
    }
    // load Module dropdown and return
    $modules = Html::select("module", $modules);
    $w->setLayout(null);
    $w->out(json_encode($modules));
}
开发者ID:itillawarra,项目名称:cmfive,代码行数:23,代码来源:reportAjaxListModules.php


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