本文整理汇总了PHP中Contact::contactdb方法的典型用法代码示例。如果您正苦于以下问题:PHP Contact::contactdb方法的具体用法?PHP Contact::contactdb怎么用?PHP Contact::contactdb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contact
的用法示例。
在下文中一共展示了Contact::contactdb方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_password
function save_password($email, $encoded_password, $iscdb = false)
{
global $Conf, $Now;
$dblink = $iscdb ? Contact::contactdb() : $Conf->dblink;
Dbl::qe($dblink, "update ContactInfo set password=?, passwordTime=? where email=?", $encoded_password, $Now, $email);
++$Now;
}
示例2: do_setting_update
//.........这里部分代码省略.........
if ($sv->has_savedv("pc_seeall")) {
// see also conference.php
if ($sv->savedv("pc_seeall") <= 0) {
$x = "timeSubmitted>0";
} else {
$x = "timeWithdrawn<=0";
}
$num = Dbl::fetch_ivalue("select paperId from Paper where {$x} limit 1") ? 1 : 0;
if ($num != $Conf->setting("papersub")) {
$sv->save("papersub", $num);
}
}
// Setting relationships
if ($sv->has_savedv("sub_open") && $sv->newv("sub_open", 1) <= 0 && $sv->oldv("sub_open") > 0 && $sv->newv("sub_sub") <= 0) {
$sv->save("sub_close", $Now);
}
if ($sv->has_savedv("msg.clickthrough_submit")) {
$sv->save("clickthrough_submit", null);
}
// make settings
$changedn = [];
if (!$sv->has_errors() && (count($sv->savedv) || count($sv->save_callbacks))) {
$tables = "Settings write";
foreach ($sv->need_lock as $t => $need) {
if ($need) {
$tables .= ", {$t} write";
}
}
$Conf->qe("lock tables {$tables}");
// load db settings, pre-crosscheck
$dbsettings = array();
$result = Dbl::qe("select name, value, data from Settings");
while ($row = edb_row($result)) {
$dbsettings[$row[0]] = $row;
}
Dbl::free($result);
// apply settings
foreach ($sv->save_callbacks as $si) {
$p = $sv->parser($si);
$p->save($sv, $si);
}
$dv = $aq = $av = array();
foreach ($sv->savedv as $n => $v) {
if (substr($n, 0, 4) === "opt." && $v !== null) {
$okey = substr($n, 4);
$oldv = array_key_exists($okey, $OptOverride) ? $OptOverride[$okey] : get($Opt, $okey);
$Opt[$okey] = $v[1] === null ? $v[0] : $v[1];
if ($oldv === $Opt[$okey]) {
$v = null;
} else {
if (!array_key_exists($okey, $OptOverride)) {
$OptOverride[$okey] = $oldv;
}
}
}
if ($v === null ? !isset($dbsettings[$n]) : isset($dbsettings[$n]) && (int) $dbsettings[$n][1] === $v[0] && $dbsettings[$n][2] === $v[1]) {
continue;
}
$changedn[] = $n;
if ($v !== null) {
$aq[] = "(?, ?, ?)";
array_push($av, $n, $v[0], $v[1]);
} else {
$dv[] = $n;
}
}
if (count($dv)) {
Dbl::qe_apply("delete from Settings where name?a", array($dv));
//Conf::msg_info(Ht::pre_text_wrap(Dbl::format_query_apply("delete from Settings where name?a", array($dv))));
}
if (count($aq)) {
Dbl::qe_apply("insert into Settings (name, value, data) values\n\t" . join(",\n\t", $aq) . "\n\ton duplicate key update value=values(value), data=values(data)", $av);
//Conf::msg_info(Ht::pre_text_wrap(Dbl::format_query_apply("insert into Settings (name, value, data) values\n\t" . join(",\n\t", $aq) . "\n\ton duplicate key update value=values(value), data=values(data)", $av)));
}
$Conf->qe("unlock tables");
if (count($changedn)) {
$Me->log_activity("Updated settings " . join(", ", $changedn));
}
$Conf->load_settings();
// contactdb may need to hear about changes to shortName
if ($sv->has_savedv("opt.shortName") && get($Opt, "contactdb_dsn") && ($cdb = Contact::contactdb())) {
Dbl::ql($cdb, "update Conferences set shortName=? where dbName=?", $Opt["shortName"], $Opt["dbName"]);
}
}
// update the review form in case it's changed
ReviewForm::clear_cache();
if (!$sv->has_errors()) {
$Conf->save_session("settings_highlight", $sv->error_fields());
if (count($changedn)) {
$Conf->confirmMsg("Changes saved.");
} else {
$Conf->warnMsg("No changes.");
}
$sv->report();
redirectSelf();
} else {
SettingGroup::crosscheck($sv, $Group);
$sv->report();
}
}
示例3: fwrite
Dbl::free($result);
}
if ($papers) {
$result = Dbl::ql(Contact::contactdb(), "select confid from Conferences where `dbname`=?", $Opt["dbName"]);
$row = Dbl::fetch_first_row($result);
if (!$row) {
fwrite(STDERR, "Conference is not recored in contactdb\n");
exit(1);
}
$confid = $row[0];
$result = Dbl::ql($Conf->dblink, "select paperId, title from Paper");
$q = array();
while ($row = edb_row($result)) {
$q[] = "(" . $confid . "," . $row[0] . ",'" . sqlq($row[1]) . "')";
}
Dbl::free($result);
for ($i = 0; $i < count($q); $i += 25) {
$xq = array_slice($q, $i, 25);
Dbl::ql_raw(Contact::contactdb(), "insert into ConferencePapers (confid,paperId,title) values " . join(",", $xq) . " on duplicate key update title=values(title)");
}
}
if ($collaborators) {
$result = Dbl::ql($Conf->dblink, "select email, collaborators, updateTime, lastLogin from ContactInfo where collaborators is not null and collaborators!=''");
while ($row = edb_row($result)) {
$time = (int) $row[2] ?: (int) $row[3];
if ($time > 0) {
Dbl::ql(Contact::contactdb(), "update ContactInfo set collaborators=?, updateTime=? where email=? and (collaborators is null or collaborators='' or updateTime<?)", $row[1], $time, $row[0], $time);
}
}
Dbl::free($result);
}
示例4: fwrite
{
fwrite(STDERR, $message);
exit(1);
}
// Initialize from an empty database.
if (!$Conf->dblink->multi_query(file_get_contents("{$ConfSitePATH}/src/schema.sql"))) {
die_hard("* Can't reinitialize database.\n" . $Conf->dblink->error);
}
while ($Conf->dblink->more_results()) {
Dbl::free($Conf->dblink->next_result());
}
// No setup phase.
$Conf->qe("delete from Settings where name='setupPhase'");
$Conf->load_settings();
// Contactdb.
if ($cdb = Contact::contactdb()) {
if (!$cdb->multi_query(file_get_contents("{$ConfSitePATH}/test/cdb-schema.sql"))) {
die_hard("* Can't reinitialize contact database.\n" . $cdb->error);
}
while ($cdb->more_results()) {
Dbl::free($cdb->next_result());
}
}
// Create initial administrator user.
$Admin = Contact::create(array("email" => "chair@_.com", "name" => "Jane Chair", "password" => "testchair"));
$Admin->save_roles(Contact::ROLE_ADMIN | Contact::ROLE_CHAIR | Contact::ROLE_PC, $Admin);
// Load data.
$json = json_decode(file_get_contents("{$ConfSitePATH}/test/db.json"));
if (!$json) {
die_hard("* test/testdb.json error: " . json_last_error_msg() . "\n");
}
示例5: capability_manager
public function capability_manager($for = null)
{
global $Opt;
if ($for && substr($for, 0, 1) === "U") {
if ($cdb = Contact::contactdb()) {
return new CapabilityManager($cdb, "U");
} else {
return null;
}
} else {
return new CapabilityManager($this->dblink, "");
}
}
示例6: json_exit
} else {
if ($qreq->fn === "events") {
json_exit(["ok" => false]);
}
}
if ($qreq->fn === "searchcompletion") {
$s = new PaperSearch($Me, "");
$Conf->ajaxExit(array("ok" => true, "searchcompletion" => $s->search_completion()));
}
// from here on: `status` and `track` requests
if ($qreq->fn === "track") {
MeetingTracker::track_api($qreq, $Me);
}
// may fall through to act like `status`
$j = $Me->my_deadlines($Conf->paper);
if ($qreq->conflist && $Me->has_email() && ($cdb = Contact::contactdb())) {
$j->conflist = array();
$result = Dbl::ql($cdb, "select c.confid, siteclass, shortName, url\n from Roles r join Conferences c on (c.confid=r.confid)\n join ContactInfo u on (u.contactDbId=r.contactDbId)\n where u.email=? order by r.updated_at desc", $Me->email);
while ($row = edb_orow($result)) {
$row->confid = (int) $row->confid;
$j->conflist[] = $row;
}
}
$pj = (object) array();
if ($Conf->paper && $Me->can_view_tags($Conf->paper)) {
$Conf->paper->add_tag_info_json($pj, $Me);
}
if (count((array) $pj)) {
$j->p = [$Conf->paper->paperId => $pj];
}
$j->ok = true;
示例7: capability_manager
public function capability_manager($for)
{
global $Opt;
if (@$Opt["contactdb_dsn"] && ($cdb = Contact::contactdb()) && (is_string($for) && substr($for, 0, 1) === "U" || $for instanceof Contact && $for->contactDbId)) {
return new CapabilityManager($cdb, "U");
} else {
return new CapabilityManager($this->dblink, "");
}
}