예제 #1
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();
예제 #2
0
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();
}
예제 #3
0
$reportreason = isset($_REQUEST['reason']) ? $_REQUEST['reason'] + 0 : 0;
$reportnote = isset($_REQUEST['note']) ? $_REQUEST['note'] : '';
$maxreason = sql_value('SELECT MAX(`id`) FROM `cache_report_reasons`', 0);
if (isset($_REQUEST['ok'])) {
    $bError = false;
    if ($reportnote == '') {
        $bError = true;
        $tpl->assign('errorNoteEmpty', true);
    }
    if ($reportreason < 1 || $reportreason > $maxreason) {
        $bError = true;
        $tpl->assign('errorReasonEmpty', true);
    }
    if ($bError == false) {
        if ($cache->report($login->userid, $reportreason, $reportnote)) {
            $reasontext = sql_value("SELECT IFNULL(`tt`.`text`, `crr`.`name`)\r\n\t\t\t\t\t\t\t   FROM `cache_report_reasons` AS `crr`\r\n\t\t\t\t\t\t\t  INNER JOIN `sys_trans_text` AS `tt` ON `tt`.`trans_id`=`crr`.`trans_id`\r\n\t\t\t\t\t\t\t  WHERE `crr`.`id` =&1\r\n\t\t\t\t\t\t\t    AND `tt`.`lang`='&2'", 'unknown', $reportreason, $opt['template']['locale']);
            $tpl->assign('reasontext', $reasontext);
            $tpl->assign('success', true);
        } else {
            $tpl->assign('errorUnkown', true);
        }
    }
}
$rs = sql("SELECT `cache_report_reasons`.`id`, IFNULL(`sys_trans_text`.`text`, `cache_report_reasons`.`name`) AS `name`\r\n\t             FROM `cache_report_reasons`\r\n\t        LEFT JOIN `sys_trans` ON `cache_report_reasons`.`trans_id`=`sys_trans`.`id` AND `cache_report_reasons`.`name`=`sys_trans`.`text`\r\n\t        LEFT JOIN `sys_trans_text` ON `sys_trans`.`id`=`sys_trans_text`.`trans_id` AND `sys_trans_text`.`lang`='&1'", $opt['template']['locale']);
$tpl->assign_rs('reasons', $rs);
sql_free_result($rs);
$tpl->assign('reason', $reportreason);
$tpl->assign('note', $reportnote);
$tpl->assign('cacheid', $cacheid);
$tpl->assign('cachename', $cache->getName());
$tpl->display();