Пример #1
0
    }
    $usergroup_info = array();
    $usergroup_data = $db->query_read("\n\t\tSELECT projectpermission.*,\n\t\t\tusergroup.usergroupid, usergroup.title, usergroup.ptpermissions\n\t\tFROM " . TABLE_PREFIX . "usergroup AS usergroup\n\t\tLEFT JOIN " . TABLE_PREFIX . "pt_projectpermission AS projectpermission ON\n\t\t\t(usergroup.usergroupid = projectpermission.usergroupid AND projectpermission.projectid = 0)\n\t\tWHERE usergroup.usergroupid = " . $vbulletin->GPC['usergroupid']);
    while ($usergroup = $db->fetch_array($usergroup_data)) {
        if ($usergroup['issuetypeid']) {
            $perms = $usergroup;
            unset($perms['usergroupid'], $perms['projectid'], $perms['issuetypeid'], $perms['title']);
            $global_permissions["{$usergroup['issuetypeid']}"] = $perms;
        }
        $usergroup_info = array('title' => $usergroup['title'], 'usergroupid' => $usergroup['usergroupid'], 'ptpermissions' => $usergroup['ptpermissions']);
    }
    if (!$usergroup_info) {
        print_stop_message('invalid_action_specified');
    }
    if ($vbulletin->GPC['projectid']) {
        $project = fetch_project_info($vbulletin->GPC['projectid']);
        $projecttype_options = $db->query_read("\n\t\t\tSELECT *\n\t\t\tFROM " . TABLE_PREFIX . "pt_projecttype\n\t\t\tWHERE projectid = {$project['projectid']}\n\t\t");
        $issuetype_options = array();
        while ($issuetype = $db->fetch_array($projecttype_options)) {
            $issuetype_options["{$issuetype['issuetypeid']}"] = $vbphrase["issuetype_{$issuetype['issuetypeid']}_singular"];
        }
    }
    $issue_types_js = array();
    foreach ($issuetype_options as $issuetypeid => $phrase) {
        $issue_types_js[] = "'{$issuetypeid}'";
    }
    ?>
<script type="text/javascript">
<!--

var issue_types = new Array(<?php 
Пример #2
0
 /**
  * Updates the counters of the associated project based on old/new visibility values
  *
  * @param	string|null	Old/existing visibility. Null if this is an insert
  * @param	string|null	New visiblity value. Null if this is a delete.
  * @param	string|null	Old/existing status. Null if this is an insert
  * @param	string|null	New status value. Null if this is a delete.
  */
 function update_project_counters($old_vis, $new_vis, $old_status, $new_status)
 {
     if (!($project = fetch_project_info($this->fetch_field('projectid'), false))) {
         return false;
     }
     $update = array();
     if ($old_vis == $new_vis) {
         // we didn't change any counters, do nothing
     } else {
         if ($new_vis == 'visible') {
             // didn't have an old visibility (inserting) or the new value is visible
             // (implicitly, by the first if, the old visiblity is not visible) -- add
             $update[] = "issuecount = issuecount + 1";
         } else {
             if ($old_vis == 'visible') {
                 // no new visibility (deleting) or we're making a visible issue
                 // invisible -- subtract
                 $update[] = "issuecount = issuecount - 1";
             }
         }
     }
     // determine if open issue count needs to be updated because of status change
     if ($new_vis == 'visible' and $old_status != $new_status) {
         $old_status_info = false;
         $new_status_info = false;
         $status_sql = $this->registry->db->query_read("\r\n\t\t\t\tSELECT *\r\n\t\t\t\tFROM " . TABLE_PREFIX . "pt_issuestatus\r\n\t\t\t\tWHERE issuestatusid IN (" . intval($old_status) . "," . intval($new_status) . ")\r\n\t\t\t");
         while ($status = $this->registry->db->fetch_array($status_sql)) {
             if ($status['issuestatusid'] == $old_status) {
                 $old_status_info = $status;
             } else {
                 if ($status['issuestatusid'] == $new_status) {
                     $new_status_info = $status;
                 }
             }
         }
         if ($new_status_info and $new_status_info['issuecompleted'] == 0) {
             if (!$old_status_info or $old_status_info['issuecompleted'] == 1) {
                 $update[] = "issuecountactive = issuecountactive + 1";
             }
         } else {
             if ($old_status_info and $old_status_info['issuecompleted'] == 0) {
                 if (!$new_status_info or $new_status_info['issuecompleted'] == 1) {
                     $update[] = "issuecountactive = issuecountactive - 1";
                 }
             }
         }
     }
     $projecttypeinfo = $this->registry->db->query_first("\r\n\t\t\tSELECT *\r\n\t\t\tFROM " . TABLE_PREFIX . "pt_projecttype\r\n\t\t\tWHERE projectid = {$project['projectid']}\r\n\t\t\t\tAND issuetypeid = '" . $this->registry->db->escape_string($this->fetch_field('issuetypeid')) . "'\r\n\t\t");
     if ($new_vis == 'visible') {
         $lastactivity = intval($this->fetch_field('lastactivity'));
         if ($lastactivity > $projecttypeinfo['lastactivity']) {
             $update[] = "lastactivity = {$lastactivity}";
         }
         // update on >= to ensure that all the info from the first note in an issue is used
         $lastpost = intval($this->fetch_field('lastpost'));
         if ($lastpost >= $projecttypeinfo['lastpost']) {
             $update[] = "lastpost = {$lastpost}";
             $update[] = "lastpostuserid = " . intval($this->fetch_field('lastpostuserid'));
             $update[] = "lastpostusername = '******'lastpostusername')) . "'";
             $update[] = "lastpostid = " . intval($this->fetch_field('lastnoteid'));
             $update[] = "lastissueid = " . intval($this->fetch_field('issueid'));
             $update[] = "lastissuetitle = '" . $this->registry->db->escape_string($this->fetch_field('title')) . "'";
             $this->registry->db->query_write("\r\n\t\t\t\t\tDELETE FROM " . TABLE_PREFIX . "pt_projecttypeprivatelastpost\r\n\t\t\t\t\tWHERE projectid = {$project['projectid']}\r\n\t\t\t\t\t\tAND issuetypeid = '" . $this->registry->db->escape_string($this->fetch_field('issuetypeid')) . "'\r\n\t\t\t\t");
         }
     }
     if ($update) {
         $this->registry->db->query_write("\r\n\t\t\t\tUPDATE " . TABLE_PREFIX . "pt_projecttype SET\r\n\t\t\t\t\t" . implode(', ', $update) . "\r\n\t\t\t\tWHERE projectid = {$project['projectid']}\r\n\t\t\t\t\tAND issuetypeid = '" . $this->registry->db->escape_string($this->fetch_field('issuetypeid')) . "'\r\n\t\t\t");
     }
     return true;
 }
Пример #3
0
/**
* Verifies that an issue type is valid. Errors if not.
*
* @param	string	Issue type ID
* @param	integer	Project ID.
*/
function verify_issuetypeid($issuetypeid, $projectid)
{
    global $vbulletin, $vbphrase;
    $project = fetch_project_info($projectid);
    if (!$project) {
        standard_error(fetch_error('invalidid', $vbphrase['issue_type'], $vbulletin->options['contactuslink']));
    }
    $types = $vbulletin->pt_projects["{$project['projectid']}"]['types'];
    if (!isset($types["{$issuetypeid}"])) {
        standard_error(fetch_error('invalidid', $vbphrase['issue_type'], $vbulletin->options['contactuslink']));
    }
    $issueperms = fetch_project_permissions($vbulletin->userinfo, $projectid, $issuetypeid);
    if (!($issueperms['generalpermissions'] & $vbulletin->pt_bitfields['general']['canview'])) {
        print_no_permission();
    }
    return true;
}
Пример #4
0
/**
* Sends assignment notification when a user is assigned
*
* @param	integer	Issueid to send notification for
* @param	integer	User who is being assigned this issue
* @param	integer	User who assigned this issue
*/
function send_issue_assignment_notification($issueid, $assignee, $assigner)
{
    global $vbulletin, $vbphrase;
    $issue = fetch_issue_info($issueid);
    // invalid issue
    if (!$issue) {
        return;
    }
    // no need for notification to yourself
    if ($assignee == $assigner) {
        return;
    }
    $project = fetch_project_info($issue['projectid']);
    $assignee_userinfo = fetch_userinfo($assignee);
    if (verify_issue_perms($issue, $assignee_userinfo) === false) {
        return;
    }
    $assigner_userinfo = fetch_userinfo($assigner);
    $issue['title'] = unhtmlspecialchars($issue['title']);
    $project['title'] = unhtmlspecialchars($project['title']);
    $assignee_userinfo['username'] = unhtmlspecialchars($assignee_userinfo['username']);
    $assigner_userinfo['username'] = unhtmlspecialchars($assigner_userinfo['username']);
    eval(fetch_email_phrases('pt_issueassignment', $assignee_userinfo['languageid']));
    vbmail($assignee_userinfo['email'], $subject, $message, true);
}