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


PHP edb_row函数代码示例

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


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

示例1: __construct

 function __construct($source_tag, $dest_tag, $papersel, $strict, $header_title = null, $header_id = null)
 {
     global $Conf;
     $this->dest_tag = $dest_tag;
     $this->ordertype = $strict ? "aos" : "ao";
     $this->papersel = $papersel;
     $this->userrank = array();
     $this->info_printed = false;
     $this->header_title = $header_title;
     $this->header_id = $header_id;
     $this->starttime = time();
     // generate random order for paper comparisons
     if (count($papersel)) {
         $range = range(0, count($papersel) - 1);
         shuffle($range);
         $this->papershuffle = array_combine($papersel, $range);
     } else {
         $this->papershuffle = array();
     }
     // load current ranks: $userrank maps user => [rank, paper]
     $result = $Conf->qe("select paperId, tag, tagIndex from PaperTag where tag like '%~" . sqlq_for_like($source_tag) . "' and paperId in (" . join(",", $papersel) . ")");
     $len = strlen($source_tag) + 1;
     while ($row = edb_row($result)) {
         $l = (int) substr($row[1], 0, strlen($row[1]) - $len);
         $this->userrank[$l][] = array((int) $row[2], (int) $row[0]);
     }
     // sort $userrank[$user] by descending rank order
     foreach ($this->userrank as $user => &$ranks) {
         usort($ranks, array($this, "_comparUserrank"));
     }
     $this->rank = array();
     $this->currank = 0;
 }
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:33,代码来源:paperrank.php

示例2: _update_schema_haslinenotes

function _update_schema_haslinenotes($conf)
{
    $conf->ql("lock tables CommitNotes write");
    $hashes = array(array(), array(), array(), array());
    $result = $conf->ql("select hash, notes from CommitNotes");
    while ($row = edb_row($result)) {
        $x = PsetView::notes_haslinenotes(json_decode($row[1]));
        $hashes[$x][] = $row[0];
    }
    foreach ($hashes as $x => $h) {
        if (count($h)) {
            $conf->ql("update CommitNotes set haslinenotes={$x} where hash in ('" . join("','", $h) . "')");
        }
    }
    $conf->ql("unlock tables");
    return true;
}
开发者ID:kohler,项目名称:peteramati,代码行数:17,代码来源:updateschema.php

示例3: __construct

 public function __construct($user, $rounds = null)
 {
     global $Conf;
     $this->contact = $user;
     $qp = "select PaperReview.contactId, timeRequested, reviewSubmitted, reviewRound";
     if (!$this->contact->privChair) {
         $qp .= ", conflictType from PaperReview left join PaperConflict on (PaperConflict.paperId=PaperReview.paperId and PaperConflict.contactId=" . $this->contact->contactId . ")";
     } else {
         $qp .= ", 0 conflictType from PaperReview";
     }
     $qp .= " where reviewType>" . REVIEW_PC . " or (reviewType=" . REVIEW_PC . " and timeRequested>0 and reviewSubmitted>0)";
     if (!$this->contact->privChair) {
         $qp .= " and coalesce(conflictType,0)=0";
     }
     $qa = array();
     if ($rounds) {
         $qp .= " and reviewRound ?a";
         $qa[] = $rounds;
     }
     $result = Dbl::qe_apply($qp, $qa);
     while ($row = edb_row($result)) {
         $cid = (int) $row[4] ? "conflicts" : (int) $row[0];
         $this->r[$cid][] = array((int) $row[1], (int) $row[2], (int) $row[3]);
     }
     Dbl::free($result);
     foreach ($Conf->round_list() as $rn => $r) {
         $dl = $Conf->review_deadline($rn, true, false);
         $this->dl[$rn] = +$Conf->setting($dl);
     }
     // maybe hide who's who
     if (!$this->contact->can_view_aggregated_review_identity()) {
         $who = $r = array();
         foreach ($this->r as $cid => $data) {
             if ($cid === "conflicts" || $cid == $this->contact->contactId) {
                 $r[$cid] = $data;
             } else {
                 do {
                     $ncid = mt_rand(1, 10 * count(pcMembers()));
                 } while (isset($who[$ncid]));
                 $who[$ncid] = true;
                 $r["x" . $ncid] = $data;
             }
         }
         $this->r = $r;
     }
 }
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:46,代码来源:reviewtimes.php

示例4: render

 function render($sv)
 {
     global $Conf, $Opt;
     echo "<h3 class=\"settings\">Abstract and PDF</h3>\n";
     echo Ht::select("sub_noabstract", [0 => "Abstract required", 2 => "Abstract optional", 1 => "No abstract"], opt_yes_no_optional("noAbstract"));
     echo " <span class=\"barsep\">·</span> ", Ht::select("sub_nopapers", array(0 => "PDF upload required", 2 => "PDF upload optional", 1 => "No PDF"), opt_yes_no_optional("noPapers"));
     if (is_executable("src/banal")) {
         echo "<div class='g'></div>", Ht::hidden("has_sub_banal", 1), "<table id='foldbanal' class='", $sv->curv("sub_banal") ? "foldo" : "foldc", "'>";
         $sv->echo_checkbox_row("sub_banal", "PDF format checker<span class='fx'>:</span>", "void fold('banal',!this.checked)");
         echo '<tr class="fx"><td></td><td class="top"><table class="secondary-settings"><tbody>';
         $bsetting = explode(";", preg_replace("/>.*/", "", $Conf->setting_data("sub_banal", "")));
         foreach (["papersize", "pagelimit", "columns", "textblock", "bodyfontsize", "bodyleading"] as $i => $name) {
             $val = get($bsetting, $i, "");
             $sv->set_oldv("sub_banal_{$name}", $val == "" ? "N/A" : $val);
         }
         $sv->echo_entry_row("sub_banal_papersize", "Paper size", "Examples: “letter”, “A4”, “8.5in&nbsp;x&nbsp;14in”,<br />“letter OR A4”");
         $sv->echo_entry_row("sub_banal_pagelimit", "Page limit");
         $sv->echo_entry_row("sub_banal_textblock", "Text block", "Examples: “6.5in&nbsp;x&nbsp;9in”, “1in&nbsp;margins”");
         echo '</tbody></table></td>', '<td><span class="sep"></span></td>', '<td class="top"><table class="secondary-settings"><tbody>';
         $sv->echo_entry_row("sub_banal_bodyfontsize", "Minimum body font size", null, "&nbsp;pt");
         $sv->echo_entry_row("sub_banal_bodyleading", "Minimum leading", null, "&nbsp;pt");
         $sv->echo_entry_row("sub_banal_columns", "Columns");
         echo "</tbody></table></td></tr></table>";
     }
     echo "<h3 class=\"settings\">Conflicts &amp; collaborators</h3>\n", "<table id=\"foldpcconf\" class=\"fold", $sv->curv("sub_pcconf") ? "o" : "c", "\">\n";
     $sv->echo_checkbox_row("sub_pcconf", "Collect authors’ PC conflicts", "void fold('pcconf',!this.checked)");
     echo "<tr class='fx'><td></td><td>";
     $conf = array();
     foreach (Conflict::$type_descriptions as $n => $d) {
         if ($n) {
             $conf[] = "“{$d}”";
         }
     }
     $sv->echo_checkbox("sub_pcconfsel", "Require conflict descriptions (" . commajoin($conf, "or") . ")");
     echo "</td></tr>\n";
     $sv->echo_checkbox_row("sub_collab", "Collect authors’ other collaborators as text");
     echo "</table>\n";
     echo "<h3 class=\"settings\">Submission options</h3>\n";
     echo "Options are selected by authors at submission time.  Examples have included “PC-authored paper,” “Consider this paper for a Best Student Paper award,” and “Allow the shadow PC to see this paper.”  The “option name” should be brief (“PC paper,” “Best Student Paper,” “Shadow PC”).  The optional description can explain further and may use XHTML.  ";
     echo "Add options one at a time.\n";
     echo "<div class='g'></div>\n", Ht::hidden("has_options", 1);
     $sep = "";
     $all_options = array_merge(PaperOption::nonfixed_option_list());
     // get our own iterator
     foreach ($all_options as $o) {
         echo $sep;
         $this->render_option($sv, $o);
         $sep = "\n<div style=\"margin-top:3em\"></div>\n";
     }
     echo $sep;
     $this->render_option($sv, null);
     // Topics
     // load topic interests
     $qinterest = $Conf->query_topic_interest();
     $result = $Conf->q("select topicId, if({$qinterest}>0,1,0), count(*) from TopicInterest where {$qinterest}!=0 group by topicId, {$qinterest}>0");
     $interests = array();
     $ninterests = 0;
     while ($row = edb_row($result)) {
         if (!isset($interests[$row[0]])) {
             $interests[$row[0]] = array();
         }
         $interests[$row[0]][$row[1]] = $row[2];
         $ninterests += $row[2] ? 1 : 0;
     }
     echo "<h3 class=\"settings g\">Topics</h3>\n";
     echo "Enter topics one per line.  Authors select the topics that apply to their papers; PC members use this information to find papers they'll want to review.  To delete a topic, delete its name.\n";
     echo "<div class='g'></div>", Ht::hidden("has_topics", 1), "<table id='newtoptable' class='", $ninterests ? "foldo" : "foldc", "'>";
     echo "<tr><th colspan='2'></th><th class='fx'><small>Low</small></th><th class='fx'><small>High</small></th></tr>";
     $td1 = '<td class="lcaption">Current</td>';
     foreach ($Conf->topic_map() as $tid => $tname) {
         if ($sv->use_req() && isset($sv->req["top{$tid}"])) {
             $tname = $sv->req["top{$tid}"];
         }
         echo '<tr>', $td1, '<td class="lentry">', Ht::entry("top{$tid}", $tname, array("size" => 40, "style" => "width:20em")), '</td>';
         $tinterests = defval($interests, $tid, array());
         echo '<td class="fx rpentry">', get($tinterests, 0) ? '<span class="topic-2">' . $tinterests[0] . "</span>" : "", "</td>", '<td class="fx rpentry">', get($tinterests, 1) ? '<span class="topic2">' . $tinterests[1] . "</span>" : "", "</td>";
         if ($td1 !== "<td></td>") {
             // example search
             echo "<td class='llentry' style='vertical-align:top' rowspan='40'><div class='f-i'>", "<div class='f-c'>Example search</div>";
             $oabbrev = strtolower($tname);
             if (strstr($oabbrev, " ") !== false) {
                 $oabbrev = "\"{$oabbrev}\"";
             }
             echo "“<a href=\"", hoturl("search", "q=topic:" . urlencode($oabbrev)), "\">", "topic:", htmlspecialchars($oabbrev), "</a>”", "<div class='hint'>Topic abbreviations are also allowed.</div>";
             if ($ninterests) {
                 echo "<a class='hint fn' href=\"#\" onclick=\"return fold('newtoptable')\">Show PC interest counts</a>", "<a class='hint fx' href=\"#\" onclick=\"return fold('newtoptable')\">Hide PC interest counts</a>";
             }
             echo "</div></td>";
         }
         echo "</tr>\n";
         $td1 = "<td></td>";
     }
     echo '<tr><td class="lcaption top">New<br><span class="hint">Enter one topic per line.</span></td><td class="lentry top">', Ht::textarea("topnew", $sv->use_req() ? get($sv->req, "topnew") : "", array("cols" => 40, "rows" => 2, "style" => "width:20em")), '</td></tr></table>';
 }
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:94,代码来源:s_subform.php

示例5: load_topics

 private function load_topics()
 {
     $result = Dbl::qe_raw("select group_concat(topicId) from PaperTopic where paperId={$this->paperId}");
     $row = edb_row($result);
     $this->topicIds = $row ? $row[0] : "";
     Dbl::free($result);
 }
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:7,代码来源:paperinfo.php

示例6: updateSchema

function updateSchema($Conf)
{
    global $Opt, $OK;
    // avoid error message abut timezone, set to $Opt
    // (which might be overridden by database values later)
    if (function_exists("date_default_timezone_set") && isset($Opt["timezone"]) && $Opt["timezone"]) {
        date_default_timezone_set($Opt["timezone"]);
    }
    while (($result = Dbl::ql("insert into Settings set name='__schema_lock', value=1 on duplicate key update value=1")) && $result->affected_rows == 0) {
        time_nanosleep(0, 200000000);
    }
    $Conf->update_schema_version(null);
    error_log($Opt["dbName"] . ": updating schema from version " . $Conf->sversion);
    if ($Conf->sversion == 6 && Dbl::ql("alter table ReviewRequest add `reason` text")) {
        $Conf->update_schema_version(7);
    }
    if ($Conf->sversion == 7 && Dbl::ql("alter table PaperReview add `textField7` mediumtext NOT NULL") && Dbl::ql("alter table PaperReview add `textField8` mediumtext NOT NULL") && Dbl::ql("insert into ReviewFormField set fieldName='textField7', shortName='Additional text field'") && Dbl::ql("insert into ReviewFormField set fieldName='textField8', shortName='Additional text field'")) {
        $Conf->update_schema_version(8);
    }
    if ($Conf->sversion == 8 && Dbl::ql("alter table ReviewFormField add `levelChar` tinyint(1) NOT NULL default '0'") && Dbl::ql("alter table PaperReviewArchive add `textField7` mediumtext NOT NULL") && Dbl::ql("alter table PaperReviewArchive add `textField8` mediumtext NOT NULL")) {
        $Conf->update_schema_version(9);
    }
    if ($Conf->sversion == 9 && Dbl::ql("alter table Paper add `sha1` varbinary(20) NOT NULL default ''")) {
        $Conf->update_schema_version(10);
    }
    if ($Conf->sversion == 10 && Dbl::ql("alter table PaperReview add `reviewRound` tinyint(1) NOT NULL default '0'") && Dbl::ql("alter table PaperReviewArchive add `reviewRound` tinyint(1) NOT NULL default '0'") && Dbl::ql("alter table PaperReview add key `reviewRound` (`reviewRound`)") && $Conf->update_schema_version(11)) {
        if (count($Conf->round_list()) > 1) {
            // update review rounds (XXX locking)
            $result = Dbl::ql("select paperId, tag from PaperTag where tag like '%~%'");
            $rrs = array();
            while ($row = edb_row($result)) {
                list($contact, $round) = explode("~", $row[1]);
                if ($round = array_search($round, $Conf->round_list())) {
                    if (!isset($rrs[$round])) {
                        $rrs[$round] = array();
                    }
                    $rrs[$round][] = "(contactId={$contact} and paperId={$row['0']})";
                }
            }
            foreach ($rrs as $round => $pairs) {
                $q = "update PaperReview set reviewRound={$round} where " . join(" or ", $pairs);
                Dbl::ql($q);
            }
            $x = trim(preg_replace('/(\\S+)\\s*/', "tag like '%~\$1' or ", $Conf->setting_data("tag_rounds")));
            Dbl::ql("delete from PaperTag where " . substr($x, 0, strlen($x) - 3));
        }
    }
    if ($Conf->sversion == 11 && Dbl::ql("create table `ReviewRating` (\n  `reviewId` int(11) NOT NULL,\n  `contactId` int(11) NOT NULL,\n  `rating` tinyint(1) NOT NULL default '0',\n  UNIQUE KEY `reviewContact` (`reviewId`,`contactId`),\n  UNIQUE KEY `reviewContactRating` (`reviewId`,`contactId`,`rating`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8")) {
        $Conf->update_schema_version(12);
    }
    if ($Conf->sversion == 12 && Dbl::ql("alter table PaperReview add `reviewToken` int(11) NOT NULL default '0'")) {
        $Conf->update_schema_version(13);
    }
    if ($Conf->sversion == 13 && Dbl::ql("alter table OptionType add `optionValues` text NOT NULL default ''")) {
        $Conf->update_schema_version(14);
    }
    if ($Conf->sversion == 14 && Dbl::ql("insert into Settings (name, value) select 'rev_tokens', count(reviewId) from PaperReview where reviewToken!=0 on duplicate key update value=values(value)")) {
        $Conf->update_schema_version(15);
    }
    if ($Conf->sversion == 15) {
        // It's OK if this fails!  Update 11 added reviewRound to
        // PaperReviewArchive (so old databases have the column), but I forgot
        // to upgrade schema.sql (so new databases lack the column).
        Dbl::ql("alter table PaperReviewArchive add `reviewRound` tinyint(1) NOT NULL default '0'");
        $OK = true;
        $Conf->update_schema_version(16);
    }
    if ($Conf->sversion == 16 && Dbl::ql("alter table PaperReview add `reviewEditVersion` int(1) NOT NULL default '0'")) {
        $Conf->update_schema_version(17);
    }
    if ($Conf->sversion == 17 && Dbl::ql("alter table PaperReviewPreference add key `paperId` (`paperId`)") && Dbl::ql("create table PaperRank (\n  `paperId` int(11) NOT NULL,\n  `contactId` int(11) NOT NULL,\n  `rank` int(11) NOT NULL,\n  UNIQUE KEY `contactPaper` (`contactId`,`paperId`),\n  KEY `paperId` (`paperId`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;")) {
        $Conf->update_schema_version(18);
    }
    if ($Conf->sversion == 18 && Dbl::ql("alter table PaperComment add `replyTo` int(11) NOT NULL")) {
        $Conf->update_schema_version(19);
    }
    if ($Conf->sversion == 19 && Dbl::ql("drop table PaperRank")) {
        $Conf->update_schema_version(20);
    }
    if ($Conf->sversion == 20 && Dbl::ql("alter table PaperComment add `timeNotified` int(11) NOT NULL default '0'")) {
        $Conf->update_schema_version(21);
    }
    if ($Conf->sversion == 21 && Dbl::ql("update PaperConflict set conflictType=8 where conflictType=3")) {
        $Conf->update_schema_version(22);
    }
    if ($Conf->sversion == 22 && Dbl::ql("insert into ChairAssistant (contactId) select contactId from Chair on duplicate key update ChairAssistant.contactId=ChairAssistant.contactId") && Dbl::ql("update ContactInfo set roles=roles+2 where roles=5")) {
        $Conf->update_schema_version(23);
    }
    if ($Conf->sversion == 23) {
        $Conf->update_schema_version(24);
    }
    if ($Conf->sversion == 24 && Dbl::ql("alter table ContactInfo add `preferredEmail` varchar(120)")) {
        $Conf->update_schema_version(25);
    }
    if ($Conf->sversion == 25) {
        if ($Conf->settings["final_done"] > 0 && !isset($Conf->settings["final_soft"]) && Dbl::ql("insert into Settings (name, value) values ('final_soft', " . $Conf->settings["final_done"] . ") on duplicate key update value=values(value)")) {
            $Conf->settings["final_soft"] = $Conf->settings["final_done"];
        }
        $Conf->update_schema_version(26);
    }
//.........这里部分代码省略.........
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:101,代码来源:updateschema.php

示例7: header

// face.php -- Peteramati face page
// HotCRP and Peteramati are Copyright (c) 2006-2015 Eddie Kohler and others
// See LICENSE for open-source distribution terms
require_once "src/initweb.php";
ContactView::set_path_request(array("/u"));
if ($Me->is_empty()) {
    $Me->escape();
}
global $User, $Pset, $Info;
$User = $Me;
if (isset($_REQUEST["u"])) {
    $User = ContactView::prepare_user($_REQUEST["u"]);
}
if (isset($_REQUEST["imageid"])) {
    if ($User && ($User === $Me || $Me->isPC) && $_REQUEST["imageid"] && ($result = Dbl::qe("select mimetype, `data` from ContactImage where contactId=? and contactImageId=?", $User->contactId, $_REQUEST["imageid"])) && ($row = edb_row($result))) {
        header("Content-Type: {$row['0']}");
        header("Cache-Control: public, max-age=31557600");
        header("Expires: " . gmdate("D, d M Y H:i:s", $Now + 31557600) . " GMT");
        if (!$zlib_output_compression) {
            header("Content-Length: " . strlen($row[1]));
        }
        print $row[1];
    } else {
        header("Content-Type: image/gif");
        if (!$zlib_output_compression) {
            header("Content-Length: 43");
        }
        print "GIF89a€!ù,D;";
    }
    exit;
开发者ID:kohler,项目名称:peteramati,代码行数:30,代码来源:face.php

示例8: createAnonymousReview

function createAnonymousReview()
{
    global $Conf, $Me, $Now, $prow, $rrows;
    Dbl::qe_raw("lock tables PaperReview write, PaperReviewRefused write, ContactInfo write, PaperConflict read, ActionLog write");
    // find an unassigned anonymous review contact
    $contactemail = unassignedAnonymousContact();
    $result = Dbl::qe_raw("select contactId from ContactInfo where email='" . sqlq($contactemail) . "'");
    if (edb_nrows($result) == 1) {
        $row = edb_row($result);
        $reqId = $row[0];
    } else {
        $result = Dbl::qe("insert into ContactInfo set firstName='Jane Q.', lastName='Public', unaccentedName='Jane Q. Public', email=?, affiliation='Unaffiliated', password='', disabled=1, creationTime={$Now}", $contactemail);
        if (!$result) {
            return $result;
        }
        $reqId = $result->insert_id;
    }
    // store the review request
    $reviewId = $Me->assign_review($prow->paperId, $reqId, REVIEW_EXTERNAL, array("mark_notify" => true, "token" => true));
    if ($reviewId) {
        $result = Dbl::ql("select reviewToken from PaperReview where reviewId={$reviewId}");
        $row = edb_row($result);
        $Conf->confirmMsg("Created a new anonymous review for paper #{$prow->paperId}. The review token is " . encode_token((int) $row[0]) . ".");
    }
    Dbl::qx_raw("unlock tables");
    $Conf->update_rev_tokens_setting(true);
    return true;
}
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:28,代码来源:assign.php

示例9: save

 public function save($sv, $si)
 {
     global $Conf;
     if ($si->name == "tag_vote" && $sv->has_savedv("tag_vote")) {
         // check allotments
         $pcm = pcMembers();
         foreach (preg_split('/\\s+/', $sv->savedv("tag_vote")) as $t) {
             if ($t === "") {
                 continue;
             }
             $base = substr($t, 0, strpos($t, "#"));
             $allotment = substr($t, strlen($base) + 1);
             $result = Dbl::q("select paperId, tag, tagIndex from PaperTag where tag like '%~" . sqlq_for_like($base) . "'");
             $pvals = array();
             $cvals = array();
             $negative = false;
             while ($row = edb_row($result)) {
                 $who = substr($row[1], 0, strpos($row[1], "~"));
                 if ($row[2] < 0) {
                     $sv->set_error(null, "Removed " . Text::user_html($pcm[$who]) . "’s negative “{$base}” vote for paper #{$row['0']}.");
                     $negative = true;
                 } else {
                     $pvals[$row[0]] = defval($pvals, $row[0], 0) + $row[2];
                     $cvals[$who] = defval($cvals, $who, 0) + $row[2];
                 }
             }
             foreach ($cvals as $who => $what) {
                 if ($what > $allotment) {
                     $sv->set_error("tag_vote", Text::user_html($pcm[$who]) . " already has more than {$allotment} votes for tag “{$base}”.");
                 }
             }
             $q = $negative ? " or (tag like '%~" . sqlq_for_like($base) . "' and tagIndex<0)" : "";
             $Conf->qe("delete from PaperTag where tag='" . sqlq($base) . "'{$q}");
             $q = array();
             foreach ($pvals as $pid => $what) {
                 $q[] = "({$pid}, '" . sqlq($base) . "', {$what})";
             }
             if (count($q) > 0) {
                 $Conf->qe("insert into PaperTag values " . join(", ", $q));
             }
         }
     }
     if ($si->name == "tag_approval" && $sv->has_savedv("tag_approval")) {
         $pcm = pcMembers();
         foreach (preg_split('/\\s+/', $sv->savedv("tag_approval")) as $t) {
             if ($t === "") {
                 continue;
             }
             $result = $Conf->q("select paperId, tag, tagIndex from PaperTag where tag like '%~" . sqlq_for_like($t) . "'");
             $pvals = array();
             $negative = false;
             while ($row = edb_row($result)) {
                 $who = substr($row[1], 0, strpos($row[1], "~"));
                 if ($row[2] < 0) {
                     $sv->set_error(null, "Removed " . Text::user_html($pcm[$who]) . "’s negative “{$t}” approval vote for paper #{$row['0']}.");
                     $negative = true;
                 } else {
                     $pvals[$row[0]] = defval($pvals, $row[0], 0) + 1;
                 }
             }
             $q = $negative ? " or (tag like '%~" . sqlq_for_like($t) . "' and tagIndex<0)" : "";
             $Conf->qe("delete from PaperTag where tag='" . sqlq($t) . "'{$q}");
             $q = array();
             foreach ($pvals as $pid => $what) {
                 $q[] = "({$pid}, '" . sqlq($t) . "', {$what})";
             }
             if (count($q) > 0) {
                 $Conf->qe("insert into PaperTag values " . join(", ", $q));
             }
         }
     }
     TagInfo::invalidate_defined_tags();
 }
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:73,代码来源:s_tags.php

示例10: get

}
$fetchscript = get($PsetInfo, "_facefetch_script");
if (count($arg["_"])) {
    $fetchscript = $arg["_"][0];
}
if (!$fetchscript) {
    fwrite(STDERR, "Need `_facefetch_script` configuration option or argument.\n");
    exit(1);
}
if (!isset($arg["limit"])) {
    $arg["limit"] = get($arg, "l");
}
$limit = (int) $arg["limit"];
$result = Dbl::qe("select contactId, email, huid from ContactInfo" . (isset($arg["all"]) || isset($arg["a"]) ? "" : " where contactImageId is null"));
$rows = array();
while ($row = edb_row($result)) {
    $rows[] = $row;
}
if ($limit) {
    shuffle($rows);
}
Dbl::free($result);
$n = $nworked = 0;
foreach ($rows as $row) {
    $url = $facefetch_urlpattern;
    if ($row[1] === null && strpos($url, '${EMAIL}') !== false || $row[2] === null && strpos($url, '${ID}') !== false) {
        continue;
    }
    $url = str_replace('${EMAIL}', urlencode($row[1]), $url);
    $url = str_replace('${ID}', urlencode($row[2]), $url);
    // fwrite(STDOUT, "$row[1] $fetchscript " . escapeshellarg($url) . " ");
开发者ID:kohler,项目名称:peteramati,代码行数:31,代码来源:facefetch.php

示例11: echo_commit

function echo_commit($Info)
{
    global $Conf, $Me, $User, $Pset;
    global $TABWIDTH, $WDIFF;
    $Notes = $Info->commit_info();
    $TABWIDTH = $Info->commit_info("tabwidth") ?: 4;
    $WDIFF = isset($Notes->wdiff) ? $Notes->wdiff : false;
    // current commit and commit selector
    $sel = array();
    $curhead = $grouphead = null;
    foreach ($Info->recent_commits() as $k) {
        // visually separate older heads
        if ($curhead === null) {
            $curhead = $k->fromhead;
        }
        if ($curhead != $k->fromhead) {
            if (!$grouphead) {
                $sel["from.{$k->fromhead}"] = (object) array("type" => "optgroup", "label" => "Other snapshots");
            } else {
                $sel["from.{$k->fromhead}"] = null;
            }
            $curhead = $grouphead = $k->fromhead;
        }
        // actual option
        $x = UnicodeHelper::utf8_prefix($k->subject, 72);
        if (strlen($x) != strlen($k->subject)) {
            $x .= "...";
        }
        $sel[$k->hash] = substr($k->hash, 0, 7) . " " . htmlspecialchars($x);
    }
    $result = $Conf->qe("select hash from CommitNotes where (haslinenotes & ?)!=0 and pset=? and hash ?a", $Me == $User && !$Info->can_see_grades ? HASNOTES_COMMENT : HASNOTES_ANY, $Pset->psetid, array_keys($sel));
    while ($row = edb_row($result)) {
        $sel[$row[0]] .= " &nbsp;♪";
    }
    if (($h = $Info->grading_hash()) && isset($sel[$h])) {
        $sel[$h] = preg_replace('_(.*?)(?: &nbsp;)?(♪?)\\z_', '$1 &nbsp;✱$2', $sel[$h]);
    }
    if ($Info->is_grading_commit()) {
        $key = "grading commit";
    } else {
        $key = "this commit";
    }
    $value = Ht::select("newcommit", $sel, $Info->commit_hash(), array("onchange" => "jQuery(this).closest('form').submit()"));
    if ($Me != $User) {
        $x = $Info->is_grading_commit() ? "" : "font-weight:bold";
        $value .= " " . Ht::submit("grade", "Grade", array("style" => $x));
    }
    // view options
    $fold_viewoptions = !isset($_REQUEST["tab"]) && !isset($_REQUEST["wdiff"]);
    $value .= '<div class="viewoptions61">' . '<a class="q" href="#" onclick="return fold61(this.nextSibling,this.parentNode)">' . '<span class="foldarrow">' . ($fold_viewoptions ? '&#x25B6;' : '&#x25BC;') . '</span>&nbsp;options</a><span style="padding-left:1em' . ($fold_viewoptions ? ';display:none' : '') . '">tab width:';
    foreach (array(2, 4, 8) as $i) {
        $value .= '&nbsp;<a href="' . self_href(array("tab" => $i)) . '"' . ($TABWIDTH == $i ? " class=\"q\"><strong>{$i}</strong>" : '>' . $i) . '</a>';
    }
    $value .= '<span style="padding-left:1em">wdiff:';
    foreach (array("no", "yes") as $i => $t) {
        $value .= '&nbsp;<a href="' . self_href(array("wdiff" => $i)) . '"' . (!$WDIFF == !$i ? " class=\"q\"><strong>{$t}</strong>" : '>' . $t) . '</a>';
    }
    $value .= '</span></span></div>';
    // warnings
    $remarks = array();
    if (!$Info->grading_hash() && $Me != $User && !$Pset->gitless_grades) {
        $remarks[] = array(true, "No commit has been marked for grading.");
    } else {
        if (!$Info->is_grading_commit() && $Info->grading_hash()) {
            $remarks[] = array(true, "This is not " . "<a class=\"uu\" href=\"" . $Info->hoturl("pset", array("commit" => $Info->grading_hash())) . "\">the commit currently marked for grading</a>" . " <span style=\"font-weight:normal\">(<a href=\"" . $Info->hoturl("diff", array("commit1" => $Info->grading_hash())) . "\">see diff</a>)</span>.");
        }
    }
    if (!$Info->is_latest_commit()) {
        $remarks[] = array(true, "This is not " . "<a class=\"uu\" href=\"" . $Info->hoturl("pset", array("commit" => $Info->latest_hash())) . "\">the latest commit</a>" . " <span style=\"font-weight:normal\">(<a href=\"" . $Info->hoturl("diff", array("commit1" => $Info->latest_hash())) . "\">see diff</a>)</span>.");
    }
    if (($lh = $Info->late_hours()) && $lh->hours > 0) {
        $extra = array();
        if (get($lh, "commitat")) {
            $extra[] = "commit at " . $Conf->printableTimestamp($lh->commitat);
        }
        if (get($lh, "deadline")) {
            $extra[] = "deadline " . $Conf->printableTimestamp($lh->deadline);
        }
        $extra = count($extra) ? ' <span style="font-weight:normal">(' . join(", ", $extra) . ')</span>' : "";
        $remarks[] = array(true, "This commit uses " . plural($lh->hours, "late hour") . $extra . ".");
    }
    if (($Info->is_latest_commit() || $Me->isPC) && $Pset->handout_repo_url) {
        $Pset->latest_handout_commit();
        $last_handout = $Pset->latest_handout_commit();
        $last_myhandout = $last_handout ? $Info->derived_handout_hash() : false;
        if ($last_handout && $last_myhandout && $last_handout->hash == $last_myhandout) {
            /* this is ideal: they have the latest handout commit */
        } else {
            if ($last_handout && $last_myhandout) {
                // they don't have the latest updates
                $remarks[] = array(true, "Updates are available for this problem set <span style=\"font-weight:normal\">(<a href=\"" . $Info->hoturl("diff", array("commit" => $last_myhandout, "commit1" => $last_handout->hash)) . "\">see diff</a>)</span>. Run <code>git pull handout master</code> to merge these updates.");
            } else {
                if ($last_handout) {
                    $remarks[] = array(true, "Please create your repository by cloning our repository. Creating your repository from scratch makes it harder for you to get pset updates.");
                } else {
                    if (!$last_handout && $Me->isPC) {
                        $handout_files = $Pset->handout_repo()->ls_files("master");
                        if (!count($handout_files)) {
                            $remarks[] = array(true, "The handout repository, " . htmlspecialchars($Pset->handout_repo_url) . ", contains no files; perhaps handout_repo_url is misconfigured.");
                        } else {
//.........这里部分代码省略.........
开发者ID:kohler,项目名称:peteramati,代码行数:101,代码来源:pset.php

示例12: genericWatch

function genericWatch($prow, $watchtype, $callback)
{
    global $Conf, $Me;
    $q = "select C.contactId, firstName, lastName, email,\n\t\tpassword, roles, defaultWatch,\n\t\tR.reviewType as myReviewType,\n\t\tR.reviewSubmitted as myReviewSubmitted,\n\t\tR.reviewNeedsSubmit as myReviewNeedsSubmit,\n\t\tconflictType, watch, preferredEmail";
    if ($Conf->sversion >= 47) {
        $q .= ", disabled";
    }
    $q .= "\nfrom ContactInfo C\n\t\tleft join PaperConflict Conf on (Conf.paperId={$prow->paperId} and Conf.contactId=C.contactId)\n\t\tleft join PaperWatch W on (W.paperId={$prow->paperId} and W.contactId=C.contactId)\n\t\tleft join PaperReview R on (R.paperId={$prow->paperId} and R.contactId=C.contactId)\n\t\tleft join PaperComment Cmt on (Cmt.paperId={$prow->paperId} and Cmt.contactId=C.contactId)\n";
    $q .= "where watch is not null" . " or conflictType>=" . CONFLICT_AUTHOR . " or reviewType is not null or commentId is not null" . " or (defaultWatch & " . ($watchtype << WATCHSHIFT_ALL) . ")!=0";
    // save review information since we modify $prow
    $saveProw = (object) null;
    setReviewInfo($saveProw, $prow);
    $result = $Conf->qe($q, "while processing email notifications");
    $watchers = array();
    $lastContactId = 0;
    while ($row = edb_orow($result)) {
        if ($row->contactId == $lastContactId || $row->contactId == $Me->contactId || preg_match('/\\Aanonymous\\d*\\z/', $row->email)) {
            continue;
        }
        $lastContactId = $row->contactId;
        if ($row->watch && $row->watch & $watchtype << WATCHSHIFT_EXPLICIT) {
            if (!($row->watch & $watchtype << WATCHSHIFT_NORMAL)) {
                continue;
            }
        } else {
            if (!($row->defaultWatch & ($watchtype << WATCHSHIFT_NORMAL | $watchtype << WATCHSHIFT_ALL))) {
                continue;
            }
        }
        $watchers[$row->contactId] = $row;
    }
    // Need to check for outstanding reviews if the settings might prevent a
    // person with outstanding reviews from seeing a comment.
    if (count($watchers) && ($Conf->timePCViewAllReviews(false, false) && !$Conf->timePCViewAllReviews(false, true) || $Conf->timeAuthorViewReviews(false) && !$Conf->timeAuthorViewReviews(true))) {
        $result = $Conf->qe("select C.contactId, R.contactId, max(R.reviewNeedsSubmit) from ContactInfo C\n \t\tleft join PaperReview R on (R.contactId=C.contactId)\n\t\twhere C.contactId in (" . join(",", array_keys($watchers)) . ")\n\t\tgroup by C.contactId", "while processing email notifications");
        while ($row = edb_row($result)) {
            $watchers[$row[0]]->isReviewer = $row[1] > 0;
            $watchers[$row[0]]->reviewsOutstanding = $row[2] > 0;
        }
    }
    $method = is_array($callback) ? $callback[1] : null;
    foreach ($watchers as $row) {
        $minic = Contact::make($row);
        setReviewInfo($prow, $row);
        if ($method) {
            $callback[0]->{$method}($prow, $minic);
        } else {
            $callback($prow, $minic);
        }
    }
    setReviewInfo($prow, $saveProw);
}
开发者ID:benesch,项目名称:peteramati,代码行数:52,代码来源:helpers.php

示例13: set_my_conflicts

 private function set_my_conflicts()
 {
     $this->my_conflicts = array();
     $result = Dbl::qe("select Paper.paperId, managerContactId from Paper join PaperConflict on (PaperConflict.paperId=Paper.paperId) where conflictType>0 and PaperConflict.contactId=" . $this->contact->contactId);
     while ($row = edb_row($result)) {
         $this->my_conflicts[$row[0]] = $row[1] ? $row[1] : true;
     }
     Dbl::free($result);
 }
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:9,代码来源:assigners.php

示例14: store_database

 function store_database($dbinfo, $doc)
 {
     global $Conf, $OK;
     $N = 400000;
     $idcol = $dbinfo->id_column;
     $while = "while storing document in database";
     $a = $ks = $vs = array();
     foreach ($dbinfo->columns as $k => $v) {
         if ($k !== $idcol) {
             $ks[] = "`{$k}`=?";
             $vs[] = substr($v, 0, $N);
         }
     }
     if (isset($dbinfo->columns[$idcol])) {
         $q = "update {$dbinfo->table} set " . join(",", $ks) . " where {$idcol}=?";
         $vs[] = $dbinfo->columns[$idcol];
     } else {
         $q = "insert into {$dbinfo->table} set " . join(",", $ks);
     }
     if (!($result = Dbl::query_apply($q, $vs))) {
         set_error_html($doc, $Conf->db_error_html(true, $while));
         return;
     }
     if (isset($dbinfo->columns[$idcol])) {
         $doc->{$idcol} = $dbinfo->columns[$idcol];
     } else {
         $doc->{$idcol} = $result->insert_id;
         if (!$doc->{$idcol}) {
             set_error_html($doc, $Conf->db_error_html(true, $while));
             $OK = false;
             return;
         }
     }
     for ($pos = $N; true; $pos += $N) {
         $a = array();
         foreach ($dbinfo->columns as $k => $v) {
             if (strlen($v) > $pos) {
                 $a[] = "`" . $k . "`=concat(`" . $k . "`,'" . sqlq(substr($v, $pos, $N)) . "')";
             }
         }
         if (!count($a)) {
             break;
         }
         if (!$Conf->q("update {$dbinfo->table} set " . join(",", $a) . " where {$idcol}=" . $doc->{$idcol})) {
             set_error_html($doc, $Conf->db_error_html(true, $while));
             return;
         }
     }
     // check that paper storage succeeded
     if ($dbinfo->check_contents && (!($result = $Conf->qe("select length({$dbinfo->check_contents}) from {$dbinfo->table} where {$idcol}=" . $doc->{$idcol})) || !($row = edb_row($result)) || $row[0] != strlen(self::content($doc)))) {
         set_error_html($doc, "Failed to store your document. Usually this is because the file you tried to upload was too big for our system. Please try again.");
         return;
     }
 }
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:54,代码来源:filer.php

示例15: _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


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