本文整理汇总了PHP中Alert::error方法的典型用法代码示例。如果您正苦于以下问题:PHP Alert::error方法的具体用法?PHP Alert::error怎么用?PHP Alert::error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Alert
的用法示例。
在下文中一共展示了Alert::error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateContent
function generateContent()
{
if (isset($_GET['ip'])) {
Framework::$autoLoader->importFolder(dirname($this->paths['utils']) . '/classes');
$geoip = new GeoIP();
$result = $geoip->getCountry(value($_GET['ip']));
if ($result) {
return Alert::success('<h4>Maxmind GeoIP</h4>IP: <b>' . $_GET['ip'] . '</b> is located in <b>' . $result['country'] . '</b> (' . $result['code'] . ')');
} else {
return Alert::error('<h4>Maxmind GeoIP</h4>IP: <b>' . $_GET['ip'] . '</b> is not found in the country database.');
}
} else {
return new Form(array('method' => 'get', 'fields' => array(new Input(array('name' => 'ip', 'placeholder' => 'IP address')), new Input(array('type' => 'submit', 'value' => 'Lookup', 'class' => 'btn btn-primary'))), 'class' => 'input-append'));
}
}
示例2: postChangePassword
public function postChangePassword(Request $request)
{
if (!\Auth::validate(['email' => \Auth::user()->email, 'password' => $request->input('old_password')])) {
\Alert::error(trans('auth.wrong_password'))->flash();
return redirect()->back();
}
// validation
$validator = \Validator::make($request->all(), ['old_password' => 'required', 'new_password' => 'required|confirmed|min:6']);
if ($validator->fails()) {
// The given data did not pass validation
return redirect()->back()->withInput()->withErrors($validator->errors());
}
// change the password
$user = User::findOrFail(\Auth::user()->id);
$user->password = $request->input('new_password');
$user->save();
// set a success/error message
\Alert::success(trans('auth.password_updated'))->flash();
// redirect to the change password page
return redirect()->back();
}
示例3: save
public function save($savePath = "", $mode = 0)
{
// Set the save mode
$this->saveMode = $mode;
// Attempt to validate the image
if (!$this->validateMime()) {
return false;
}
// Make sure the path is valid
if (!$this->validatePath($savePath)) {
return false;
}
// Make sure the filename is valid
if (!$this->handleFilename()) {
return false;
}
// Save the file to the designated location
if (!move_uploaded_file($this->tempPath, $this->saveDirectory . '/' . $this->filename . '.' . $this->extension)) {
Alert::error("Upload Error", "There was an error uploading this file. Please try again.", 4);
return false;
}
return true;
}
示例4: foreach
?>
</label>
<input type="text" name="answer" class="form-control">
<br>
<?php
CryptCaptcha::draw();
?>
</div>
<?php
}
?>
<br>
<?php
if (count($errors) > 0) {
foreach ($errors as $error) {
Alert::error($error);
}
}
?>
<div class="form-group">
<input type="submit" name="reset_password_submit" class="btn btn-primary" value="<?php
echo __('Send New Password', 'users');
?>
" />
</div>
</form>
</div>
</div>
</div>
示例5:
?>
</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<div class="container">
<?php
// Monstra Notifications
Notification::get('success') and Alert::success(Notification::get('success'));
Notification::get('warning') and Alert::warning(Notification::get('warning'));
Notification::get('error') and Alert::error(Notification::get('error'));
?>
<div id="update-monstra"></div>
<div><?php
Action::run('admin_pre_template');
?>
</div>
<div>
<?php
if ($plugin_admin_area) {
if (is_callable(ucfirst(Plugin::$plugins[$area]['id']) . 'Admin::main')) {
call_user_func(ucfirst(Plugin::$plugins[$area]['id']) . 'Admin::main');
} else {
echo '<div class="message-error">' . __('Plugin main admin function does not exist', 'system') . '</div>';
}
示例6: complete
/**
* Complete teh Academy creation process
* @param $id
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function complete($id)
{
$academy = Academy::find($id);
if ($academy && $academy->images) {
\Alert::success('Great !! Academy Created Successfully');
return redirect(route('academies.index'));
} else {
\Alert::error('Error !!', 'Please Add Images to Complete');
return redirect()->back();
}
}
示例7: header
exit;
} else {
Alert::error("Automatic Update", "Issue with Automatic Update: attempt to backup config.php failed. The engine does not have proper permissions to rename the file. You may need to perform a manual update instead.", 5);
}
}
// If you manually updated the configuration files
if (isset($_POST['manual-submit'])) {
Alert::saveSuccess("Config Updated", "You performed a manual update.");
header("Location: /install/setup-database");
exit;
}
} else {
if (API_Connect::$alert != "") {
Alert::error("API Issue", API_Connect::$alert);
} else {
Alert::error("API Connection", "Unable to connect to the Site Registration API. Please try again shortly.", 4);
}
}
}
}
// Run Global Script
require PARENT_APP_PATH . "/includes/install_global.php";
// Display the Header
require HEADER_PATH;
echo '
<form class="uniform" action="/install/config-app" method="post">' . Form::prepare("install-app-config");
if ($buildApp == "") {
// Display the Page
echo Alert::display() . '
<h1>Installation: Application Configuration</h1>
示例8: switch
<?php
// Make sure an appropriate environment is being used
switch (ENVIRONMENT) {
case "local":
case "development":
case "staging":
case "production":
break;
default:
Alert::error("Improper Environment", "You must set the ENVIRONMENT value properly.");
}
// If the server configuration are acceptable
if (Validate::pass()) {
// Check if the form was submitted (to continue to the next page)
if (Form::submitted("install-server-config")) {
header("Location: /install/config-site");
exit;
}
Alert::success("Server Config", "Your server is properly configured!");
}
// Installation Header
require dirname(ROUTE_SECOND_PATH) . "/includes/install_header.php";
// Run Global Script
require dirname(ROUTE_SECOND_PATH) . "/includes/install_global.php";
// Display the Header
require HEADER_PATH;
echo '
<form class="uniform" action="/install/config-server" method="post">' . Form::prepare("install-server-config");
echo '
<h3>Update Your Server Configurations:</h3>
示例9: dirname
<?php
// Make sure the user has named the site
if (!defined("SITE_HANDLE")) {
Alert::error("Invalid Site Name", "You must provide a valid Site Name.");
} else {
if (!defined("DATABASE_NAME")) {
Alert::error("Improper DB Name", "You must provide a valid Database Name.");
}
}
// Make sure that there is a valid application path
if (!defined("APP_PATH")) {
Alert::error("Improper App Path", "You must set a valid application or application path.");
} else {
if (!Dir::exists(APP_PATH)) {
Alert::error("Invalid App Path", "You must set a valid application or application path.");
}
}
// If the server configuration are acceptable
if (Validate::pass()) {
// Check if the form was submitted (to continue to the next page)
if (Form::submitted("install-site-config")) {
header("Location: /install/config-database");
exit;
}
Alert::success("Site Config", "Your site configurations are valid!");
}
// Installation Header
require dirname(ROUTE_SECOND_PATH) . "/includes/install_header.php";
// Run Global Script
require dirname(ROUTE_SECOND_PATH) . "/includes/install_global.php";
示例10: sendAttachment
public static function sendAttachment($emailTo, $subject, $message, $filePath, $filename, $emailFrom = "")
{
// Determine the Email being sent from
if (!$emailFrom) {
$emailFrom = "admin@" . BASE_DOMAIN . URL_SUFFIX;
}
// Handle Email Recipients
if (is_array($emailTo)) {
foreach ($emailTo as $next) {
if (!Email::isValid($next)) {
Alert::error("Email", "Illegal email used, cannot send email.", 3);
return false;
}
}
$emailTo = implode(", ", $emailTo);
} else {
if (!Email::isValid($emailTo)) {
Alert::error("Email", "Illegal email used, cannot send email.", 3);
return false;
}
}
// $filePath should include path and filename
$filename = basename($filename);
$file_size = filesize($filePath);
$content = chunk_split(base64_encode(file_get_contents($filePath)));
$uid = md5(uniqid(time()));
// Designed to prevent email injection, although we should run stricter validation if we're going to allow
// other people to insert emails into the email.
$emailFrom = str_replace(array("\r", "\n"), '', $emailFrom);
// Prepare header
$header = "From: " . $emailFrom . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed; boundary=\"" . $uid . "\"\r\n\r\n" . "This is a multi-part message in MIME format.\r\n" . "--" . $uid . "\r\n" . "Content-type:text/plain; charset=iso-8859-1\r\n" . "Content-Transfer-Encoding: 7bit\r\n\r\n" . $message . "\r\n\r\n" . "--" . $uid . "\r\n" . "Content-Type: application/octet-stream; name=\"" . $filename . "\"\r\n" . "Content-Transfer-Encoding: base64\r\n" . "Content-Disposition: attachment; filename=\"" . $filename . "\"\r\n\r\n" . $content . "\r\n\r\n" . "--" . $uid . "--";
// Record this email in the database
$primeRecipient = is_array($emailTo) ? $emailTo[0] : $emailTo;
$details = array("recipients" => $emailTo, "sender" => $emailFrom, "file" => $filename);
Database::query("INSERT INTO log_email (recipient, subject, message, details, date_sent) VALUES (?, ?, ?, ?, ?)", array($primeRecipient, $subject, $message, json_encode($details), time()));
// Localhost Versions, just edit email.html with the message
if (ENVIRONMENT == "local") {
return File::write(APP_PATH . "/email.html", "To: " . $emailTo . "\nFrom: " . $emailFrom . "\nSubject: " . $subject . "\nAttachment: " . $filename . "\n\n" . $message);
}
// Send the email
if (!mail($emailTo, $subject, "", $header)) {
Alert::error("Email", "Email was not sent properly.", 4);
return false;
}
return true;
}
示例11: function
<?php
/*
|--------------------------------------------------------------------------
| Application HTML Macros
|--------------------------------------------------------------------------
|
| Here is where you can register your HTML macros.
|
*/
// Show validation errors wrapped in bootstrap style
HTML::macro('validationErrors', function () {
$errors = Session::get('errors');
if ($errors) {
return Alert::error('<strong>The following errors occurred</strong>' . HTML::ul($errors->all(':message')));
}
});
// Show "Create" button for a resource
HTML::macro('resourceCreate', function ($resourceName, $buttonValue) {
if (Authority::can('create', $resourceName)) {
return Button::link(URL::route($resourceName . '.create'), $buttonValue);
}
});
// Show "Edit" button for a specific resource
HTML::macro('resourceUpdate', function ($resourceName, $resourceItem, $buttonValue) {
$resourceItemId = is_object($resourceItem) ? $resourceItem->id : $resourceItem;
if (Authority::can('update', $resourceName, $resourceItem)) {
return Button::link(URL::route($resourceName . '.edit', array($resourceName => $resourceItemId)), $buttonValue);
}
});
// Show "Delete" button for a specific resource
示例12: dirname
}
// Check if the standard user is properly configured after POST values were used
if (Database::initialize($dbName)) {
Alert::success("DB User", "The database user has access to the `" . $dbName . "` database!");
} else {
Alert::error("DB User", "The `" . $dbName . "` database does not exist, or the user does not have access to it.");
$userAccess = false;
}
// Check if the admin user is properly configured after POST values were used
if (Database::initRoot($dbName)) {
Alert::success("DB Admin", "The administrative database user has access to the `" . $dbName . "` database!");
} else {
if ($userAccess) {
Alert::error("DB Admin", "The `" . $dbName . "` database exists, but you do not have administrative privileges.");
} else {
Alert::error("DB Admin", "The `" . $dbName . "` database does not exist, or you do not have administrative privileges.");
}
}
// If everything is successful:
if (Validate::pass()) {
// Check if the form was submitted (to continue to the next page)
if (Form::submitted("install-db-connect")) {
header("Location: /install/classes-core");
exit;
}
}
// Run Global Script
require dirname(ROUTE_SECOND_PATH) . "/includes/install_global.php";
// Display the Header
require HEADER_PATH;
echo Alert::display();
示例13: main
/**
* Main function
*/
public static function main()
{
// Array of forbidden types
$forbidden_types = array('html', 'htm', 'js', 'jsb', 'mhtml', 'mht', 'php', 'phtml', 'php3', 'php4', 'php5', 'phps', 'shtml', 'jhtml', 'pl', 'py', 'cgi', 'sh', 'ksh', 'bsh', 'c', 'htaccess', 'htpasswd', 'exe', 'scr', 'dll', 'msi', 'vbs', 'bat', 'com', 'pif', 'cmd', 'vxd', 'cpl', 'empty');
// Array of image types
$image_types = array('jpg', 'png', 'bmp', 'gif', 'tif');
// Get Site url
$site_url = Option::get('siteurl');
// Init vars
if (Request::get('path')) {
$path = Request::get('path');
} else {
$path = 'uploads/';
}
// Add slash if not exists
if (substr($path, -1, 1) != '/') {
$path .= '/';
Request::redirect($site_url . '/admin/index.php?id=filesmanager&path=' . $path);
}
// Upload corectly!
if ($path == 'uploads' || $path == 'uploads//') {
$path = 'uploads/';
Request::redirect($site_url . '/admin/index.php?id=filesmanager&path=' . $path);
}
// Only 'uploads' folder!
if (strpos($path, 'uploads') === false) {
$path = 'uploads/';
Request::redirect($site_url . '/admin/index.php?id=filesmanager&path=' . $path);
}
// Set default path value if path is empty
if ($path == '') {
$path = 'uploads/';
Request::redirect($site_url . '/admin/index.php?id=filesmanager&path=' . $path);
}
$files_path = ROOT . DS . 'public' . DS . $path;
$current = explode('/', $path);
// Delete file
// -------------------------------------
if (Request::get('id') == 'filesmanager' && Request::get('delete_file')) {
if (Security::check(Request::get('token'))) {
File::delete($files_path . Request::get('delete_file'));
if (!is_file($files_path . Request::get('delete_file'))) {
Notification::set('success', __('File was deleted', 'filesmanager'));
} else {
Notification::set('error', __('File was not deleted', 'filesmanager'));
}
Request::redirect($site_url . '/admin/index.php?id=filesmanager&path=' . $path);
} else {
die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
}
}
// Delete dir
// -------------------------------------
if (Request::get('id') == 'filesmanager' && Request::get('delete_dir')) {
if (Security::check(Request::get('token'))) {
Dir::delete($files_path . Request::get('delete_dir'));
if (!is_dir($files_path . Request::get('delete_dir'))) {
Notification::set('success', __('Directory was deleted', 'filesmanager'));
} else {
Notification::set('error', __('Directory was not deleted', 'filesmanager'));
}
Request::redirect($site_url . '/admin/index.php?id=filesmanager&path=' . $path);
} else {
die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
}
}
// Rename file/dir
// -------------------------------------
if (Request::post('rename_type')) {
if (Security::check(Request::post('csrf'))) {
$rename_type = Request::post('rename_type');
$rename_from = Request::post('rename_from');
$rename_to = Request::post('rename_to');
if (empty($rename_to)) {
Notification::set('error', __('Can not be empty', 'filesmanager'));
Request::redirect($site_url . '/admin/index.php?id=filesmanager&path=' . $path);
}
$ext = $rename_type === 'file' ? '.' . File::ext($rename_from) : '';
$rename_to = $files_path . Security::safeName($rename_to, null, false) . $ext;
if (is_dir($rename_to)) {
Notification::set('error', __('Directory exists', 'filesmanager'));
Request::redirect($site_url . '/admin/index.php?id=filesmanager&path=' . $path);
}
if (is_file($rename_to)) {
Notification::set('error', __('File exists', 'filesmanager'));
Request::redirect($site_url . '/admin/index.php?id=filesmanager&path=' . $path);
}
$success = rename($files_path . $rename_from, $rename_to);
if ($success) {
Notification::set('success', __('Renamed successfully', 'filesmanager'));
} else {
Notification::set('error', __('Failure', 'filesmanager'));
}
Request::redirect($site_url . '/admin/index.php?id=filesmanager&path=' . $path);
} else {
die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
}
//.........这里部分代码省略.........
示例14: str_replace
// Installation Header
require PARENT_APP_PATH . "/includes/install_header.php";
// Run the Form
if (Form::submitted("install-connect-handle")) {
// Check if all of the input you sent is valid:
$_POST['handle'] = str_replace("@", "", $_POST['handle']);
Validate::variable("UniFaction Handle", $_POST['handle'], 1, 22);
if (Validate::pass()) {
// Make sure the handle is registered
if ($response = API_Connect::call(URL::unifaction_com() . "/api/UserRegistered", $_POST['handle'])) {
Cookie_Server::set("admin-handle", $_POST['handle'], "", 3);
Alert::saveSuccess("Admin Chosen", "You have designated @" . $_POST['handle'] . " as the admin of your site.");
header("Location: /install/config-app");
exit;
} else {
Alert::error("Handle Invalid", "That user handle does not exist on UniFaction.");
}
}
} else {
$_POST['handle'] = isset($_POST['handle']) ? Sanitize::variable($_POST['handle']) : "";
}
// Run Global Script
require PARENT_APP_PATH . "/includes/install_global.php";
// Display the Header
require HEADER_PATH;
echo '
<form class="uniform" action="/install/connect-handle" method="post">' . Form::prepare("install-connect-handle");
// Display the Page
echo '
<h1>Installation: Site Admin</h1>
示例15: trans
<div class="row-fluid">
<div class="span12 center login-header">
<center>{{ HTML::image("assets/img/logo2.png") }}</center>
<h2>{{ trans('messages.welcomeadmin') }}</h2>
</div><!--/span-->
</div><!--/row-->
<br><br><br><br>
<div class="row-fluid">
<div class="well span5 center login-box">
<div class="alert alert-info">
{{ trans('messages.pleaselogin') }}
</div>
<?php
if (!is_null(Session::get('status_error'))) {
echo Alert::error(Session::get('status_error'));
}
?>
@if ($errors->has('login'))
<div class="alert alert-error">{{ $errors->first('login', ':message') }}</div>
@endif
<div class="response-login"></div>
{{ Former::horizontal_open('admin/login','post',array('class'=>'ajax', 'data-replace' => '.response-login')) }}
{{Former::text('username', 'messages.username')->prepend('<i class="icon-fam-user"></i>')->placeholder(('Username'))->autofocus()->required(); }}
{{Former::text('password', 'messages.password')->prepend('<i class="icon-fam-key"></i>')->placeholder(('Password'))->type('password')->required();}}
{{Form::submit(trans('messages.login'), array('class' => 'btn btn-primary'));}}
{{Former::close();}}
</div><!--/span-->
</div><!--/row-->
</div><!--/fluid-row-->
</div><!--/.fluid-container-->