当前位置: 首页>>代码示例>>PHP>>正文


PHP defval函数代码示例

本文整理汇总了PHP中defval函数的典型用法代码示例。如果您正苦于以下问题:PHP defval函数的具体用法?PHP defval怎么用?PHP defval使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了defval函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: defval

        $Conf->ajaxExit(array("status" => $status), true);
    }
}
// withdraw and revive actions
if (isset($_REQUEST["withdraw"]) && !$newPaper && check_post()) {
    if (!($whyNot = $Me->perm_withdraw_paper($prow))) {
        $reason = defval($_REQUEST, "reason", "");
        if ($reason == "" && $Me->privChair && defval($_REQUEST, "doemail") > 0) {
            $reason = defval($_REQUEST, "emailNote", "");
        }
        Dbl::qe("update Paper set timeWithdrawn={$Now}, timeSubmitted=if(timeSubmitted>0,-100,0), withdrawReason=? where paperId={$prow->paperId}", $reason != "" ? $reason : null);
        $numreviews = Dbl::fetch_ivalue("select count(*) from PaperReview where paperId={$prow->paperId} and reviewNeedsSubmit!=0");
        $Conf->update_papersub_setting(false);
        loadRows();
        // email contact authors themselves
        if (!$Me->privChair || defval($_REQUEST, "doemail") > 0) {
            HotCRPMailer::send_contacts($prow->conflictType >= CONFLICT_AUTHOR ? "@authorwithdraw" : "@adminwithdraw", $prow, array("reason" => $reason, "infoNames" => 1));
        }
        // email reviewers
        if ($numreviews > 0 && $Conf->time_review_open() || $prow->num_reviews_assigned() > 0) {
            HotCRPMailer::send_reviewers("@withdrawreviewer", $prow, array("reason" => $reason));
        }
        // remove voting tags so people don't have phantom votes
        if (TagInfo::has_vote()) {
            $q = array();
            foreach (TagInfo::vote_tags() as $t => $v) {
                $q[] = "tag='" . sqlq($t) . "' or tag like '%~" . sqlq_for_like($t) . "'";
            }
            Dbl::qe_raw("delete from PaperTag where paperId={$prow->paperId} and (" . join(" or ", $q) . ")");
        }
        $Me->log_activity("Withdrew", $prow->paperId);
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:31,代码来源:paper.php

示例2: loadRows

function loadRows()
{
    global $Conf, $Me, $prow, $paperTable, $crow, $Error;
    $Conf->paper = $prow = PaperTable::paperRow($whyNot);
    if (!$prow) {
        exit_to_paper();
    }
    $paperTable = new PaperTable($prow, make_qreq());
    $paperTable->resolveReview(false);
    $paperTable->resolveComments();
    $cid = defval($_REQUEST, "commentId", "xxx");
    $crow = null;
    foreach ($paperTable->crows as $row) {
        if ($row->commentId == $cid || $cid == "response" && $row->commentType & COMMENTTYPE_RESPONSE) {
            $crow = $row;
        }
    }
    if (!$crow && $cid != "xxx" && $cid != "new" && $cid != "response" && $cid != "newresponse") {
        Conf::msg_error("No such comment.");
        $Conf->ajaxExit(array("ok" => false));
    }
    if (isset($Error["paperId"]) && $Error["paperId"] != $prow->paperId) {
        $Error = array();
    }
}
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:25,代码来源:comment.php

示例3: ensure_session

function ensure_session()
{
    global $Opt;
    if (session_id() !== "") {
        return true;
    }
    if (!($sn = make_session_name(@$Opt["sessionName"]))) {
        return false;
    }
    // maybe upgrade from an old session name to this one
    if (!isset($_COOKIE[$sn]) && isset($Opt["sessionUpgrade"]) && ($upgrade_sn = make_session_name($Opt["sessionUpgrade"])) && isset($_COOKIE[$upgrade_sn])) {
        session_id($_COOKIE[$upgrade_sn]);
        setcookie($upgrade_sn, "", time() - 3600, "/", defval($Opt, "sessionUpgradeDomain", defval($Opt, "sessionDomain", "")), defval($Opt, "sessionSecure", false));
    }
    if (isset($Opt["sessionSecure"]) || isset($Opt["sessionDomain"])) {
        $params = session_get_cookie_params();
        if (isset($Opt["sessionSecure"])) {
            $params["secure"] = !!$Opt["sessionSecure"];
        }
        if (isset($Opt["sessionDomain"])) {
            $params["domain"] = $Opt["sessionDomain"];
        }
        session_set_cookie_params($params["lifetime"], $params["path"], $params["domain"], $params["secure"]);
    }
    session_name($sn);
    session_cache_limiter("");
    if (isset($_COOKIE[$sn]) && !preg_match(';\\A[-a-zA-Z0-9,]{1,128}\\z;', $_COOKIE[$sn])) {
        error_log("unexpected session ID <" . $_COOKIE[$sn] . ">");
        unset($_COOKIE[$sn]);
    }
    session_start();
    return true;
}
开发者ID:benesch,项目名称:peteramati,代码行数:33,代码来源:redirect.php

示例4: default_score_sort

 public static function default_score_sort($nosession = false)
 {
     global $Conf, $Opt;
     if (!$nosession && $Conf && ($sv = $Conf->session("scoresort"))) {
         return $sv;
     } else {
         if ($Conf && ($s = $Conf->setting_data("scoresort_default"))) {
             return $s;
         } else {
             return defval($Opt, "defaultScoreSort", "C");
         }
     }
 }
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:13,代码来源:listsorter.php

示例5: set_follow

 static function set_follow($prow)
 {
     global $Conf, $Me, $OK;
     $ajax = defval($_REQUEST, "ajax", 0);
     $cid = $Me->contactId;
     if ($Me->privChair && ($x = cvtint(@$_REQUEST["contactId"])) > 0) {
         $cid = $x;
     }
     saveWatchPreference($prow->paperId, $cid, WATCHTYPE_COMMENT, defval($_REQUEST, "follow"));
     if ($OK) {
         $Conf->confirmMsg("Saved");
     }
     if ($ajax) {
         $Conf->ajaxExit(array("ok" => $OK));
     }
 }
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:16,代码来源:paperactions.php

示例6: create

 public function create($capabilityType, $options = array())
 {
     global $Opt;
     $contactId = defval($options, "contactId", 0);
     if (!$contactId && ($user = @$options["user"])) {
         $contactId = $this->prefix === "U" ? $user->contactDbId : $user->contactId;
     }
     $paperId = defval($options, "paperId", 0);
     $timeExpires = defval($options, "timeExpires", time() + 259200);
     $data = defval($options, "data");
     $capid = false;
     for ($tries = 0; !$capid && $tries < 4; ++$tries) {
         if (($salt = hotcrp_random_bytes(16)) !== false) {
             Dbl::ql($this->dblink, "insert into Capability set capabilityType={$capabilityType}, contactId=?, paperId=?, timeExpires=?, salt=?, data=?", $contactId, $paperId, $timeExpires, $salt, $data);
             $capid = $this->dblink->insert_id;
         }
     }
     if (!$capid) {
         return false;
     }
     return $this->prefix . "1" . str_replace(array("+", "/", "="), array("-a", "-b", ""), base64_encode($salt));
 }
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:22,代码来源:capability.php

示例7: header

    header("Content-Type: text/plain");
} else {
    header("Content-Type: application/json");
}
if ($Me->privChair && isset($_REQUEST["ignore"])) {
    $when = time() + 86400 * 2;
    $Conf->qe("insert into Settings (name, value) values ('ignoreupdate_" . sqlq($_REQUEST["ignore"]) . "', {$when}) on duplicate key update value={$when}");
}
$messages = array();
if ($Me->privChair && isset($_REQUEST["data"]) && ($data = json_decode($_REQUEST["data"], true)) && isset($data["updates"]) && is_array($data["updates"])) {
    foreach ($data["updates"] as $update) {
        $ok = true;
        if (isset($update["opt"]) && is_array($update["opt"])) {
            foreach ($update["opt"] as $k => $v) {
                $kk = $k[0] == "-" ? substr($k, 1) : $k;
                $test = defval($Opt, $kk, null) == $v;
                $ok = $ok && ($k[0] == "-" ? !$test : $test);
            }
        }
        if (isset($update["settings"]) && is_array($update["settings"])) {
            foreach ($update["settings"] as $k => $v) {
                if (preg_match('/\\A([!<>]?)(-?\\d+|now)\\z/', $v, $m)) {
                    $setting = $Conf->setting($k, 0);
                    if ($m[2] == "now") {
                        $m[2] = time();
                    }
                    if ($m[1] == "!") {
                        $test = $setting != +$m[2];
                    } else {
                        if ($m[1] == ">") {
                            $test = $setting > +$m[2];
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:31,代码来源:checkupdates.php

示例8: array

} else {
    echo "<h2 style='margin-top:1em'>Assignments by PC member</h2>\n";
}
// Change PC member
echo "<table><tr><td><div class='aahc assignpc_pcsel'>", Ht::form_div(hoturl("manualassign"), array("method" => "get", "id" => "selectreviewerform"));
$result = $Conf->qe("select ContactInfo.contactId, count(reviewId)\n                from ContactInfo\n                left join PaperReview on (PaperReview.contactId=ContactInfo.contactId and PaperReview.reviewType>=" . REVIEW_SECONDARY . ")\n                where (roles&" . Contact::ROLE_PC . ")!=0\n                group by ContactInfo.contactId");
$rev_count = array();
while ($row = edb_row($result)) {
    $rev_count[$row[0]] = $row[1];
}
$rev_opt = array();
if ($reviewer <= 0) {
    $rev_opt[0] = "(Select a PC member)";
}
foreach ($pcm as $pc) {
    $rev_opt[$pc->contactId] = Text::name_html($pc) . " (" . plural(defval($rev_count, $pc->contactId, 0), "assignment") . ")";
}
echo "<table><tr><td><strong>PC member:</strong> &nbsp;</td>", "<td>", Ht::select("reviewer", $rev_opt, $reviewer, array("onchange" => "hiliter(this)")), "</td></tr>", "<tr><td colspan='2'><div class='g'></div></td></tr>\n";
// Paper selection
$q = $qreq->q == "" ? "(All)" : $qreq->q;
echo "<tr><td>Paper selection: &nbsp;</td><td>", Ht::entry_h("q", $q, array("id" => "manualassignq", "size" => 40, "placeholder" => "(All)", "title" => "Paper numbers or search terms")), " &nbsp;in &nbsp;";
if (count($tOpt) > 1) {
    echo Ht::select("t", $tOpt, $qreq->t, array("onchange" => "hiliter(this)"));
} else {
    echo join("", $tOpt);
}
echo "</td></tr>\n", "<tr><td colspan='2'><div class='g'></div>\n";
echo Ht::radio("kind", "a", $qreq->kind == "a", array("onchange" => "hiliter(this)")), "&nbsp;", Ht::label("Assign reviews and/or conflicts"), "<br />\n", Ht::radio("kind", "c", $qreq->kind == "c", array("onchange" => "hiliter(this)")), "&nbsp;", Ht::label("Assign conflicts only (and limit papers to potential conflicts)"), "</td></tr>\n";
echo "<tr><td colspan='2'><div class='aax' style='text-align:right'>", Ht::submit("Go", array("class" => "bb")), "</div></td></tr>\n", "</table>\n</div></form></div></td></tr></table>\n";
function make_match_preg($str)
{
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:31,代码来源:manualassign.php

示例9: web_request_as_json

function web_request_as_json($cj)
{
    global $Conf, $Me, $Acct, $newProfile, $UserStatus;
    if ($newProfile || !$Acct->has_database_account()) {
        $cj->id = "new";
    } else {
        $cj->id = $Acct->contactId;
    }
    if (!Contact::external_login()) {
        $cj->email = trim(defval($_REQUEST, "uemail", ""));
    } else {
        if ($newProfile) {
            $cj->email = trim(defval($_REQUEST, "newUsername", ""));
        } else {
            $cj->email = $Acct->email;
        }
    }
    foreach (array("firstName", "lastName", "preferredEmail", "affiliation", "collaborators", "addressLine1", "addressLine2", "city", "state", "zipCode", "country", "voicePhoneNumber") as $k) {
        if (isset($_REQUEST[$k])) {
            $cj->{$k} = $_REQUEST[$k];
        }
    }
    if (!Contact::external_login() && !$newProfile && $Me->can_change_password($Acct)) {
        if (@$_REQUEST["whichpassword"] === "t" && @$_REQUEST["upasswordt"]) {
            $pw = $pw2 = @trim($_REQUEST["upasswordt"]);
        } else {
            $pw = @trim($_REQUEST["upassword"]);
            $pw2 = @trim($_REQUEST["upassword2"]);
        }
        if ($pw === "" && $pw2 === "") {
            /* do nothing */
        } else {
            if ($pw !== $pw2) {
                $UserStatus->set_error("password", "Those passwords do not match.");
            } else {
                if (!Contact::valid_password($pw)) {
                    $UserStatus->set_error("password", "Invalid new password.");
                } else {
                    if (!$Acct || $Me->can_change_password(null)) {
                        $cj->old_password = null;
                        $cj->new_password = $pw;
                    } else {
                        $cj->old_password = @trim($_REQUEST["oldpassword"]);
                        if ($Acct->check_password($cj->old_password)) {
                            $cj->new_password = $pw;
                        } else {
                            $UserStatus->set_error("password", "Incorrect current password. New password ignored.");
                        }
                    }
                }
            }
        }
    }
}
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:54,代码来源:profile.php

示例10: _tryNewList

function _tryNewList($opt, $listtype)
{
    global $Conf, $ConfSiteSuffix, $Me;
    if ($listtype == "u" && $Me->privChair) {
        $searchtype = defval($opt, "t") === "all" ? "all" : "pc";
        $q = "select email from ContactInfo";
        if ($searchtype == "pc") {
            $q .= " where (roles&" . Contact::ROLE_PC . ")!=0";
        }
        $result = $Conf->qx("{$q} order by lastName, firstName, email");
        $a = array();
        while ($row = edb_row($result)) {
            $a[] = $row[0];
        }
        $a["description"] = $searchtype == "pc" ? "Program committee" : "Users";
        $a["listid"] = "u:" . $searchtype . "::";
        $a["url"] = "users{$ConfSiteSuffix}?t=" . $searchtype;
        return $a;
    } else {
        require_once "search.inc";
        $search = new PaperSearch($Me, $opt);
        return $search->sessionList();
    }
}
开发者ID:kohler,项目名称:peteramati,代码行数:24,代码来源:helpers.php

示例11: join

if (count($notelinks)) {
    ContactView::echo_group("notes", join(", ", $notelinks));
}
// check for any linenotes
$has_any_linenotes = false;
foreach ($diff as $file => $dinfo) {
    if (defval($all_linenotes, $file, null)) {
        $has_any_linenotes = true;
        break;
    }
}
// line notes
foreach ($diff as $file => $dinfo) {
    $fileid = html_id_encode($file);
    $tabid = "file61_" . $fileid;
    $linenotes = defval($all_linenotes, $file, null);
    $display_table = $linenotes || !$dinfo->boring;
    echo '<h3><a class="fold61" href="#" onclick="return fold61(', "'#{$tabid}'", ',this)"><span class="foldarrow">', $display_table ? "&#x25BC;" : "&#x25B6;", "</span>&nbsp;", htmlspecialchars($file), "</a>";
    if (!$dinfo->removed) {
        echo '<a style="display:inline-block;margin-left:2em;font-weight:normal" href="', $Info->hoturl("raw", array("file" => $file)), '">[Raw]</a>';
    }
    echo '</h3>';
    echo '<table id="', $tabid, '" class="code61 diff61 filediff61';
    if ($Me != $User) {
        echo ' live';
    }
    if (!$Info->user_can_see_grades) {
        echo " hidegrade61";
    }
    if (!$display_table) {
        echo '" style="display:none';
开发者ID:benesch,项目名称:peteramati,代码行数:31,代码来源:diff.php

示例12: parse

 public function parse($sv, $si)
 {
     $tagger = new Tagger();
     $tracks = (object) array();
     $missing_tags = false;
     for ($i = 1; isset($sv->req["name_track{$i}"]); ++$i) {
         $trackname = trim($sv->req["name_track{$i}"]);
         if ($trackname === "" || $trackname === "(tag)") {
             continue;
         } else {
             if (!$tagger->check($trackname, Tagger::NOPRIVATE | Tagger::NOCHAIR | Tagger::NOVALUE) || $trackname === "_" && $i != 1) {
                 if ($trackname !== "_") {
                     $sv->set_error("name_track{$i}", "Track name: " . $tagger->error_html);
                 } else {
                     $sv->set_error("name_track{$i}", "Track name “_” is reserved.");
                 }
                 $sv->set_error("tracks");
                 continue;
             }
         }
         $t = (object) array();
         foreach (Track::$map as $type => $value) {
             if (($ttype = defval($sv->req, "{$type}_track{$i}", "")) == "+" || $ttype == "-") {
                 $ttag = trim(defval($sv->req, "{$type}tag_track{$i}", ""));
                 if ($ttag === "" || $ttag === "(tag)") {
                     $sv->set_error("{$type}_track{$i}", "Tag missing for track setting.");
                     $sv->set_error("tracks");
                 } else {
                     if ($ttype == "+" && strcasecmp($ttag, "none") == 0 || $tagger->check($ttag, Tagger::NOPRIVATE | Tagger::NOCHAIR | Tagger::NOVALUE)) {
                         $t->{$type} = $ttype . $ttag;
                     } else {
                         $sv->set_error("{$type}_track{$i}", $tagger->error_html);
                         $sv->set_error("tracks");
                     }
                 }
             } else {
                 if ($ttype == "none") {
                     $t->{$type} = "+none";
                 }
             }
         }
         if (count((array) $t) || get($tracks, "_")) {
             $tracks->{$trackname} = $t;
         }
     }
     $sv->save("tracks", count((array) $tracks) ? json_encode($tracks) : null);
     return false;
 }
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:48,代码来源:s_tags.php

示例13: send_preparation

 static function send_preparation($prep)
 {
     global $Conf, $Opt;
     if (!isset($Opt["internalMailer"])) {
         $Opt["internalMailer"] = strncasecmp(PHP_OS, "WIN", 3) != 0;
     }
     $headers = $prep->headers;
     // create valid To: header
     $to = $prep->to;
     if (is_array($to)) {
         $to = join(", ", $to);
     }
     $to = MimeText::encode_email_header("To: ", $to);
     $headers["to"] = $to . MAILER_EOL;
     // set sendmail parameters
     $extra = defval($Opt, "sendmailParam", "");
     if (isset($Opt["emailSender"])) {
         @ini_set("sendmail_from", $Opt["emailSender"]);
         if (!isset($Opt["sendmailParam"])) {
             $extra = "-f" . escapeshellarg($Opt["emailSender"]);
         }
     }
     if ($prep->sendable && $Opt["internalMailer"] && ($sendmail = ini_get("sendmail_path"))) {
         $htext = join("", $headers);
         $f = popen($extra ? "{$sendmail} {$extra}" : $sendmail, "wb");
         fwrite($f, $htext . MAILER_EOL . $prep->body);
         $status = pclose($f);
         if (pcntl_wifexited($status) && pcntl_wexitstatus($status) == 0) {
             return true;
         } else {
             $Opt["internalMailer"] = false;
             error_log("Mail " . $headers["to"] . " failed to send, falling back (status {$status})");
         }
     }
     if ($prep->sendable) {
         if (strpos($to, MAILER_EOL) === false) {
             unset($headers["to"]);
             $to = substr($to, 4);
             // skip "To: "
         } else {
             $to = "";
         }
         unset($headers["subject"]);
         $htext = substr(join("", $headers), 0, -2);
         return mail($to, $prep->subject, $prep->body, $htext, $extra);
     } else {
         if (!$Opt["sendEmail"] && !preg_match('/\\Aanonymous\\d*\\z/', $to)) {
             unset($headers["mime-version"], $headers["content-type"]);
             $text = join("", $headers) . MAILER_EOL . $prep->body;
             if (PHP_SAPI == "cli" && !@$Opt["disablePrintEmail"]) {
                 fwrite(STDERR, "========================================\n" . str_replace("\r\n", "\n", $text) . "========================================\n");
             } else {
                 $Conf->infoMsg("<pre>" . htmlspecialchars($text) . "</pre>");
             }
             return null;
         }
     }
 }
开发者ID:benesch,项目名称:peteramati,代码行数:58,代码来源:mailer.php

示例14: req

                echo '<div class="g"></div>', '<div class="aahc"><div class="aa">', Ht::submit("Apply changes"), ' &nbsp;', Ht::submit("cancel", "Cancel"), Ht::hidden("default_action", $defaults["action"]), Ht::hidden("rev_roundtag", $defaults["round"]), Ht::hidden("file", $text), Ht::hidden("assignment_size_estimate", $csv_lineno), Ht::hidden("filename", $filename), Ht::hidden("requestreview_notify", req("requestreview_notify")), Ht::hidden("requestreview_subject", req("requestreview_subject")), Ht::hidden("requestreview_body", req("requestreview_body")), Ht::hidden("bulkentry", req("bulkentry")), '</div></div></div></form>', "\n";
                $Conf->footer();
                exit;
            }
        }
    }
}
if (isset($_REQUEST["saveassignment"]) && check_post() && isset($_POST["file"]) && get($_POST, "assignment_size_estimate") >= 1000) {
    complete_assignment("keep_browser_alive");
    finish_browser_alive();
}
echo Ht::form_div(hoturl_post("bulkassign", "upload=1"), array("divstyle" => "margin-top:1em"));
// Upload
echo '<div class="f-contain"><div class="f-i"><div class="f-e">', Ht::textarea("bulkentry", req_s("bulkentry"), ["rows" => 1, "cols" => 80, "placeholder" => "Enter assignments"]), '</div></div></div>';
echo '<div class="g"><strong>OR</strong> &nbsp;', '<input type="file" name="bulk" accept="text/plain,text/csv" size="30" /></div>';
echo '<div id="foldoptions" class="lg foldc fold2o">', 'By default, assign&nbsp; ', Ht::select("default_action", array("primary" => "primary reviews", "secondary" => "secondary reviews", "pcreview" => "optional PC reviews", "review" => "external reviews", "conflict" => "PC conflicts", "lead" => "discussion leads", "shepherd" => "shepherds", "tag" => "add tags", "settag" => "replace tags", "preference" => "reviewer preferences"), defval($_REQUEST, "default_action", "primary"), array("id" => "tsel", "onchange" => "fold(\"options\",this.value!=\"review\");fold(\"options\",!/^(?:primary|secondary|(?:pc)?review)\$/.test(this.value),2)"));
$rev_rounds = $Conf->round_selector_options();
if (count($rev_rounds) > 1) {
    echo '<span class="fx2">&nbsp; in round &nbsp;', Ht::select("rev_roundtag", $rev_rounds, $_REQUEST["rev_roundtag"] ?: "unnamed"), '</span>';
} else {
    if (!get($rev_rounds, "unnamed")) {
        echo '<span class="fx2">&nbsp; in round ', $Conf->current_round_name(), '</span>';
    }
}
echo '<div class="g"></div>', "\n";
$requestreview_template = $null_mailer->expand_template("requestreview");
echo Ht::hidden("requestreview_subject", $requestreview_template["subject"]);
if (isset($_REQUEST["requestreview_body"])) {
    $t = $_REQUEST["requestreview_body"];
} else {
    $t = $requestreview_template["body"];
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:31,代码来源:bulkassign.php

示例15: redirectSelf

$User = null;
if (isset($_REQUEST["u"]) && !($User = ContactView::prepare_user($_REQUEST["u"]))) {
    redirectSelf(array("u" => null));
}
if (!$Me->isPC || !$User) {
    $User = $Me;
}
// check problem set openness
$max_pset = $Conf->setting("pset_forwarded");
foreach (Pset::$all as $pset) {
    if (Contact::student_can_see_pset($pset) && $pset->id > $max_pset && !$pset->gitless) {
        Contact::forward_pset_links($pset->id);
    }
}
if (!$Me->is_empty() && ($Me === $User || $Me->isPC) && isset($_REQUEST["set_seascode_username"]) && check_post()) {
    if ($User->set_seascode_username(defval($_REQUEST, "username"))) {
        redirectSelf();
    }
} else {
    if (!$Me->is_empty() && !$User->seascode_username && preg_match('/\\A(.*?)@.*harvard\\.edu\\z/', $User->email, $m) && $User->check_seascode_username($m[1], false)) {
        $User->set_seascode_username($m[1]);
    }
}
function try_set_seascode_repo()
{
    global $Me, $Conf;
    $min_pset = null;
    foreach (Pset::$all as $p) {
        if (!$min_pset || ContactView::pset_compare($min_pset, $p) > 0) {
            $min_pset = $p;
        }
开发者ID:benesch,项目名称:peteramati,代码行数:31,代码来源:home.php


注:本文中的defval函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。