本文整理汇总了PHP中message::error方法的典型用法代码示例。如果您正苦于以下问题:PHP message::error方法的具体用法?PHP message::error怎么用?PHP message::error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类message
的用法示例。
在下文中一共展示了message::error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: graphics_rotate
static function graphics_rotate($input_file, $output_file, $options)
{
// Make a copy of the original fullsized image before rotating it.
// If $input_file is located in VARPATH/albums/ then assume its a fullsize photo.
if (strncmp($input_file, VARPATH . "albums/", strlen(VARPATH . "albums/")) == 0) {
// Figure out where the original copy should be stashed at.
$temp_path = str_replace(VARPATH . "albums/", "", $input_file);
$original_image = VARPATH . "original/" . $temp_path;
$individual_dirs = split("[/\\]", "original/" . $temp_path);
// If any original file does not already exist, then create a folder structure
// similar to that found in VARPATH/albums/ and copy the photo over before
// rotating it.
if (!file_exists($original_image)) {
$new_img_path = VARPATH;
for ($i = 0; $i < count($individual_dirs) - 1; $i++) {
$new_img_path = $new_img_path . "/" . $individual_dirs[$i];
if (!file_exists($new_img_path)) {
@mkdir($new_img_path);
}
}
if (!@copy($input_file, $original_image)) {
// If the copy failed, display an error message.
message::error(t("Your original image was not backed up!"));
}
}
}
}
示例2: 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();
}
示例3: action_index
public function action_index()
{
$type = $this->request->param('type');
$search = Security::xss_clean(Arr::get($_POST, 'search', ''));
if ($post = $this->request->post()) {
$title = Security::xss_clean(Arr::get($post, 'title1', ''));
if ($title != '') {
$titles = ORM::factory('Specprojecttitle', $type);
$titles->title = $title;
$titles->save();
message::success('Успешно изменено');
$this->redirect('manage/specprojects/' . $type);
} else {
message::error('Поле не может быть пустым.');
$this->redirect('manage/specprojects/' . $type);
}
}
if (!empty($search)) {
$this->redirect('manage/specprojects/' . $type . '/search/' . $search);
}
$public = ORM::factory('Publication')->join('spec_projects', 'LEFT')->on('publication.id', '=', 'spec_projects.id_publication')->select('publication.*', 'spec_projects.spec_published', 'spec_projects.in_slider', 'spec_projects.in_middle', 'spec_projects.in_bottom')->where('spec_projects.sproject', '=', $type)->order_by('order', 'desc')->order_by('date', 'DESC');
$paginate = Paginate::factory($public)->paginate(NULL, NULL, 10)->render();
$public = $public->find_all();
$title = ORM::factory('Specprojecttitle', $type)->title;
$this->set('title', $title);
$this->set('list', $public)->set('type', $type);
$this->set('paginate', $paginate);
}
示例4: index
public function index()
{
// require_once(MODPATH . "aws_s3/lib/s3.php");
$form = $this->_get_s3_form();
if (request::method() == "post") {
access::verify_csrf();
if ($form->validate()) {
module::set_var("aws_s3", "enabled", isset($_POST['enabled']) ? true : false);
module::set_var("aws_s3", "access_key", $_POST['access_key']);
module::set_var("aws_s3", "secret_key", $_POST['secret_key']);
module::set_var("aws_s3", "bucket_name", $_POST['bucket_name']);
module::set_var("aws_s3", "g3id", $_POST['g3id']);
module::set_var("aws_s3", "url_str", $_POST['url_str']);
module::set_var("aws_s3", "sig_exp", $_POST['sig_exp']);
module::set_var("aws_s3", "use_ssl", isset($_POST['use_ssl']) ? true : false);
if (module::get_var("aws_s3", "enabled") && !module::get_var("aws_s3", "synced", false)) {
site_status::warning(t('Your site has not yet been syncronised with your Amazon S3 bucket. Content will not appear correctly until you perform syncronisation. <a href="%url" class="g-dialog-link">Fix this now</a>', array("url" => html::mark_clean(url::site("admin/maintenance/start/aws_s3_task::sync?csrf=__CSRF__")))), "aws_s3_not_synced");
}
message::success(t("Settings have been saved"));
url::redirect("admin/aws_s3");
} else {
message::error(t("There was a problem with the submitted form. Please check your values and try again."));
}
}
$v = new Admin_View("admin.html");
$v->page_title = t("Amazon S3 Configuration");
$v->content = new View("admin_aws_s3.html");
$v->content->form = $form;
$v->content->end = "";
echo $v;
}
示例5: change_status
private function change_status($blog_post_id)
{
$post = ORM::factory('blog_post', (int) $blog_post_id);
if (!$post->loaded) {
message::error(__('Invalid ID'), 'admin/blog');
}
$post->comment_status = $status;
$post->save();
message::info(__('Comment status changed to "%status"', array('status' => $status)), 'admin/blog');
}
示例6: handler
public function handler()
{
access::verify_csrf();
$form = $this->_get_form();
if ($form->validate()) {
$scrollsize = intval($form->navcarousel->scrollsize->value);
$showelements = intval($form->navcarousel->showelements->value);
$carouselwidth = intval($form->navcarousel->carouselwidth->value);
$thumbsize = intval($form->thumbsettings->thumbsize->value);
if ($showelements < 1) {
$showelements = 1;
message::error(t("You must show at least one item."));
}
if ($scrollsize < 1) {
$scrollsize = 1;
message::error(t("You must scroll by at least one item."));
}
if ($thumbsize > 150 || $thumbsize < 25) {
$thumbsize = 50;
message::error(t("The size of the thumbnails must be between 25 and 150 pixel."));
}
if ($carouselwidth < $thumbsize + 75 && $carouselwidth > 0) {
$carouselwidth = $thumbsize + 75;
message::error(t("The carousel must be at least %pixel wide.", array("pixel" => $carouselwidth)));
}
if ($carouselwidth > 0) {
if ($carouselwidth < ($thumbsize + 11) * $showelements + 64) {
$showelements = ($carouselwidth - 64) / ($thumbsize + 11);
$showelements = intval(floor($showelements));
message::error(t("With the selected carousel width and thumbnail size you can show a maximum of %itemno items.", array("itemno" => $showelements)));
}
} else {
message::warning(t("The maximum number of displayable items cannot be calculated when the carousel width is set to 0."));
}
if ($scrollsize > $showelements) {
$scrollsize = $showelements;
message::error(t("The number of items to scroll must not exceed the number of items to show."));
}
module::set_var("navcarousel", "scrollsize", $scrollsize);
module::set_var("navcarousel", "showelements", $showelements);
module::set_var("navcarousel", "carouselwidth", $carouselwidth);
module::set_var("navcarousel", "thumbsize", $thumbsize);
module::set_var("navcarousel", "abovephoto", $form->navcarousel->abovephoto->value, true);
module::set_var("navcarousel", "noajax", $form->navcarousel->noajax->value, true);
module::set_var("navcarousel", "showondomready", $form->navcarousel->showondomready->value, true);
module::set_var("navcarousel", "maintainaspect", $form->thumbsettings->maintainaspect->value, true);
module::set_var("navcarousel", "nomouseover", $form->thumbsettings->nomouseover->value, true);
module::set_var("navcarousel", "noresize", $form->thumbsettings->noresize->value, true);
message::success(t("Your settings have been saved."));
url::redirect("admin/navcarousel");
}
print $this->_get_view($form);
}
示例7: delete
public function delete($id)
{
$user = ORM::factory('user', (int) $id);
if (!$user->loaded) {
message::error(__('Invalid ID'), 'admin/user');
}
if ($user->id === Auth::instance()->get_user()->id) {
message::error(__('You can\'t delete yourself'), 'admin/user');
}
$user->remove(ORM::factory('role', 'login'));
$user->remove(ORM::factory('role', 'admin'));
$user->delete();
message::info(__('User deleted successfully'), 'admin/user');
}
示例8: index
public function index()
{
$form = $this->_get_form();
if (request::method() == "post") {
access::verify_csrf();
if ($form->validate()) {
module::set_var("auto_date", "template", $_POST['template']);
message::success(t("Settings have been saved"));
url::redirect("admin/auto_date");
} else {
message::error(t("There was a problem with the submitted form. Please check your values and try again."));
}
}
print $this->_get_view();
}
示例9: saveprefs
public function saveprefs()
{
// Prevent Cross Site Request Forgery
access::verify_csrf();
$post = new Validation($_POST);
$post->add_callbacks("IccPath", array($this, "_validate_icc_path"));
$icc_path = Input::instance()->post("IccPath");
if ($post->validate()) {
module::set_var("rawphoto", "icc_path", $icc_path);
message::success(t("Your preferences have been saved."));
} else {
message::error(t("Your preferences are not valid."));
}
print $this->_get_view($post->errors(), $icc_path);
}
示例10: shorten
/**
* Shorten a G3 item's link and display the result in a status message.
* @param int $item_id
*/
public function shorten($item_id)
{
// Prevent Cross Site Request Forgery
access::verify_csrf();
$item = ORM::factory("item", $item_id);
// Ensure user has permission
access::required("view", $item);
access::required("edit", $item);
// Shorten the item's URL
$short_url = bitly::shorten_url($item_id);
if ($short_url) {
message::success("Item URL shortened to {$short_url}");
} else {
message::error("Unable to shorten " . url::abs_site($item->relative_url_cache));
}
// Redirect back to the item
url::redirect(url::abs_site($item->relative_url_cache));
}
示例11: restore
public function restore($id)
{
// Allow the user to restore the original photo.
// Make sure the current user has suficient access to view and edit the item.
$item = ORM::factory("item", $id);
access::required("view", $item);
access::required("edit", $item);
// Figure out where the original was stashed at.
$original_image = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $item->file_path());
// Make sure the current item is a photo and that an original exists.
if ($item->is_photo() && file_exists($original_image)) {
// Delete the modified version of the photo.
@unlink($item->file_path());
// Copy the original image back over, display an error message if the copy fails.
if (@rename($original_image, $item->file_path())) {
// Re-generate the items resize and thumbnail.
$item_data = model_cache::get("item", $id);
$item_data->resize_dirty = 1;
$item_data->thumb_dirty = 1;
$item_data->save();
graphics::generate($item_data);
// If the item is the thumbnail for the parent album,
// fix the parent's thumbnail as well.
$parent = $item_data->parent();
if ($parent->album_cover_item_id == $item_data->id) {
copy($item_data->thumb_path(), $parent->thumb_path());
$parent->thumb_width = $item_data->thumb_width;
$parent->thumb_height = $item_data->thumb_height;
$parent->save();
}
// Display a success message and redirect to the items page.
message::success(t("Your original image has been restored."));
url::redirect($item->url());
} else {
// Display an error message if the copy failed.
message::error(t("Image restore failed!"));
url::redirect($item->url());
}
} else {
// Display an error message if there is not an original photo.
message::error(t("Image restore failed!"));
url::redirect($item->url());
}
}
示例12: validate_config
/**
* Check a login and an API Key against bit.ly to make sure they're valid
* @param string $login bit.ly login
* @param string $api_key bit.ly API key
* @return boolean
*/
static function validate_config($login, $api_key)
{
if (!empty($login) && !empty($api_key)) {
$parameters = array('login' => $login, 'apiKey' => $api_key, 'x_login' => $login, 'x_apiKey' => $api_key);
$request = self::_build_http_request('validate', $parameters);
$response = self::_http_post($request, "api.bit.ly");
$json_decoded = json_decode($response->body[0]);
if (!$json_decoded->data->valid) {
if ("INVALID_LOGIN" == $json_decoded->status_txt) {
message::error(t("Your bit.ly login is incorrect"));
} else {
if ("INVALID_APIKEY" == $json_decoded->status_txt) {
message::error(t("Your bit.ly API Key is incorrect."));
}
}
return false;
} else {
return true;
}
}
}
示例13: index
public function index()
{
if (g1_import::is_configured()) {
g1_import::init();
}
$view = new Admin_View('admin.html');
$view->page_title = t('Gallery 1 import');
$view->content = new View('admin_g1_import.html');
if (is_dir(g1_import::$album_dir)) {
$view->content->g1_stats = $g1_stats = g1_import::g1_stats();
$view->content->g3_stats = $g3_stats = g1_import::g3_stats();
$view->content->g1_sizes = g1_import::common_sizes();
$view->content->g1_version = g1_import::version();
// Don't count tags because we don't track them in g1_map
$view->content->g1_resource_count = $g1_stats['users'] + $g1_stats['groups'] + $g1_stats['albums'] + $g1_stats['photos'] + $g1_stats['movies'] + $g1_stats['comments'];
$view->content->g3_resource_count = $g3_stats['user'] + $g3_stats['group'] + $g3_stats['album'] + $g3_stats['item'] + $g3_stats['comment'] + $g3_stats['tag'];
}
$view->content->form = $this->_get_import_form();
$view->content->version = '';
$view->content->thumb_size = module::get_var('gallery', 'thumb_size');
$view->content->resize_size = module::get_var('gallery', 'resize_size');
if (g1_import::is_initialized()) {
if (count(g1_import::$warn_utf8) > 0) {
message::error(t('Your G1 contains %count folder(s) containing nonstandard characters that G3 doesn\'t work with: <pre>%names</pre>Please rename the above folders in G1 before trying to import your data.', array('count' => count(g1_import::$warn_utf8), 'names' => "\n\n " . implode("\n ", g1_import::$warn_utf8) . "\n\n")));
}
if ((bool) ini_get('eaccelerator.enable') || (bool) ini_get('xcache.cacher')) {
message::warning(t('The eAccelerator and XCache PHP performance extensions are known to cause issues. If you\'re using either of those and are having problems, please disable them while you do your import. Add the following lines: <pre>%lines</pre> to gallery3/.htaccess and remove them when the import is done.', array('lines' => "\n\n php_value eaccelerator.enable 0\n php_value xcache.cacher off\n php_value xcache.optimizer off\n\n")));
}
foreach (array('notification', 'search', 'exif') as $module_id) {
if (module::is_active($module_id)) {
message::warning(t('<a href="%url">Deactivating</a> the <b>%module_id</b> module during your import will make it faster', array('url' => url::site('admin/modules'), 'module_id' => $module_id)));
}
}
} else {
if (g1_import::is_configured()) {
$view->content->form->configure_g1_import->albums_path->add_error('invalid', 1);
}
}
print $view;
}
示例14: watch_event
static function watch_event($event, $args)
{
$msg = date('H:i:s', time() - 4 * 3600) . " {$event}: ";
$sep = "";
foreach ($args as $arg) {
if (is_object($arg)) {
$class = get_class($arg);
if (strcmp($class, 'User_Model') == 0 || strcmp($class, 'Group_Model') == 0 || strcmp($class, 'Item_Model') == 0 || strcmp($class, 'Module_Model') == 0 || strcmp($class, 'Tag_Model') == 0 || strcmp($class, 'Task_Model') == 0 || strcmp($class, 'Theme_Model') == 0 || strcmp($class, 'Var_Model') == 0) {
$msg = "{$msg} {$sep} {$class}(" . $arg->name . ")";
} elseif (strcmp($class, 'Comment_Model') == 0) {
$text = substr($arg->text, 0, 25);
$msg = "{$msg} {$sep} {$class}( {$text}... )";
} else {
$msg = $msg . $sep . get_class($arg);
}
} else {
$msg = $msg . $sep . $arg;
}
$sep = ", ";
}
message::error($msg);
}
示例15: converthandler
public function converthandler()
{
access::verify_csrf();
$form = $this->_get_converter_form();
if ($form->validate()) {
//Load the source tag
$sourcetag = ORM::factory("tag", $form->sourcetag->value);
if (!$sourcetag->loaded()) {
message::error(t("The specified tag could not be found"));
url::redirect("admin/photoannotation/converter");
}
//Load the target user
$targetuser = ORM::factory("user", $form->targetuser->value);
if (!$targetuser->loaded()) {
message::error(t("The specified person could not be found"));
url::redirect("admin/photoannotation/converter");
}
//Load all existing tag annotations
$tag_annotations = ORM::factory("items_face")->where("tag_id", "=", $sourcetag->id)->find_all();
//Disable user notifications so that users don't get flooded with mails
$old_notification_setting = module::get_var("photoannotation", "nonotifications", false);
module::set_var("photoannotation", "nonotifications", true, true);
foreach ($tag_annotations as $tag_annotation) {
photoannotation::saveuser($targetuser->id, $tag_annotation->item_id, $tag_annotation->x1, $tag_annotation->y1, $tag_annotation->x2, $tag_annotation->y2, $tag_annotation->description);
//Delete the old annotation
$tag_annotation->delete();
}
//Remove and delete old tag
if ($form->deletetag->value) {
$this->_remove_tag($sourcetag, true);
} elseif ($form->removetag->value) {
$this->_remove_tag($sourcetag, false);
}
module::set_var("photoannotation", "nonotifications", $old_notification_setting, true);
message::success(t("%count tag annotations (%tagname) have been converted to user annotations (%username)", array("count" => count($tag_annotations), "tagname" => $sourcetag->name, "username" => $targetuser->display_name())));
url::redirect("admin/photoannotation/converter");
}
print $this->_get_converter_view($form);
}