예제 #1
0
파일: patch-add.php 프로젝트: stof/pearweb
require_once 'Text/CAPTCHA/Numeral.php';
$numeralCaptcha = new Text_CAPTCHA_Numeral();
$patchinfo = new Bugs_Patchtracker();
// captcha is not necessary if the user is logged in
if (isset($auth_user) && $auth_user->registered) {
    auth_require('pear.dev', 'pear.bug');
    if (isset($_SESSION['answer'])) {
        unset($_SESSION['answer']);
    }
}
if (PEAR::isError($buginfo = $patchinfo->getBugInfo($id))) {
    response_header('Error :: invalid bug selected');
    report_error('Invalid bug "' . $id . '" selected');
    response_footer();
    exit;
}
$loggedin = isset($auth_user) && $auth_user->registered;
if (!isset($_POST['addpatch'])) {
    /**
     * Normal patch form with predefined variables
     */
    $email = isset($_GET['email']) ? $_GET['email'] : '';
    $errors = array();
    $package = $buginfo['package_name'];
    $bug = $buginfo['id'];
    $patchname = isset($_GET['patchname']) ? $_GET['patchname'] : '';
    $captcha = $numeralCaptcha->getOperation();
    $_SESSION['answer'] = $numeralCaptcha->getAnswer();
}
$patches = $patchinfo->listPatches($id);
include PEARWEB_TEMPLATEDIR . '/bugs/addpatch.php';
예제 #2
0
    }
    $spat = $patch == null ? '' : '&patch=' . $patch;
    $srev = $revision == null ? '' : '&revision=' . $revision;
    $edit = $spat ? 12 : 11;
    header('Location: /bugs/bug.php' . "?id={$bug_id}&edit=" . $edit . $spat . $srev);
    exit;
}
$bug_id = $id;
$patchinfo = new Bugs_Patchtracker();
$buginfo = $patchinfo->getBugInfo($bug_id);
if ($patch === null || $revision === null) {
    /**
     * display patch list
     */
    $bug = $buginfo['id'];
    $patches = $patchinfo->listPatches($bug);
    $canpatch = auth_check('pear.bug') || auth_check('pear.dev');
    response_header('Bug #' . clean($bug) . ' :: Patches');
    include PEARWEB_TEMPLATEDIR . '/bugs/listpatches.php';
    response_footer();
    exit;
}
if ($revision == 'latest') {
    //fix revision number
    $revisions = $patchinfo->listRevisions($buginfo['id'], $patch);
    if (isset($revisions[0])) {
        $revision = $revisions[0][0];
    }
}
$path = $patchinfo->getPatchFullpath($bug_id, $patch, $revision);
if (!file_exists($path)) {