Exemplo n.º 1
0
// 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)
    $masslogCookieSet = isset($_COOKIE['ocsuppressmasslogwarn']);
    if ($masslogCookieSet) {
        $masslogCookieContent = $_COOKIE['ocsuppressmasslogwarn'] + 0;
    } else {
        // save masslog acception in cookie that expires on midnight if clicked
Exemplo n.º 2
0
    $tpl->add_header_javascript('resource2/tinymce/config/log.js.php?logid=0&lang=' . strtolower($opt['template']['locale']));
} else {
    $tpl->assign('smileys', smileys::getSmileysArray());
}
// build logtype list
$rs = sql("SELECT `log_types`.`id`, IFNULL(`sys_trans_text`.`text`, `log_types`.`name`) AS `name`\r\n\t             FROM `caches` \r\n\t       INNER JOIN `cache_type` ON `caches`.`type`=`cache_type`.`id` \r\n\t       INNER JOIN `cache_logtype` ON `cache_type`.`id`=`cache_logtype`.`cache_type_id` \r\n\t       INNER JOIN `log_types` ON `cache_logtype`.`log_type_id`=`log_types`.`id` \r\n\t        LEFT JOIN `sys_trans` ON `log_types`.`trans_id`=`sys_trans`.`id` \r\n\t        LEFT JOIN `sys_trans_text` ON `sys_trans`.`id`=`sys_trans_text`.`trans_id` AND `sys_trans_text`.`lang`='&1' \r\n\t            WHERE `caches`.`cache_id`='&2'", $opt['template']['locale'], $nCacheId);
$tpl->assign_rs('logtypes', $rs);
sql_free_result($rs);
$tpl->assign('logType', $nLogType);
$tpl->assign('descMode', $nDescMode);
if ($nDescMode != 1) {
    $tpl->assign('logText', htmlspecialchars($sLogText, ENT_COMPAT, 'UTF-8'), true);
} else {
    $tpl->assign('logText', $sLogText);
}
$tpl->assign('noLogTypeSelected', $noLogTypeSelected);
$tpl->assign('dateFormatInvalid', !$bDateFormatValid);
$tpl->assign('requireLogPW', $cache->requireLogPW());
$tpl->assign('logPWValid', $bLogPWValid);
$tpl->assign('logDateDay', $nLogDateDay);
$tpl->assign('logDateMonth', $nLogDateMonth);
$tpl->assign('logDateYear', $nLogDateYear);
$tpl->assign('userRecommended', $cache->isRecommendedByUser($login->userid));
$tpl->assign('userRecommendationPossible', $nUserRecommendationPossible);
$tpl->assign('userRecommendationUsed', $nUserRecommendationUsed);
$tpl->assign('userRecommendationRequiredFinds', $nUserRecommendationRequiredFinds);
// TODO: $cache->getTemplateInfo()
$rCache['cacheid'] = $nCacheId;
$rCache['cachename'] = $cache->getName();
$tpl->assign('cache', $rCache);
$tpl->display();