Beispiel #1
0
function scm_ping($module, $username, $scm_name, $issues, $commit_msg)
{
    // module is per file (svn hook)
    if (is_array($module)) {
        $module = null;
    }
    // process checkins for each issue
    foreach ($issues as $issue_id) {
        // check early if issue exists to report proper message back
        // workflow needs to know project_id to find out which workflow class to use.
        $prj_id = Issue::getProjectID($issue_id);
        if (empty($prj_id)) {
            echo "issue #{$issue_id} not found\n";
            continue;
        }
        $files = array();
        $nfiles = count($_GET['files']);
        for ($y = 0; $y < $nfiles; $y++) {
            $file = array('file' => $_GET['files'][$y], 'old_version' => isset($_GET['old_versions'][$y]) ? $_GET['old_versions'][$y] : null, 'new_version' => isset($_GET['new_versions'][$y]) ? $_GET['new_versions'][$y] : null, 'module' => isset($module) ? $module : $_GET['module'][$y]);
            $files[] = $file;
        }
        $commit_time = Date_Helper::getCurrentDateGMT();
        SCM::addCheckins($issue_id, $commit_time, $scm_name, $username, $commit_msg, $files);
        // print report to stdout of commits so hook could report status back to commiter
        $details = Issue::getDetails($issue_id);
        echo "#{$issue_id} - {$details['iss_summary']} ({$details['sta_title']})\n";
    }
}
Beispiel #2
0
 /**
  * Method used to remove all issues associated with a specific list of
  * projects.
  *
  * XXX: this is dangerous, maybe remove such methods?
  *
  * @param   array $ids The list of projects to look for
  * @return  boolean
  */
 public static function removeByProjects($ids)
 {
     $stmt = 'SELECT
                 iss_id
              FROM
                 {{%issue}}
              WHERE
                 iss_prj_id IN (' . DB_Helper::buildList($ids) . ')';
     try {
         $res = DB_Helper::getInstance()->getColumn($stmt, $ids);
     } catch (DbException $e) {
         return false;
     }
     if (count($res) > 0) {
         self::deleteAssociations($res);
         Attachment::removeByIssues($res);
         SCM::removeByIssues($res);
         Impact_Analysis::removeByIssues($res);
         self::deleteUserAssociations($res);
         Note::removeByIssues($res);
         Time_Tracking::removeTimeEntriesByIssues($res);
         Notification::removeByIssues($res);
         Custom_Field::removeByIssues($res);
         Phone_Support::removeByIssues($res);
         History::removeByIssues($res);
         // now really delete the issues
         $items = implode(', ', $res);
         $stmt = "DELETE FROM\n                        {{%issue}}\n                     WHERE\n                        iss_id IN ({$items})";
         DB_Helper::getInstance()->query($stmt);
     }
     return true;
 }
Beispiel #3
0
    $res = Filter::save();
    $tpl->assign('save_filter_result', $res);
} elseif ($cat == 'delete_filter') {
    $res = Filter::remove();
    $tpl->assign('delete_filter_result', $res);
} elseif ($cat == 'remove_support_email') {
    $res = Support::removeAssociation();
    $tpl->assign('remove_association_result', $res);
} elseif ($cat == 'delete_attachment') {
    $res = Attachment::remove($id);
    $tpl->assign('remove_attachment_result', $res);
} elseif ($cat == 'delete_file') {
    $res = Attachment::removeIndividualFile($id);
    $tpl->assign('remove_file_result', $res);
} elseif ($cat == 'remove_checkin') {
    $res = SCM::remove($items);
    $tpl->assign('remove_checkin_result', $res);
} elseif ($cat == 'unassign') {
    $res = Issue::deleteUserAssociation($iss_id, $usr_id);
    Workflow::handleAssignmentChange($prj_id, $iss_id, Auth::getUserID(), Issue::getDetails($iss_id), Issue::getAssignedUserIDs($iss_id));
    $tpl->assign('unassign_result', $res);
} elseif ($cat == 'remove_email') {
    $res = Support::removeEmails();
    $tpl->assign('remove_email_result', $res);
} elseif ($cat == 'clear_duplicate') {
    $res = Issue::clearDuplicateStatus($iss_id);
    $tpl->assign('clear_duplicate_result', $res);
} elseif ($cat == 'delete_phone') {
    $res = Phone_Support::remove($id);
    $tpl->assign('delete_phone_result', $res);
} elseif ($cat == 'new_status') {
Beispiel #4
0
    $res = Filter::save();
    $tpl->assign("save_filter_result", $res);
} elseif (@$HTTP_POST_VARS["cat"] == "delete_filter") {
    $res = Filter::remove();
    $tpl->assign("delete_filter_result", $res);
} elseif (@$HTTP_POST_VARS["cat"] == "remove_support_email") {
    $res = Support::removeAssociation();
    $tpl->assign("remove_association_result", $res);
} elseif (@$HTTP_GET_VARS["cat"] == "delete_attachment") {
    $res = Attachment::remove($HTTP_GET_VARS["id"]);
    $tpl->assign("remove_attachment_result", $res);
} elseif (@$HTTP_GET_VARS["cat"] == "delete_file") {
    $res = Attachment::removeIndividualFile($HTTP_GET_VARS["id"]);
    $tpl->assign("remove_file_result", $res);
} elseif (@$HTTP_POST_VARS["cat"] == "remove_checkin") {
    $res = SCM::remove();
    $tpl->assign("remove_checkin_result", $res);
} elseif (@$HTTP_GET_VARS['cat'] == 'unassign') {
    $res = Issue::deleteUserAssociation($HTTP_GET_VARS["iss_id"], $usr_id);
    Workflow::handleAssignmentChange($prj_id, $HTTP_GET_VARS["iss_id"], Auth::getUserID(), Issue::getDetails($HTTP_GET_VARS["iss_id"]), Issue::getAssignedUserIDs($HTTP_GET_VARS["iss_id"]));
    $tpl->assign('unassign_result', $res);
} elseif (@$HTTP_POST_VARS["cat"] == "remove_email") {
    $res = Support::removeEmails();
    $tpl->assign("remove_email_result", $res);
} elseif (@$HTTP_GET_VARS["cat"] == "clear_duplicate") {
    $res = Issue::clearDuplicateStatus($HTTP_GET_VARS["iss_id"]);
    $tpl->assign("clear_duplicate_result", $res);
} elseif (@$HTTP_GET_VARS["cat"] == "delete_phone") {
    $res = Phone_Support::remove($HTTP_GET_VARS["id"]);
    $tpl->assign("delete_phone_result", $res);
} elseif (@$HTTP_GET_VARS["cat"] == "new_status") {
Beispiel #5
0
                $show_category = 0;
            }
            $cookie = Auth::getCookieInfo(APP_PROJECT_COOKIE);
            if (!empty($auto_switched_from)) {
                $tpl->assign(array("project_auto_switched" => 1, "old_project" => Project::getName($auto_switched_from)));
            }
            $setup = Setup::load();
            $tpl->assign("allow_unassigned_issues", @$setup["allow_unassigned_issues"]);
            $tpl->assign(array('next_issue' => @$sides['next'], 'previous_issue' => @$sides['previous'], 'subscribers' => Notification::getSubscribers($issue_id), 'custom_fields' => Custom_Field::getListByIssue($prj_id, $issue_id), 'files' => Attachment::getList($issue_id), 'emails' => Support::getEmailsByIssue($issue_id), 'zones' => Date_API::getTimezoneList(), 'users' => Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer')), 'ema_id' => Email_Account::getEmailAccount(), 'max_attachment_size' => Attachment::getMaxAttachmentSize(), 'show_releases' => $show_releases, 'show_category' => $show_category, 'categories' => Category::getAssocList($prj_id), 'quarantine' => Issue::getQuarantineInfo($issue_id)));
            if ($role_id != User::getRoleID('customer')) {
                if (@$_REQUEST['show_all_drafts'] == 1) {
                    $show_all_drafts = true;
                } else {
                    $show_all_drafts = false;
                }
                if (Workflow::hasWorkflowIntegration($prj_id)) {
                    $statuses = Workflow::getAllowedStatuses($prj_id, $issue_id);
                    // if currently selected release is not on list, go ahead and add it.
                } else {
                    $statuses = Status::getAssocStatusList($prj_id);
                }
                if (!empty($details['iss_sta_id']) && empty($statuses[$details['iss_sta_id']])) {
                    $statuses[$details['iss_sta_id']] = Status::getStatusTitle($details['iss_sta_id']);
                }
                $time_entries = Time_Tracking::getListing($issue_id);
                $tpl->assign(array('notes' => Note::getListing($issue_id), 'is_user_assigned' => Issue::isAssignedToUser($issue_id, $usr_id), 'is_user_authorized' => Authorized_Replier::isUserAuthorizedReplier($issue_id, $usr_id), 'phone_entries' => Phone_Support::getListing($issue_id), 'phone_categories' => Phone_Support::getCategoryAssocList($prj_id), 'checkins' => SCM::getCheckinList($issue_id), 'time_categories' => Time_Tracking::getAssocCategories(), 'time_entries' => $time_entries['list'], 'total_time_spent' => $time_entries['total_time_spent'], 'impacts' => Impact_Analysis::getListing($issue_id), 'statuses' => $statuses, 'drafts' => Draft::getList($issue_id, $show_all_drafts), 'groups' => Group::getAssocList($prj_id)));
            }
        }
    }
}
$tpl->displayTemplate();
Beispiel #6
0
 /**
  * Method used to remove all issues associated with a specific list of
  * projects.
  *
  * @access  public
  * @param   array $ids The list of projects to look for
  * @return  boolean
  */
 function removeByProjects($ids)
 {
     $items = @implode(", ", Misc::escapeInteger($ids));
     $stmt = "SELECT\n                    iss_id\n                 FROM\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue\n                 WHERE\n                    iss_prj_id IN ({$items})";
     $res = $GLOBALS["db_api"]->dbh->getCol($stmt);
     if (PEAR::isError($res)) {
         Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
         return false;
     } else {
         if (count($res) > 0) {
             Issue::deleteAssociations($res);
             Attachment::removeByIssues($res);
             SCM::removeByIssues($res);
             Impact_Analysis::removeByIssues($res);
             Issue::deleteUserAssociations($res);
             Note::removeByIssues($res);
             Time_Tracking::removeByIssues($res);
             Notification::removeByIssues($res);
             Custom_Field::removeByIssues($res);
             Phone_Support::removeByIssues($res);
             History::removeByIssues($res);
             // now really delete the issues
             $items = implode(", ", $res);
             $stmt = "DELETE FROM\n                            " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue\n                         WHERE\n                            iss_id IN ({$items})";
             $GLOBALS["db_api"]->dbh->query($stmt);
         }
         return true;
     }
 }
Beispiel #7
0
// |                                                                      |
// | You should have received a copy of the GNU General Public License    |
// | along with this program; if not, write to:                           |
// |                                                                      |
// | Free Software Foundation, Inc.                                       |
// | 59 Temple Place - Suite 330                                          |
// | Boston, MA 02111-1307, USA.                                          |
// +----------------------------------------------------------------------+
// | Authors: João Prado Maia <*****@*****.**>                             |
// +----------------------------------------------------------------------+
//
// @(#) $Id: s.cvs_ping.php 1.4 03/01/16 01:47:31-00:00 jpm $
//
include_once "config.inc.php";
include_once APP_INC_PATH . "class.misc.php";
include_once APP_INC_PATH . "class.scm.php";
include_once APP_INC_PATH . "class.workflow.php";
include_once APP_INC_PATH . "db_access.php";
$HTTP_GET_VARS = Misc::array_map_deep($HTTP_GET_VARS, 'base64_decode');
foreach ($HTTP_GET_VARS['issue'] as $issue_id) {
    $files = array();
    for ($y = 0; $y < count($HTTP_GET_VARS['files']); $y++) {
        SCM::logCheckin($issue_id, $y);
        $files[] = array('file' => $HTTP_GET_VARS['files'][$y], 'old_version' => $HTTP_GET_VARS['old_versions'][$y], 'new_version' => $HTTP_GET_VARS['new_versions'][$y]);
    }
    $prj_id = Issue::getProjectID($issue_id);
    $module = $HTTP_GET_VARS['module'];
    $username = $HTTP_GET_VARS['username'];
    $commit_msg = $HTTP_GET_VARS['commit_msg'];
    Workflow::handleSCMCheckins($prj_id, $issue_id, $module, $files, $username, $commit_msg);
}
Beispiel #8
0
 /**
  * Method used to get the full list of checkins associated with an issue.
  *
  * @access  public
  * @param   integer $issue_id The issue ID
  * @return  array The list of checkins
  */
 function getCheckinList($issue_id)
 {
     $setup = Setup::load();
     $stmt = "SELECT\n                    *\n                 FROM\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_checkin\n                 WHERE\n                    isc_iss_id=" . Misc::escapeInteger($issue_id) . "\n                 ORDER BY\n                    isc_created_date ASC";
     $res = $GLOBALS["db_api"]->dbh->getAll($stmt, DB_FETCHMODE_ASSOC);
     if (PEAR::isError($res)) {
         Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
         return "";
     } else {
         if (empty($res)) {
             return "";
         } else {
             for ($i = 0; $i < count($res); $i++) {
                 $res[$i]["isc_commit_msg"] = Link_Filter::processText(Issue::getProjectID($issue_id), nl2br(htmlspecialchars($res[$i]["isc_commit_msg"])));
                 @($res[$i]["checkout_url"] = SCM::parseURL($setup["checkout_url"], $res[$i]));
                 @($res[$i]["diff_url"] = SCM::parseURL($setup["diff_url"], $res[$i]));
                 $res[$i]["isc_created_date"] = Date_API::getFormattedDate($res[$i]["isc_created_date"]);
             }
             return $res;
         }
     }
 }