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


PHP UserStatus::save方法代码示例

本文整理汇总了PHP中UserStatus::save方法的典型用法代码示例。如果您正苦于以下问题:PHP UserStatus::save方法的具体用法?PHP UserStatus::save怎么用?PHP UserStatus::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserStatus的用法示例。


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

示例1: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new UserStatus();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['UserStatus'])) {
         $model->attributes = $_POST['UserStatus'];
         if ($model->save()) {
             Yii::app()->user->setFlash('success', 'Saved successfully');
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:optimosolution,项目名称:jasorbd,代码行数:18,代码来源:UserStatusController.php

示例2: while

    }
    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");
}
foreach ($json->contacts as $c) {
    $us = new UserStatus();
    if (!$us->save($c)) {
        die_hard("* failed to create user {$c->email}\n");
    }
}
foreach ($json->papers as $p) {
    $ps = new PaperStatus(null);
    if (!$ps->save_paper_json($p)) {
        die_hard("* failed to create paper {$p->title}:\n" . htmlspecialchars_decode(join("\n", $ps->error_html())) . "\n");
    }
}
$assignset = new AssignmentSet($Admin, true);
$assignset->parse($json->assignments_1, null, null);
$assignset->execute();
class Xassert
{
    public static $n = 0;
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:31,代码来源:setup.php

示例3: do_tags

function do_tags()
{
    global $Conf, $Me, $papersel;
    // check tags
    $tagger = new Tagger($Me);
    $t1 = array();
    $errors = array();
    foreach (preg_split('/[\\s,]+/', (string) @$_REQUEST["tag"]) as $t) {
        if ($t === "") {
            /* nada */
        } else {
            if (!($t = $tagger->check($t, Tagger::NOPRIVATE))) {
                $errors[] = $tagger->error_html;
            } else {
                if (TagInfo::base($t) === "pc") {
                    $errors[] = "The “pc” user tag is set automatically for all PC members.";
                } else {
                    $t1[] = $t;
                }
            }
        }
    }
    if (count($errors)) {
        return Conf::msg_error(join("<br>", $errors));
    } else {
        if (!count($t1)) {
            return $Conf->warnMsg("Nothing to do.");
        }
    }
    // modify database
    Dbl::qe("lock tables ContactInfo write");
    Conf::$no_invalidate_caches = true;
    $users = array();
    if ($_REQUEST["tagtype"] === "s") {
        // erase existing tags
        $likes = array();
        $removes = array();
        foreach ($t1 as $t) {
            list($tag, $index) = TagInfo::split_index($t);
            $removes[] = $t;
            $likes[] = "contactTags like " . Dbl::utf8ci("'% " . sqlq_for_like($tag) . "#%'");
        }
        foreach (Dbl::fetch_first_columns(Dbl::qe("select contactId from ContactInfo where " . join(" or ", $likes))) as $cid) {
            $users[(int) $cid] = (object) array("id" => (int) $cid, "add_tags" => [], "remove_tags" => $removes);
        }
    }
    // account for request
    $key = $_REQUEST["tagtype"] === "d" ? "remove_tags" : "add_tags";
    foreach ($papersel as $cid) {
        if (!isset($users[(int) $cid])) {
            $users[(int) $cid] = (object) array("id" => (int) $cid, "add_tags" => [], "remove_tags" => []);
        }
        $users[(int) $cid]->{$key} = array_merge($users[(int) $cid]->{$key}, $t1);
    }
    // apply modifications
    foreach ($users as $cid => $cj) {
        $us = new UserStatus(array("send_email" => false));
        if (!$us->save($cj)) {
            $errors = array_merge($errors, $us->error_messages());
        }
    }
    Dbl::qe("unlock tables");
    Conf::$no_invalidate_caches = false;
    $Conf->invalidateCaches(["pc" => true]);
    // report
    if (!count($errors)) {
        $Conf->confirmMsg("Tags saved.");
        redirectSelf(array("tagact" => null, "tag" => null));
    } else {
        Conf::msg_error(join("<br>", $errors));
    }
}
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:72,代码来源:users.php

示例4: crpmerge

function crpmerge($MiniMe)
{
    global $Conf, $Me, $MergeError;
    if (!$MiniMe->contactId && !$Me->contactId) {
        return $MergeError = "Neither of those accounts has any data associated with this conference.";
    }
    // XXX `act as` merging might be useful?
    if (strcasecmp($Me->email, $_SESSION["trueuser"]->email)) {
        return $MergeError = "You can’t merge accounts when acting as a different user.";
    }
    // determine old & new users
    if (@$_REQUEST["prefer"]) {
        list($old_user, $new_user) = [$Me, $MiniMe];
    } else {
        list($old_user, $new_user) = [$MiniMe, $Me];
    }
    // send mail at start of process
    HotCRPMailer::send_to($old_user, "@mergeaccount", null, array("cc" => Text::user_email_to($new_user), "other_contact" => $new_user));
    // actually merge users or change email
    if ($old_user->contactId && $new_user->contactId) {
        crpmerge_database($old_user, $new_user);
    } else {
        if ($old_user->contactId) {
            $user_status = new UserStatus(["send_email" => false]);
            $user_status->save($user_status->user_to_json($new_user), $old_user);
        }
    }
    // update trueuser
    if (strcasecmp($_SESSION["trueuser"]->email, $new_user->email)) {
        $_SESSION["trueuser"] = (object) ["email" => $new_user->email];
    }
    if ($MergeError == "") {
        $Conf->confirmMsg("Merged account " . htmlspecialchars($old_user->email) . ".");
        $new_user->log_activity("Merged account {$old_user->email}");
        go(hoturl("index"));
    } else {
        $new_user->log_activity("Merged account {$old_user->email} with errors");
        $MergeError .= $Conf->db_error_html(true);
    }
}
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:40,代码来源:mergeaccounts.php

示例5: xassert

    save_password($marina, ' $$2y$10$/URgqlFgQHpfE6mg4NzJhOZbg9Cc2cng58pA4cikzRD9F0qIuygnm', true);
    save_password($marina, '', false);
    xassert(user($marina)->check_password("isdevitch"));
    xassert_eqq(password($marina, true), ' $$2y$10$/URgqlFgQHpfE6mg4NzJhOZbg9Cc2cng58pA4cikzRD9F0qIuygnm');
}
// insert someone into the contactdb
$result = Dbl::qe(Contact::contactdb(), "insert into ContactInfo set firstName='Te', lastName='Thamrongrattanarit', email='te@_.com', affiliation='Brandeis University', collaborators='Computational Linguistics Magazine', password=' \$\$2y\$10\$/URgqlFgQHpfE6mg4NzJhOZbg9Cc2cng58pA4cikzRD9F0qIuygnm'");
assert(!!$result);
Dbl::free($result);
xassert(!user("te@_.com"));
$u = Contact::contactdb_find_by_email("te@_.com");
xassert(!!$u);
xassert_eqq($u->firstName, "Te");
// inserting them should succeed and borrow their data
$us = new UserStatus(array("send_email" => false));
$acct = $us->save((object) array("email" => "te@_.com"));
xassert(!!$acct);
$te = user("te@_.com");
xassert(!!$te);
xassert_eqq($te->firstName, "Te");
xassert_eqq($te->lastName, "Thamrongrattanarit");
xassert_eqq($te->affiliation, "Brandeis University");
if (function_exists("password_needs_rehash")) {
    xassert($te->check_password("isdevitch"));
}
xassert_eqq($te->collaborators, "Computational Linguistics Magazine");
// changing email should work too, but not change cdb except for defaults
$result = Dbl::qe(Contact::contactdb(), "insert into ContactInfo set firstName='', lastName='Thamrongrattanarit 2', email='te2@_.com', affiliation='Brandeis University or something', collaborators='Newsweek Magazine', password=' \$\$2y\$10\$/URgqlFgQHpfE6mg4NzJhOZbg9Cc2cng58pA4cikzRD9F0qIuygnm'");
xassert(!!$result);
Dbl::free($result);
$acct = $us->save((object) ["email" => "te2@_.com", "lastName" => "Thamrongrattanarit 1", "firstName" => "Te 1"], $te);
开发者ID:vaskevich,项目名称:nu-admissions-review,代码行数:31,代码来源:test04.php


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