本文整理汇总了PHP中PasswordHash::create方法的典型用法代码示例。如果您正苦于以下问题:PHP PasswordHash::create方法的具体用法?PHP PasswordHash::create怎么用?PHP PasswordHash::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PasswordHash
的用法示例。
在下文中一共展示了PasswordHash::create方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build_backend_subactions
//.........这里部分代码省略.........
if ($properties[1]) {
$ste->vars["textprocessors"][] = $txtproc;
}
}
$ste->vars["sections"] = array();
foreach (Section::all() as $section) {
$ste->vars["sections"][] = $section->name;
}
$ste->vars["article_section"] = $default_section->name;
/* Check Form */
$fail_reasons = array();
if (isset($_POST["save_article"])) {
if (!Article::test_urlname($_POST["urlname"])) {
$fail_reasons[] = $translation["invalid_urlname"];
} else {
$inputs["urlname"] = $_POST["urlname"];
}
if (!Article::test_status(@$_POST["article_status"])) {
$fail_reasons[] = $translation["invalid_article_status"];
} else {
$inputs["article_status"] = (int) $_POST["article_status"];
}
if (!isset($textprocessors[@$_POST["content_txtproc"]])) {
$fail_reasons[] = $translation["unknown_txtproc"];
} else {
$inputs["content_txtproc"] = $_POST["content_txtproc"];
}
if (!isset($textprocessors[@$_POST["excerpt_txtproc"]])) {
$fail_reasons[] = $translation["unknown_txtproc"];
} else {
$inputs["excerpt_txtproc"] = $_POST["excerpt_txtproc"];
}
if (!empty($_POST["date"])) {
if (($time_tmp = @DateTime::createFromFormat("Y-m-d H:i:s", @$_POST["date"])) === False) {
$fail_reasons[] = $translation["invalid_date"];
} else {
$inputs["date"] = @$time_tmp->getTimestamp();
}
} else {
$inputs["date"] = time();
}
$inputs["allow_comments"] = !(empty($_POST["allow_comments"]) or $_POST["allow_comments"] != "yes");
try {
$inputs["article_section"] = Section::by_name($_POST["section"]);
} catch (DoesNotExistError $e) {
$fail_reasons[] = $translation["unknown_section"];
}
$inputs["title"] = $_POST["title"];
$inputs["content"] = $_POST["content"];
$inputs["excerpt"] = $_POST["excerpt"];
$inputs["tags"] = array_filter(array_map("trim", explode(",", $_POST["tags"])), function ($t) {
return !empty($t);
});
if (isset($_POST["saveaslang"])) {
$editlang = $_POST["saveaslang"];
}
} else {
/* Call articleeditor plugins */
$article = empty($article) ? NULL : Article::by_urlname($article);
foreach ($articleeditor_plugins as $plugin) {
call_user_func($plugin["fx"], $article, False);
}
}
function fill_article(&$article, $inputs, $editlang)
{
$article->urlname = $inputs["urlname"];
示例2: Translation
\tborder-collapse: collapse;
}
STYLE;
$style->save();
$section = Section::create("home");
$section->title["en"] = new Translation("Home", "");
if ($lang != "en") {
$section->title[$lang] = new Translation("Home", "");
}
$section->template = "standard.html";
$section->add_style($style);
$section->save();
$ratatoeskr_settings["default_section"] = $section->get_id();
$ratatoeskr_settings->save();
$admingrp = Group::create("admins");
$admin = user::create($_POST["admin_username"], PasswordHash::create($_POST["admin_init_password"]));
$admin->save();
$admingrp->include_user($admin);
$article = Article::create("congratulations");
$article->title["en"] = new Translation("Congratulations! You have just installed Ratatöskr!", "");
$article->text["en"] = new Translation("Congratulations! You have just installed Ratatöskr!", "Markdown");
$article->excerpt["en"] = new Translation("Congratulations! You have just installed Ratatöskr!", "Markdown");
$article->status = ARTICLE_STATUS_LIVE;
$article->timestamp = time();
$article->allow_comments = True;
$article->set_section($section);
$article->save();
try {
Repository::create("http://r7r-repo-community.silvasur.net/");
Repository::create("http://r7r-repo-official.silvasur.net/");
} catch (RepositoryUnreachableOrInvalid $e) {
示例3: array
$url_next = array();
/* Test file permissions */
$permissions_missing = array_filter(array("/packages", "/packagelist", "/repometa", "/r7r_repo/templates/transc"), function ($f) {
return !@is_writable(dirname(__FILE__) . "/..{$f}");
});
if (!empty($permissions_missing)) {
$ste->vars["error"] = "No writing permissions on these files/directories: \"" . implode("\", \"", $permissions_missing) . "\"";
} else {
/* Check input */
if (!empty($_POST["send_data"])) {
if (empty($_POST["admin_name"]) or empty($_POST["admin_password"]) or empty($_POST["repo_name"]) or empty($_POST["repo_description"]) or empty($_POST["repo_baseurl"]) or $_POST["repo_mode"] != "public" and $_POST["repo_mode"] != "private") {
$ste->vars["error"] = "Form not filled out completely";
} else {
/* Insert data */
$admin = User::create($_POST["admin_name"]);
$admin->pwhash = PasswordHash::create($_POST["admin_password"]);
$admin->isadmin = True;
$admin->save();
$settings["repo_name"] = $_POST["repo_name"];
$settings["repo_description"] = $_POST["repo_description"];
$settings["repo_baseurl"] = $_POST["repo_baseurl"];
$settings["repo_mode"] = $_POST["repo_mode"];
update_repometa();
$settings["setup_finished"] = True;
$url_next = array("_prelude", "index");
return;
}
}
}
$ste->vars["baseurl_predicted"] = self_url();
echo $ste->exectemplate("setup.html");