當前位置: 首頁>>代碼示例>>PHP>>正文


PHP cache::getUserId方法代碼示例

本文整理匯總了PHP中cache::getUserId方法的典型用法代碼示例。如果您正苦於以下問題:PHP cache::getUserId方法的具體用法?PHP cache::getUserId怎麽用?PHP cache::getUserId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cache的用法示例。


在下文中一共展示了cache::getUserId方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: listRequestsByCacheId

function listRequestsByCacheId($cacheid)
{
    global $tpl, $login;
    // cache exists?
    $cache = new cache($cacheid);
    if ($cache->exist() == false) {
        $tpl->error(ERROR_CACHE_NOT_EXISTS);
    }
    // is the current user the owner of the cache?
    if ($cache->getUserId() != $login->userid) {
        $tpl->error(ERROR_NO_ACCESS);
    }
    $rs = sql("SELECT \n             `caches`.`cache_id` AS `id`,\n             `user`.`user_id` AS `userid`,\n             `user`.`username` AS `username`, \n             `cache_adoption`.`date_created`\n\t     FROM `caches`\n\t     INNER JOIN `cache_adoption` \n\t         ON `caches`.`cache_id` = `cache_adoption`.`cache_id`\n\t     INNER JOIN `user` \n\t         ON `cache_adoption`.`user_id`=`user`.`user_id`\n\t\t WHERE `caches`.`cache_id`='&1'", $cacheid);
    $tpl->assign_rs('adoptions', $rs);
    sql_free_result($rs);
    $tpl->assign('cachename', $cache->getName());
    $tpl->display();
}
開發者ID:kirstenko,項目名稱:oc-server3,代碼行數:18,代碼來源:adoptcache.php

示例2: array

// prepare array to indicate errors in template
$validate = array();
// log and cache type which can be combined with maintenance state flags
$rs = sql("SELECT `id` FROM `log_types` WHERE `maintenance_logs`");
$logtype_allows_nm = sql_fetch_column($rs);
// proceed loggable, if valid cache_id
$validate['logAllowed'] = true;
if ($cacheId != 0) {
    // get cache object
    $cache = new cache($cacheId);
    // check log allowed, depending on cache state and logged in user
    $validate['logAllowed'] = $cache->allowLog();
    // get user object
    $user = new user($login->userid);
    // is user cache owner
    $isOwner = $user->getUserId() == $cache->getUserId();
    // assing ratings to template
    $tpl->assign('ratingallowed', $user->allowRatings());
    $tpl->assign('givenratings', $user->getGivenRatings());
    $tpl->assign('maxratings', $user->getMaxRatings());
    $tpl->assign('israted', $cache->isRecommendedByUser($user->getUserId()));
    $tpl->assign('foundsuntilnextrating', $user->foundsUntilNextRating());
    $tpl->assign('isowner', $isOwner);
    // check and prepare form values
    $datesaved = isset($_COOKIE['oclogdate1']) && isset($_COOKIE['oclogdate2']);
    if ($datesaved) {
        $defaultLogYear = substr($_COOKIE['oclogdate1'], 0, 4);
        $defaultLogMonth = substr($_COOKIE['oclogdate1'], 4, 2);
        $defaultLogDay = substr($_COOKIE['oclogdate1'], 6, 2);
    }
    // check if masslog warning is accepted (in cookie)
開發者ID:kirstenko,項目名稱:oc-server3,代碼行數:31,代碼來源:log.php

示例3: addRequest

function addRequest($cacheid, $userid)
{
    global $tpl;
    // cache exists?
    $cache = new cache($cacheid);
    if ($cache->exist() == false) {
        $tpl->error(ERROR_CACHE_NOT_EXISTS);
    }
    if ($cache->allowEdit() == false) {
        $tpl->error(ERROR_NO_ACCESS);
    }
    if ($cache->getUserId() == $userid) {
        $tpl->assign('error', 'sameuser');
        $tpl->display();
    } else {
        if ($cache->addAdoption($userid) == false) {
            $tpl->error(ERROR_UNKNOWN);
        }
        $tpl->redirect('adoptcache.php?action=listbycache&cacheid=' . $cacheid);
    }
}
開發者ID:RH-Code,項目名稱:opencaching,代碼行數:21,代碼來源:adoptcache.php


注:本文中的cache::getUserId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。