Exemplo n.º 1
0
 /**
  * Additional data to update after a delete call (such as denormalized values in other tables).
  *
  * @param	boolean	Do the query?
  */
 function post_delete($doquery = true)
 {
     $projectid = intval($this->fetch_field('projectid'));
     $db =& $this->registry->db;
     // project related data
     $db->query_write("\r\n\t\t\tDELETE FROM " . TABLE_PREFIX . "pt_projecttype\r\n\t\t\tWHERE projectid = {$projectid}\r\n\t\t");
     $db->query_write("\r\n\t\t\tDELETE FROM " . TABLE_PREFIX . "pt_projecttypeprivatelastpost\r\n\t\t\tWHERE projectid = {$projectid}\r\n\t\t");
     $db->query_write("\r\n\t\t\tDELETE FROM " . TABLE_PREFIX . "pt_projectpermission\r\n\t\t\tWHERE projectid = {$projectid}\r\n\t\t");
     $db->query_write("\r\n\t\t\tDELETE FROM " . TABLE_PREFIX . "pt_projectversion\r\n\t\t\tWHERE projectid = {$projectid}\r\n\t\t");
     $db->query_write("\r\n\t\t\tDELETE FROM " . TABLE_PREFIX . "pt_projectversiongroup\r\n\t\t\tWHERE projectid = {$projectid}\r\n\t\t");
     $db->query_write("\r\n\t\t\tDELETE FROM " . TABLE_PREFIX . "pt_projectcategory\r\n\t\t\tWHERE projectid = {$projectid}\r\n\t\t");
     // MySQL 4 needs to use the non-aliased tables in multi-table deletes (#23024)
     $mysqlversion = $db->query_first("SELECT version() AS version");
     $include_prefix = version_compare($mysqlversion['version'], '4.1.0', '<');
     // clear out all the issue data
     $db->query_write("\r\n\t\t\tDELETE " . ($include_prefix ? TABLE_PREFIX . 'pt_' : '') . "issueassign\r\n\t\t\tFROM " . TABLE_PREFIX . "pt_issueassign AS issueassign\r\n\t\t\tINNER JOIN " . TABLE_PREFIX . "pt_issue AS issue ON (issue.issueid = issueassign.issueid)\r\n\t\t\tWHERE issue.projectid = {$projectid}\r\n\t\t");
     $db->query_write("\r\n\t\t\tDELETE " . ($include_prefix ? TABLE_PREFIX . 'pt_' : '') . "issueattach\r\n\t\t\tFROM " . TABLE_PREFIX . "pt_issueattach AS issueattach\r\n\t\t\tINNER JOIN " . TABLE_PREFIX . "pt_issue AS issue ON (issue.issueid = issueattach.issueid)\r\n\t\t\tWHERE issue.projectid = {$projectid}\r\n\t\t");
     $db->query_write("\r\n\t\t\tDELETE " . ($include_prefix ? TABLE_PREFIX . 'pt_' : '') . "issuechange\r\n\t\t\tFROM " . TABLE_PREFIX . "pt_issuechange AS issuechange\r\n\t\t\tINNER JOIN " . TABLE_PREFIX . "pt_issue AS issue ON (issue.issueid = issuechange.issueid)\r\n\t\t\tWHERE issue.projectid = {$projectid}\r\n\t\t");
     $db->query_write("\r\n\t\t\tDELETE " . ($include_prefix ? TABLE_PREFIX . 'pt_' : '') . "issuesubscribe\r\n\t\t\tFROM " . TABLE_PREFIX . "pt_issuesubscribe AS issuesubscribe\r\n\t\t\tINNER JOIN " . TABLE_PREFIX . "pt_issue AS issue ON (issue.issueid = issuesubscribe.issueid)\r\n\t\t\tWHERE issue.projectid = {$projectid}\r\n\t\t");
     $db->query_write("\r\n\t\t\tDELETE " . ($include_prefix ? TABLE_PREFIX . 'pt_' : '') . "issuetag\r\n\t\t\tFROM " . TABLE_PREFIX . "pt_issuetag AS issuetag\r\n\t\t\tINNER JOIN " . TABLE_PREFIX . "pt_issue AS issue ON (issue.issueid = issuetag.issueid)\r\n\t\t\tWHERE issue.projectid = {$projectid}\r\n\t\t");
     $db->query_write("\r\n\t\t\tDELETE " . ($include_prefix ? TABLE_PREFIX . 'pt_' : '') . "issuevote\r\n\t\t\tFROM " . TABLE_PREFIX . "pt_issuevote AS issuevote\r\n\t\t\tINNER JOIN " . TABLE_PREFIX . "pt_issue AS issue ON (issue.issueid = issuevote.issueid)\r\n\t\t\tWHERE issue.projectid = {$projectid}\r\n\t\t");
     $db->query_write("\r\n\t\t\tDELETE " . ($include_prefix ? TABLE_PREFIX . 'pt_' : '') . "issuedeletionlog\r\n\t\t\tFROM " . TABLE_PREFIX . "pt_issuedeletionlog AS issuedeletionlog\r\n\t\t\tINNER JOIN " . TABLE_PREFIX . "pt_issue AS issue ON (issue.issueid = issuedeletionlog.primaryid AND issuedeletionlog.type = 'issue')\r\n\t\t\tWHERE issue.projectid = {$projectid}\r\n\t\t");
     $db->query_write("\r\n\t\t\tDELETE " . ($include_prefix ? TABLE_PREFIX . 'pt_' : '') . "issuenote\r\n\t\t\tFROM " . TABLE_PREFIX . "pt_issuenote AS issuenote\r\n\t\t\tINNER JOIN " . TABLE_PREFIX . "pt_issue AS issue ON (issue.issueid = issuenote.issueid)\r\n\t\t\tWHERE issue.projectid = {$projectid}\r\n\t\t");
     $db->query_write("\r\n\t\t\tDELETE " . ($include_prefix ? TABLE_PREFIX . 'pt_' : '') . "issueprivatelastpost\r\n\t\t\tFROM " . TABLE_PREFIX . "pt_issueprivatelastpost AS issueprivatelastpost\r\n\t\t\tINNER JOIN " . TABLE_PREFIX . "pt_issue AS issue ON (issue.issueid = issueprivatelastpost.issueid)\r\n\t\t\tWHERE issue.projectid = {$projectid}\r\n\t\t");
     $db->query_write("\r\n\t\t\tDELETE FROM " . TABLE_PREFIX . "pt_issue\r\n\t\t\tWHERE projectid = {$projectid}\r\n\t\t");
     require_once DIR . '/includes/adminfunctions_projecttools.php';
     build_project_cache();
     build_version_cache();
     build_assignable_users();
     // builds bitfields and perms as well
     build_pt_user_list('pt_report_users', 'pt_report_user_cache');
     $this->update_project_forum_setting(false);
     ($hook = vBulletinHook::fetch_hook('pt_projectdata_delete')) ? eval($hook) : false;
     return true;
 }
Exemplo n.º 2
0
    if (!$project) {
        print_stop_message('invalid_action_specified');
    }
    print_delete_confirmation('pt_project', $project['projectid'], 'project', 'projectkill');
}
// ########################################################################
if ($_POST['do'] == 'projectdisplayorder') {
    $vbulletin->input->clean_array_gpc('p', array('order' => TYPE_ARRAY_UINT));
    $case = '';
    foreach ($vbulletin->GPC['order'] as $projectid => $displayorder) {
        $case .= "\nWHEN " . intval($projectid) . " THEN " . $displayorder;
    }
    if ($case) {
        $db->query_write("\r\n\t\t\tUPDATE " . TABLE_PREFIX . "pt_project SET\r\n\t\t\t\tdisplayorder = CASE projectid {$case} ELSE displayorder END\r\n\t\t");
    }
    build_project_cache();
    define('CP_REDIRECT', 'project.php?do=projectlist');
    print_stop_message('saved_display_order_successfully');
}
// ########################################################################
if ($_REQUEST['do'] == 'projectlist') {
    $projects = $db->query_read("\r\n\t\tSELECT *\r\n\t\tFROM " . TABLE_PREFIX . "pt_project\r\n\t\tORDER BY displayorder\r\n\t");
    print_form_header('project', 'projectdisplayorder');
    print_table_header($vbphrase['project_list'], 3);
    print_cells_row(array($vbphrase['project'], $vbphrase['display_order'], '&nbsp;'), true);
    if ($db->num_rows($projects)) {
        while ($project = $db->fetch_array($projects)) {
            print_cells_row(array($project['title'], "<input type=\"text\" class=\"bginput\" name=\"order[{$project['projectid']}]\" value=\"{$project['displayorder']}\" tabindex=\"1\" size=\"3\" />", '<div align="' . $stylevar['right'] . '" class="smallfont">' . construct_link_code($vbphrase['edit'], 'project.php?do=projectedit&amp;projectid=' . $project['projectid']) . construct_link_code($vbphrase['delete'], 'project.php?do=projectdelete&amp;projectid=' . $project['projectid']) . construct_link_code($vbphrase['categories'], 'project.php?do=projectcategory&amp;projectid=' . $project['projectid']) . construct_link_code($vbphrase['versions'], 'project.php?do=projectversion&amp;projectid=' . $project['projectid']) . construct_link_code($vbphrase['milestones'], 'project.php?do=projectmilestone&amp;projectid=' . $project['projectid']) . '</div>'));
        }
    } else {
        print_description_row($vbphrase['no_projects_defined_click_here_to_add_one'], false, 3, '', 'center');
Exemplo n.º 3
0
 /**
  * Rebuild project milestone counters.
  */
 function rebuild_project_milestone_counters()
 {
     $count = $this->registry->db->query_first("\r\n\t\t\tSELECT COUNT(*) AS count\r\n\t\t\tFROM " . TABLE_PREFIX . "pt_milestone\r\n\t\t\tWHERE projectid = " . $this->fetch_field('projectid'));
     $this->registry->db->query_write("\r\n\t\t\tUPDATE " . TABLE_PREFIX . "pt_project SET\r\n\t\t\t\tmilestonecount = " . intval($count['count']) . "\r\n\t\t\tWHERE projectid = " . $this->fetch_field('projectid'));
     require_once DIR . '/includes/adminfunctions_projecttools.php';
     build_project_cache();
 }