Example #1
0
         $issuetypeid = '';
     }
 }
 if (!empty($issuetypeid) and empty($issuenewcount) and !empty($issueoldcount) and $issue_list->real_pagenumber == 1 and $issue_list->sort_field == 'lastpost' and $issue_list->sort_order == 'desc') {
     arsort($issueoldcount, SORT_NUMERIC);
     $issuelastposttime = current($issueoldcount);
     $marking = ($vbulletin->options['threadmarking'] and $vbulletin->userinfo['userid']);
     if ($marking) {
         $projectview = max($projectread["{$issuetypeid}"], TIMENOW - $vbulletin->options['markinglimit'] * 86400);
     } else {
         $projectview = intval(fetch_bbarray_cookie('project_lastview', $project['projectid'] . $issuetypeid));
         if (!$projectview) {
             $projectview = $vbulletin->userinfo['lastvisit'];
         }
     }
     $perms_sql = build_issue_permissions_sql($vbulletin->userinfo);
     if ($issuelastposttime >= $projectview and $perms_sql["{$project['projectid']}"]["{$issuetypeid}"]) {
         // TODO: may need to change this to take into account private replies
         $unread = $db->query_first("\r\n\t\t\t\tSELECT COUNT(*) AS count\r\n\t\t\t\tFROM " . TABLE_PREFIX . "pt_issue AS issue\r\n\t\t\t\t" . ($marking ? "\r\n\t\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "pt_issueread AS issueread ON (issueread.issueid = issue.issueid AND issueread.userid = " . $vbulletin->userinfo['userid'] . ")\r\n\t\t\t\t" : '') . "\r\n\t\t\t\tWHERE issue.projectid = {$project['projectid']}\r\n\t\t\t\t\tAND " . $perms_sql["{$project['projectid']}"]["{$issuetypeid}"] . "\r\n\t\t\t\t\tAND issue.lastpost > " . intval($projectview) . "\r\n\t\t\t\t\t" . ($marking ? "\r\n\t\t\t\t\t\tAND issue.lastpost > IF(issueread.readtime IS NOT NULL, issueread.readtime, " . intval(TIMENOW - $vbulletin->options['markinglimit'] * 86400) . ")\r\n\t\t\t\t\t" : '') . "\r\n\t\t\t");
         if ($unread['count'] == 0) {
             mark_project_read($project['projectid'], $issuetypeid, TIMENOW);
         }
     }
 }
 // issue type selection options
 $issuetype_options = build_issuetype_select($projectperms, array_keys($vbulletin->pt_projects["{$project['projectid']}"]['types']), $vbulletin->GPC['issuetypeid']);
 $any_issuetype_selected = !$vbulletin->GPC['issuetypeid'] ? ' selected="selected"' : '';
 // version options
 $version_cache = array();
 foreach ($vbulletin->pt_versions as $version) {
     if ($version['projectid'] != $project['projectid']) {
Example #2
0
/**
* Marks a issue as read using the appropriate method.
*
* @param	array	Array of data for the issue being marked
* @param	integer	Unix timestamp that the issue is being marked read
*/
function mark_issue_read($issueinfo, $time)
{
    global $vbulletin, $db;
    $userid = $vbulletin->userinfo['userid'];
    $time = intval($time);
    if ($vbulletin->options['threadmarking'] and $vbulletin->userinfo['userid']) {
        $db->query_write("\r\n\t\t\tREPLACE INTO " . TABLE_PREFIX . "pt_issueread\r\n\t\t\t\t(issueid, userid, readtime)\r\n\t\t\tVALUES\r\n\t\t\t\t({$issueinfo['issueid']}, " . $vbulletin->userinfo['userid'] . ", {$time})\r\n\t\t");
        // in case of automatic project marking
        if ($vbulletin->options['threadmarking'] == 2) {
            $perms_sql = build_issue_permissions_sql($vbulletin->userinfo);
            if (!empty($perms_sql["{$issueinfo['projectid']}"]["{$issueinfo['issuetypeid']}"])) {
                // TODO: be aware of private replies
                $unread = $db->query_first("\r\n\t\t\t\t\tSELECT COUNT(*) AS count\r\n\t\t\t\t\tFROM " . TABLE_PREFIX . "pt_issue AS issue\r\n\t\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "pt_issueread AS issueread ON (issueread.issueid = issue.issueid AND issueread.userid = " . $vbulletin->userinfo['userid'] . ")\r\n\t\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "pt_projectread AS projectread ON (projectread.projectid = issue.projectid AND projectread.userid = " . $vbulletin->userinfo['userid'] . " AND projectread.issuetypeid = issue.issuetypeid)\r\n\t\t\t\t\tWHERE issue.projectid = {$issueinfo['projectid']}\r\n\t\t\t\t\t\tAND " . $perms_sql["{$issueinfo['projectid']}"]["{$issueinfo['issuetypeid']}"] . "\r\n\t\t\t\t\t\tAND issue.lastpost > " . intval(TIMENOW - $vbulletin->options['markinglimit'] * 86400) . "\r\n\t\t\t\t\t\tAND issue.lastpost > IF(issueread.readtime IS NOT NULL, issueread.readtime, " . intval(TIMENOW - $vbulletin->options['markinglimit'] * 86400) . ")\r\n\t\t\t\t\t\tAND issue.lastpost > IF(projectread.readtime IS NOT NULL, projectread.readtime, " . intval(TIMENOW - $vbulletin->options['markinglimit'] * 86400) . ")\r\n\t\t\t\t");
                if ($unread['count'] == 0) {
                    mark_project_read($issueinfo['projectid'], $issueinfo['issuetypeid'], TIMENOW);
                }
            }
        }
    } else {
        set_bbarray_cookie('issue_lastview', $issueinfo['issueid'], $time);
    }
}
Example #3
0
        if ($unsubscribe) {
            $db->query_write("\r\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "pt_issuereportsubscribe\r\n\t\t\t\tWHERE userid = " . $vbulletin->userinfo['userid'] . "\r\n\t\t\t\t\tAND issuereportid IN (" . implode(',', $unsubscribe) . ")\r\n\t\t\t");
        }
        if ($subscribe) {
            $db->query_write("\r\n\t\t\t\tINSERT IGNORE INTO " . TABLE_PREFIX . "pt_issuereportsubscribe\r\n\t\t\t\t\t(issuereportid, userid)\r\n\t\t\t\tVALUES\r\n\t\t\t\t\t" . implode(',', $subscribe));
        }
    }
    $vbulletin->url = 'projectsearch.php?' . $vbulletin->session->vars['sessionurl'] . 'do=reports';
    eval(print_standard_redirect('pt_report_subscriptions_updated'));
}
// #######################################################################
if ($_REQUEST['do'] == 'reports') {
    $can_delete_public = ($vbulletin->userinfo['permissions']['ptpermissions'] & $vbulletin->bf_ugp_ptpermissions['candeletepublicreportown'] or $vbulletin->userinfo['permissions']['ptpermissions'] & $vbulletin->bf_ugp_ptpermissions['candeletepublicreportothers']);
    ($hook = vBulletinHook::fetch_hook('projectsearch_reportlist_start')) ? eval($hook) : false;
    $reports = $db->query_read("\r\n\t\tSELECT issuereport.*, IF(issuereportsubscribe.issuesearchid IS NOT NULL, 1, 0) AS issubscribed,\r\n\t\t\tuser.username\r\n\t\tFROM " . TABLE_PREFIX . "pt_issuereport AS issuereport\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "pt_issuereportsubscribe AS issuereportsubscribe ON\r\n\t\t\t(issuereport.issuereportid = issuereportsubscribe.issuereportid AND issuereportsubscribe.userid = " . $vbulletin->userinfo['userid'] . ")\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = issuereport.userid)\r\n\t\tWHERE (issuereport.public = 1 OR (issuereport.public = 0 AND issuereport.userid = " . $vbulletin->userinfo['userid'] . "))\r\n\t\tORDER BY issuereport.public, issubscribed, issuereport.title\r\n\t");
    $viewable_projects = build_issue_permissions_sql($vbulletin->userinfo);
    $reportbits = '';
    while ($report = $db->fetch_array($reports)) {
        if (!can_view_report($report, $viewable_projects)) {
            continue;
        }
        $report['description'] = nl2br($report['description']);
        exec_switch_bg();
        if ($report['public']) {
            $colspan = $can_delete_public ? 4 : 3;
            $show['submitted_user'] = true;
            $show['delete_option'] = ($vbulletin->userinfo['permissions']['ptpermissions'] & $vbulletin->bf_ugp_ptpermissions['candeletepublicreportothers'] or $vbulletin->userinfo['permissions']['ptpermissions'] & $vbulletin->bf_ugp_ptpermissions['candeletepublicreportown'] and $vbulletin->userinfo['userid'] == $report['userid']);
            $show['delete_public_column'] = $can_delete_public;
            ($hook = vBulletinHook::fetch_hook('projectsearch_report_bit')) ? eval($hook) : false;
            eval('$publicreportbits .= "' . fetch_template('pt_reportbit') . '";');
        } else {