本文整理汇总了PHP中message::success方法的典型用法代码示例。如果您正苦于以下问题:PHP message::success方法的具体用法?PHP message::success怎么用?PHP message::success使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类message
的用法示例。
在下文中一共展示了message::success方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handler
public function handler()
{
access::verify_csrf();
$form = $this->_get_form();
$errors = array_fill_keys(array_keys($form), "");
if ($_POST) {
$post = new Validation($_POST);
$post->add_rules("updates_enabled", array("valid", "numeric"));
$post->add_rules("popular_enabled", array("valid", "numeric"));
$post->add_rules("updates_limit", array("valid", "numeric"));
$post->add_rules("popular_limit", array("valid", "numeric"));
$post->add_rules("updates_description", "length[0,2048]");
$post->add_rules("popular_description", "length[0,2048]");
if ($post->validate()) {
foreach (array("updates", "popular") as $album) {
$album_defn = unserialize(module::get_var("dynamic", $album));
$album_defn->enabled = $post["{$album}_enabled"];
$album_defn->description = $post["{$album}_description"];
$album_defn->limit = $post["{$album}_limit"] === "" ? null : $post["{$album}_limit"];
module::set_var("dynamic", $album, serialize($album_defn));
}
message::success(t("Dynamic Albums Configured"));
url::redirect("admin/dynamic");
} else {
$form = arr::overwrite($form, $post->as_array());
$errors = arr::overwrite($errors, $post->errors());
}
}
print $this->_get_view($form, $errors);
}
示例2: saveprefs
public function saveprefs()
{
// Prevent Cross Site Request Forgery
access::verify_csrf();
// Figure out which boxes where checked
$dlLinks_array = Input::instance()->post("DownloadLinkOptions");
$fButton = false;
$download_original_button = false;
for ($i = 0; $i < count($dlLinks_array); $i++) {
if ($dlLinks_array[$i] == "fButton") {
$fButton = true;
}
}
if (module::is_active("keeporiginal")) {
$keeporiginal_array = Input::instance()->post("DownloadOriginalOptions");
for ($i = 0; $i < count($keeporiginal_array); $i++) {
if ($keeporiginal_array[$i] == "DownloadOriginalImage") {
$download_original_button = true;
}
}
module::set_var("downloadfullsize", "DownloadOriginalImage", $download_original_button);
}
// Save Settings.
module::set_var("downloadfullsize", "fButton", $fButton);
message::success(t("Your Selection Has Been Saved."));
// Load Admin page.
$view = new Admin_View("admin.html");
$view->content = new View("admin_downloadfullsize.html");
$view->content->downloadlinks_form = $this->_get_admin_form();
print $view;
}
示例3: index
public function index()
{
$form = $this->_get_form();
if (request::method() == "post") {
access::verify_csrf();
if ($form->validate()) {
module::set_var("strip_exif", "exiv_path", $_POST['exiv_path']);
if ($_POST['exif_tags'] != "") {
module::set_var("strip_exif", "exif_remove", isset($_POST['exif_remove']) ? $_POST['exif_remove'] : false);
module::set_var("strip_exif", "exif_tags", $_POST['exif_tags']);
} else {
module::set_var("strip_exif", "exif_remove", false);
module::set_var("strip_exif", "exif_tags", self::$defExifTags);
}
if ($_POST['iptc_tags'] != "") {
module::set_var("strip_exif", "iptc_remove", isset($_POST['iptc_remove']) ? $_POST['iptc_remove'] : false);
module::set_var("strip_exif", "iptc_tags", $_POST['iptc_tags']);
} else {
module::set_var("strip_exif", "iptc_remove", false);
module::set_var("strip_exif", "iptc_tags", self::$defIptcTags);
}
if (isset($_POST['verbose'])) {
module::set_var("strip_exif", "verbose", $_POST['verbose']);
}
message::success(t("Settings have been saved"));
url::redirect("admin/strip_exif");
} else {
message::error(t("There was a problem with the submitted form. Please check your values and try again."));
}
}
print $this->_get_view();
}
示例4: save
public function save($module_name, $var_name)
{
access::verify_csrf();
module::set_var($module_name, $var_name, Input::instance()->post("value"));
message::success(t("Saved value for %var (%module_name)", array("var" => $var_name, "module_name" => $module_name)));
json::reply(array("result" => "success"));
}
示例5: save
public function save()
{
access::verify_csrf();
$changes->activate = array();
$changes->deactivate = array();
$activated_names = array();
$deactivated_names = array();
foreach (module::available() as $module_name => $info) {
if ($info->locked) {
continue;
}
$desired = $this->input->post($module_name) == 1;
if ($info->active && !$desired && module::is_active($module_name)) {
$changes->deactivate[] = $module_name;
$deactivated_names[] = $info->name;
module::deactivate($module_name);
} else {
if (!$info->active && $desired && !module::is_active($module_name)) {
$changes->activate[] = $module_name;
$activated_names[] = $info->name;
module::install($module_name);
module::activate($module_name);
}
}
}
module::event("module_change", $changes);
// @todo this type of collation is questionable from a i18n perspective
if ($activated_names) {
message::success(t("Activated: %names", array("names" => join(", ", $activated_names))));
}
if ($deactivated_names) {
message::success(t("Deactivated: %names", array("names" => join(", ", $deactivated_names))));
}
url::redirect("admin/modules");
}
示例6: _update
/**
* @see REST_Controller::_update($resource)
*/
public function _update($photo)
{
access::verify_csrf();
access::required("view", $photo);
access::required("edit", $photo);
$form = photo::get_edit_form($photo);
if ($valid = $form->validate()) {
if ($form->edit_photo->filename->value != $photo->name) {
// Make sure that there's not a conflict
if (Database::instance()->from("items")->where("parent_id", $photo->parent_id)->where("id <>", $photo->id)->where("name", $form->edit_photo->filename->value)->count_records()) {
$form->edit_photo->filename->add_error("conflict", 1);
$valid = false;
}
}
}
if ($valid) {
$photo->title = $form->edit_photo->title->value;
$photo->description = $form->edit_photo->description->value;
$photo->rename($form->edit_photo->filename->value);
$photo->save();
module::event("photo_edit_form_completed", $photo, $form);
log::success("content", "Updated photo", "<a href=\"photos/{$photo->id}\">view</a>");
message::success(t("Saved photo %photo_title", array("photo_title" => p::clean($photo->title))));
print json_encode(array("result" => "success", "location" => url::site("photos/{$photo->id}")));
} else {
print json_encode(array("result" => "error", "form" => $form->__toString()));
}
}
示例7: deleteFile
public static function deleteFile($id)
{
$values = [];
for ($i = 1; $i <= 10; $i++) {
$values[] = '`media' . $i . '` = ' . $id;
}
for ($i = 1; $i <= 10; $i++) {
$values[] = '`medialist' . $i . '` LIKE "%|' . $id . '|%"';
}
$sql = sql::factory();
$sql->query('SELECT id FROM ' . sql::table('structure_area') . ' WHERE ' . implode(' OR ', $values))->result();
if ($sql->num()) {
echo message::warning(lang::get('file_in_use'));
} else {
$sql = sql::factory();
$sql->setTable('media');
$sql->setWhere('id=' . $id);
$sql->select('filename');
$sql->result();
if (unlink(dir::media($sql->get('filename')))) {
$sql->delete();
return message::success(lang::get('file_deleted'), true);
} else {
return message::warning(sprintf(lang::get('file_not_deleted'), dyn::get('hp_url'), $sql->get('filename')), true);
}
}
}
示例8: _update
public function _update($user)
{
if ($user->guest || $user->id != user::active()->id) {
access::forbidden();
}
$form = user::get_edit_form($user);
$valid = $form->validate();
if ($valid) {
$user->full_name = $form->edit_user->full_name->value;
if ($form->edit_user->password->value) {
$user->password = $form->edit_user->password->value;
}
$user->email = $form->edit_user->email->value;
$user->url = $form->edit_user->url->value;
if ($form->edit_user->locale) {
$desired_locale = $form->edit_user->locale->value;
$new_locale = $desired_locale == "none" ? null : $desired_locale;
if ($new_locale != $user->locale) {
// Delete the session based locale preference
setcookie("g_locale", "", time() - 24 * 3600, "/");
}
$user->locale = $new_locale;
}
$user->save();
module::event("user_edit_form_completed", $user, $form);
message::success(t("User information updated."));
print json_encode(array("result" => "success", "resource" => url::site("users/{$user->id}")));
} else {
print json_encode(array("result" => "error", "form" => $form->__toString()));
}
}
示例9: saveprefs
public function saveprefs()
{
// Prevent Cross Site Request Forgery
access::verify_csrf();
// Figure out the values of the text boxes
$str_phpmailer_path = Input::instance()->post("phpmailer_path");
$str_phpmailer_from_addr = Input::instance()->post("phpmailer_from_address");
$str_phpmailer_from_name = Input::instance()->post("phpmailer_from_name");
$str_smtp_server = Input::instance()->post("phpmailer_smtp_server");
$str_use_ssl = Input::instance()->post("phpmailer_use_ssl");
$str_smtp_login = Input::instance()->post("phpmailer_smtp_login");
$str_smtp_pass = Input::instance()->post("phpmailer_smtp_password");
$str_smtp_port = Input::instance()->post("phpmailer_smtp_port");
if (count($str_use_ssl) > 0) {
$str_use_ssl = true;
} else {
$str_use_ssl = false;
}
// Save Settings.
module::set_var("phpmailer", "phpmailer_path", $str_phpmailer_path);
module::set_var("phpmailer", "phpmailer_from_address", $str_phpmailer_from_addr);
module::set_var("phpmailer", "phpmailer_from_name", $str_phpmailer_from_name);
module::set_var("phpmailer", "smtp_server", $str_smtp_server);
module::set_var("phpmailer", "use_ssl", $str_use_ssl);
module::set_var("phpmailer", "smtp_login", $str_smtp_login);
module::set_var("phpmailer", "smtp_password", $str_smtp_pass);
module::set_var("phpmailer", "smtp_port", $str_smtp_port);
message::success(t("Your Settings Have Been Saved."));
// Load Admin page.
$view = new Admin_View("admin.html");
$view->content = new View("admin_phpmailer.html");
$view->content->phpmailer_form = $this->_get_admin_form();
print $view;
}
示例10: saveprefs
public function saveprefs()
{
// Prevent Cross Site Request Forgery
access::verify_csrf();
// Save Settings.
module::set_var("ratings", "showunderphoto", Input::instance()->post("showunderphoto"));
module::set_var("ratings", "showinsidebar", Input::instance()->post("showinsidebar"));
module::set_var("ratings", "imageword", Input::instance()->post("imageword"));
module::set_var("ratings", "votestring", Input::instance()->post("votestring"));
module::set_var("ratings", "castyourvotestring", Input::instance()->post("castyourvotestring"));
# module::set_var("ratings", "bgcolor", Input::instance()->post("bgcolor"));
module::set_var("ratings", "fillcolor", Input::instance()->post("fillcolor"));
module::set_var("ratings", "votedcolor", Input::instance()->post("votedcolor"));
module::set_var("ratings", "hovercolor", Input::instance()->post("hovercolor"));
module::set_var("ratings", "textcolor", Input::instance()->post("textcolor"));
module::set_var("ratings", "regonly", Input::instance()->post("regonly"));
$iconset = Input::instance()->post("iconset");
$iconset = preg_replace("/\\/index\\.php/", "", $iconset);
module::set_var("ratings", "iconset", $iconset);
message::success(t("Your Settings Have Been Saved."));
site_status::clear("ratings_configuration");
// Load Admin page.
$view = new Admin_View("admin.html");
$view->content = new View("admin_ratings.html");
$view->content->ratings_form = $this->_get_admin_form();
print $view;
}
示例11: saveprefs
public function saveprefs()
{
// Prevent Cross Site Request Forgery
access::verify_csrf();
// Figure out which boxes where checked
$linkOptions_array = Input::instance()->post("ContactOwnerLinkTypes");
$ownerLink = false;
$userLink = false;
for ($i = 0; $i < count($linkOptions_array); $i++) {
if ($linkOptions_array[$i] == "ContactOwner") {
$ownerLink = true;
}
if ($linkOptions_array[$i] == "ContactUser") {
$userLink = true;
}
}
// Figure out the values of the text boxes
$str_contactbutton = Input::instance()->post("owner_button_text");
$str_contactemail = Input::instance()->post("owner_email");
$str_contactname = Input::instance()->post("owner_name");
$str_messageheader = Input::instance()->post("message_header");
// Save Settings.
module::set_var("contactowner", "contact_owner_link", $ownerLink);
module::set_var("contactowner", "contact_user_link", $userLink);
module::set_var("contactowner", "contact_button_text", $str_contactbutton);
module::set_var("contactowner", "contact_owner_email", $str_contactemail);
module::set_var("contactowner", "contact_owner_name", $str_contactname);
module::set_var("contactowner", "contact_owner_header", $str_messageheader);
message::success(t("Your Settings Have Been Saved."));
// Load Admin page.
$view = new Admin_View("admin.html");
$view->content = new View("admin_contactowner.html");
$view->content->contactowner_form = $this->_get_admin_form();
print $view;
}
示例12: auth
public function auth()
{
if (!identity::active_user()->admin) {
access::forbidden();
}
access::verify_csrf();
$form = self::_form();
$valid = $form->validate();
$user = identity::active_user();
if ($valid) {
module::event("user_auth", $user);
if (!request::is_ajax()) {
message::success(t("Successfully re-authenticated!"));
}
url::redirect(Session::instance()->get_once("continue_url"));
} else {
$name = $user->name;
log::warning("user", t("Failed re-authentication for %name", array("name" => $name)));
module::event("user_auth_failed", $name);
if (request::is_ajax()) {
$v = new View("reauthenticate.html");
$v->form = $form;
$v->user_name = identity::active_user()->name;
json::reply(array("html" => (string) $v));
} else {
self::_show_form($form);
}
}
}
示例13: save
public function save()
{
access::verify_csrf();
$form = $this->_get_edit_form_admin();
if ($form->validate()) {
module::set_var("gallery", "page_size", $form->edit_theme->page_size->value);
$thumb_size = $form->edit_theme->thumb_size->value;
if (module::get_var("gallery", "thumb_size") != $thumb_size) {
graphics::remove_rule("gallery", "thumb", "gallery_graphics::resize");
graphics::add_rule("gallery", "thumb", "gallery_graphics::resize", array("width" => $thumb_size, "height" => $thumb_size, "master" => Image::AUTO), 100);
module::set_var("gallery", "thumb_size", $thumb_size);
}
$resize_size = $form->edit_theme->resize_size->value;
if (module::get_var("gallery", "resize_size") != $resize_size) {
graphics::remove_rule("gallery", "resize", "gallery_graphics::resize");
graphics::add_rule("gallery", "resize", "gallery_graphics::resize", array("width" => $resize_size, "height" => $resize_size, "master" => Image::AUTO), 100);
module::set_var("gallery", "resize_size", $resize_size);
}
module::set_var("gallery", "show_credits", $form->edit_theme->show_credits->value);
// Sanitize values that get placed directly in HTML output by theme.
module::set_var("gallery", "header_text", html::purify($form->edit_theme->header_text->value));
module::set_var("gallery", "footer_text", html::purify($form->edit_theme->footer_text->value));
module::set_var("gallery", "favicon_url", html::purify($form->edit_theme->favicon_url->value));
module::set_var("gallery", "apple_touch_icon_url", html::purify($form->edit_theme->apple_touch_icon_url->value));
module::event("theme_edit_form_completed", $form);
message::success(t("Updated theme details"));
url::redirect("admin/theme_options");
} else {
$view = new Admin_View("admin.html");
$view->content = new View("admin_theme_options.html");
$view->content->form = $form;
print $view;
}
}
示例14: change
public function change()
{
access::verify_csrf();
$active_provider = module::get_var("gallery", "identity_provider", "user");
$providers = identity::providers();
$new_provider = Input::instance()->post("provider");
if ($new_provider != $active_provider) {
module::deactivate($active_provider);
// Switch authentication
identity::reset();
module::set_var("gallery", "identity_provider", $new_provider);
module::install($new_provider);
module::activate($new_provider);
module::event("identity_provider_changed", $active_provider, $new_provider);
module::uninstall($active_provider);
message::success(t("Changed to %description", array("description" => $providers->{$new_provider})));
try {
Session::instance()->destroy();
} catch (Exception $e) {
// We don't care if there was a problem destroying the session.
}
url::redirect(item::root()->abs_url());
}
message::info(t("The selected provider \"%description\" is already active.", array("description" => $providers->{$new_provider})));
url::redirect("admin/identity");
}
示例15: save
function save($album_id)
{
access::verify_csrf();
$album = ORM::factory("item", $album_id);
access::required("edit", $album);
if (Input::instance()->post("save")) {
$titles = Input::instance()->post("title");
$descriptions = Input::instance()->post("description");
$filenames = Input::instance()->post("filename");
$internetaddresses = Input::instance()->post("internetaddress");
$tags = Input::instance()->post("tags");
$enable_tags = module::is_active("tag");
foreach (array_keys($titles) as $id) {
$item = ORM::factory("item", $id);
if ($item->loaded() && access::can("edit", $item)) {
$item->title = $titles[$id];
$item->description = $descriptions[$id];
$item->name = $filenames[$id];
$item->slug = $internetaddresses[$id];
$item->save();
if ($enable_tags) {
tag::clear_all($item);
foreach (explode(",", $tags[$id]) as $tag_name) {
if ($tag_name) {
tag::add($item, trim($tag_name));
}
}
tag::compact();
}
}
}
message::success(t("Captions saved"));
}
url::redirect($album->abs_url());
}