public function store() { $data = Input::all(); if (isset($data['phone_number'])) { $data['phone_number'] = str_replace(' ', '', $data['phone_number']); } if (isset($data['work_phone'])) { $data['work_phone'] = str_replace(' ', '', $data['work_phone']); } $u = new User(); $a = false; $role_id = Input::get('role_id'); if ($role_id == Config::get('constants.ROLE_BUYER')) { $a = new Buyer(); $u->status = 2; $data['skip_verification'] = true; } elseif ($role_id == Config::get('constants.ROLE_SELLER')) { $a = new Seller(); } elseif ($role_id == Config::get('constants.ROLE_BROKER')) { $a = new Broker(); } else { //we don't know this role or attempt to register unlisted role unset($data['role_id']); } if (!isset($data['password']) || $data['password'] == "") { $pwd = Str::random(10); $data['password'] = $data['password_confirmation'] = $pwd; } if ($u->validate($data)) { if ($a && $a->validate($data)) { if (isset($pwd)) { Session::set('validate_password', true); } $data['password'] = Hash::make($data['password']); $u->fill($data); $code = Str::random(10); $u->verification_code = $code; $data['verification_code'] = $code; $u->save(); $data['user_id'] = $u->id; $a->fill($data); $a->save(); $email = $u->email; if (isset($data['skip_verification'])) { $data['url']['link'] = url('/'); $data['url']['name'] = 'Go to CompanyExchange'; Mail::queue('emails.templates.welcome', $data, function ($message) use($email) { $message->from('*****@*****.**', 'CompanyExchange'); $message->to($email); $message->subject('Welcome to CompanyExchange'); }); } else { Mail::queue('emails.templates.progress', $data, function ($message) use($email) { $message->from('*****@*****.**', 'CompanyExchange'); $message->to($email); $message->subject('Welcome to CompanyExchange'); }); } if ($role_id == Config::get('constants.ROLE_BUYER')) { Auth::loginUsingId($u->id); Alert::success('Welcome to CompanyExchange. Please feel free to browse through our listings and contact sellers you would like to buy from.', 'Congratulations'); return Redirect::to('search?q=')->withSuccess("Welcome {$u->first_name}. Use the form on the left to search for listed businesses or browse the most recent listings below"); } return Redirect::to('login')->withSuccess('Registration successful. Please check email to activate your account'); } Input::flash(); return View::make('users.register')->withErrors($a ? $a->getValidator() : []); } Input::flash(); return View::make('users.register')->withErrors($u->getValidator()); }
public function batchtrashAction() { $referer = isset($_SERVER["HTTP_REFERER"]) ? str_replace('http://' . $_SERVER['HTTP_HOST'], '', $_SERVER["HTTP_REFERER"]) : '/admin/document/index'; if ($this->getRequest()->isPost()) { if (empty($this->getRequest()->getPost())) { Alert::warning('没有选中任何文章!'); } else { $data = $this->getRequest()->getPost(); //删除db $ret = $this->db_document->batch_trash(['id' => $data['id']]); //删除缓存 foreach ($data['id'] as $id) { $memkey = MEMPREFIX . 'article:detail' . $id; $this->memcache->delete($memkey); } if ($ret) { Alert::success('删除成功!'); } else { Alert::success('删除失败!'); } } } else { Alert::warning('删除失败!'); } $this->redirect($referer); }
public function destroy($id) { $category = $this->categoriesRepo->findOrFail($id); $this->categoriesRepo->delete($category); \Alert::success("CMS::categories.msg_category_deleted"); return redirect()->route('CMS::admin.categories.index'); }
function test_uses_magic_methods() { // Having Alert::success('Success!'); Alert::info('Some information'); // Expect $this->assertTemplate('alerts/magic', Alert::render()); }
/** * this code below was made by * Joko Irianto */ public function getLogin(Request $request) { // notification that account was regist if (\Session::has('message')) { \Session::forget('message'); \Alert::success('Akun anda telah terdaftar, Silahkan login', 'Selamat!')->persistent("close"); } return view('auth.login'); }
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')); } }
public function toggleStatus($id) { $article = $this->articlesRepo->findOrFail($id); $data = ''; $message = null; if ($article->published_at == null) { $data['published_at'] = Carbon::now(); $message = 'CMS::articles.msg_article_published'; } else { $data['published_at'] = null; $message = 'CMS::articles.msg_article_unpublished'; } $this->articlesRepo->update($article, $data); \Alert::success($message); return redirect()->route('CMS::admin.articles.edit', $article->id); }
public function postAccountInfo(Request $request) { // validate the name $validation_rules["name"] = "required|min:5"; // if the email has changed, validate that too if (\Auth::user()->email != $request->input('email')) { $validation_rules["email"] = "required|email|min:5|unique:users"; } $validator = \Validator::make($request->all(), $validation_rules); if ($validator->fails()) { // The given data did not pass validation return redirect()->back()->withInput()->withErrors($validator->errors()); } // update the info $user = User::findOrFail(\Auth::user()->id); $user->name = $request->input('name'); $user->email = $request->input('email'); $user->save(); // set a success/error message \Alert::success(trans('auth.information_updated'))->flash(); // redirect to the edit personal info page return redirect()->back(); }
/** * Update the specified resource in the database. * * @param int $id * @return Response */ public function update(UpdateRequest $request = null) { // if edit_permission is false, abort if (isset($this->crud['edit_permission']) && !$this->crud['edit_permission']) { abort(403, 'Not allowed.'); } $model = $this->crud['model']; $this->prepareFields($model::find(\Request::input('id'))); $all_variables = \Request::all(); // if the change_password field has been filled, change the password if ($all_variables['change_password'] != '') { $all_variables['password'] = $all_variables['change_password']; } $item = $model::find(\Request::input('id'))->update(parent::compactFakeFields($all_variables)); // if it's a relationship with a pivot table, also sync that foreach ($this->crud['fields'] as $k => $field) { if (isset($field['pivot']) && $field['pivot'] == true) { $model::find(\Request::input('id'))->{$field}['name']()->sync(\Request::input($field['name'])); } } // show a success message \Alert::success(trans('crud.update_success'))->flash(); return \Redirect::to($this->crud['route']); }
/** * 新建页面 * @author zhangteng */ public function createAction() { //栏目 $data['category'] = $this->category->categoryList(['parentid' => 7], 0, 50); //判断是否有值提交 if ($this->getRequest()->isPost()) { //内容插入数据库 $ret = $this->page->insert('page', ['title' => $this->getRequest()->getPost('title', ''), 'catid' => $this->getRequest()->getPost('catid', 0), 'keywords' => $this->getRequest()->getPost('keywords', ''), 'listorder' => intval($this->getRequest()->getPost('listorder')), 'url' => filter_var($this->getRequest()->getPost('url'), FILTER_VALIDATE_URL) ? $this->getRequest()->getPost('url') : '', 'description' => $this->getRequest()->getPost('descripion', '') ? $this->getRequest()->getPost('descripion', '0') : trim(misc::remove_nbsp(mb_substr(strip_tags($content), 0, 78, 'UTF-8'))), 'inputtime' => $_SERVER['REQUEST_TIME'], 'status' => 99, 'content' => addslashes(stripslashes($this->getRequest()->getPost('content', '')))]); if ($ret) { Alert::success('添加成功!'); $this->redirect('/admin/page/index'); } else { $referer = isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : '/admin/page/index'; $this->redirect($referer); } } $this->getView()->assign('data', $data); }
<?php Action::run('admin_header'); ?> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]> <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7/html5shiv.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js"></script> <![endif]--> </head> <body class="login-body"> <?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 class="container form-signin"> <div class="text-center"><a class="brand" href="<?php echo Option::get('siteurl'); ?> /admin"><img src="<?php echo Option::get('siteurl'); ?> /public/assets/img/monstra-logo-256px.png" alt="monstra" /></a></div> <div class="administration-area well"> <div>
public function deleteAction() { $id = intval($this->getRequest()->getQuery('id')); if ($this->member->has(['id' => $id])) { $this->member->delete(['id' => $id]); Alert::success('删除成功!'); } else { Alert::success('没有此用户!'); } $this->redirect($_SERVER["HTTP_REFERER"] ? $_SERVER["HTTP_REFERER"] : '/admin/managemember/index'); }
/** * 改变子类的状态 */ public function changeSubStatus() { $subclass_id = $this->getRequest()->getQuery('sid'); if (!$subclass_id) { Alert::danger("非法请求"); Yaf_Controller_Abstract::redirect($this->referer); exit; } //判断当前操作者是否具有权限 if (!$this->checkrole($subclass_id, "topic_subclass")) { Alert::danger("权限出错"); Yaf_Controller_Abstract::redirect($this->referer); exit; } $data['status'] = $this->getRequest()->getQuery('status'); if ($this->topic->update_subclass($subclass_id, $data)) { Alert::success("权限出错"); } else { Alert::danger("权限出错"); } Yaf_Controller_Abstract::redirect("/admin/topicsubclass/index/"); exit; }
public function articlesettingAction() { exit; if ($this->getRequest()->getPost('dosubmit', 0)) { $data = $this->getRequest()->getPost('config'); if ($data) { foreach ($data as $key => $value) { $this->db_config->update_option(['conf_value' => $value], ['conf_name' => $key]); } Alert::success("操作成功"); Yaf_Controller_Abstract::redirect($this->referer); exit; } } else { $data = $this->db_config->get_config(); $this->getView()->assign("data", $data); } }
// 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"; // Display the Header require HEADER_PATH; echo ' <form class="uniform" action="/install/config-site" method="post">' . Form::prepare("install-site-config"); echo ' <h3>Update Your Site Configurations:</h3> <p>Config File: ' . PUBLIC_PATH . '/index.php</p> <p style="margin-top:12px;">Make sure the following values are set properly:</p> <p>
/** * 编辑页面 * @author zhangteng */ public function updateAction() { $data = []; //如果有数据提交就插入数据库 if ($this->getRequest()->isPost()) { $id = intval($this->getRequest()->getPost('id')); $page['description'] = trim($this->getRequest()->getPost('desc')); $page['keywords'] = trim($this->getRequest()->getPost('keywords')); $page['replace_words'] = trim($this->getRequest()->getPost('replace')); $ret = $this->Keyword->replace_keywords_update($id, $page); //更新成功页面跳转 if ($ret !== false) { $referer = $this->redirect($this->getRequest()->getPost('referer')); Alert::success("更新成功"); Yaf_Controller_Abstract::redirect("/admin/replace/index"); exit; } } else { //展示编辑页面 $data['referer'] = isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : '/admin/keyword/index'; $id = intval($this->getRequest()->getQuery('id')); //根据id取数据并展示在页面上 if ($page = $this->Keyword->get_article_Keywords($id)) { $this->getView()->assign('id', $id); $this->getView()->assign('data', $data); $this->getView()->assign('page', $page); } else { //失败跳回上一页 Yaf_Controller_Abstract::redirect("/admin/replace/index"); } } }
/** * 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.'); } } // Upload file // ------------------------------------- if (Request::post('upload_file')) { if (Security::check(Request::post('csrf'))) { $error = false; if ($_FILES['file']) { if (!in_array(File::ext($_FILES['file']['name']), $forbidden_types)) { $filepath = $files_path . Security::safeName(basename($_FILES['file']['name'], File::ext($_FILES['file']['name'])), null, false) . '.' . File::ext($_FILES['file']['name']); $uploaded = move_uploaded_file($_FILES['file']['tmp_name'], $filepath); if ($uploaded !== false && is_file($filepath)) { Notification::set('success', __('File was uploaded', 'filesmanager')); } else { $error = 'File was not uploaded'; } } else { $error = 'Forbidden file type'; } } else { $error = 'File was not uploaded'; } if ($error) { Notification::set('error', __($error, 'filesmanager')); } if (Request::post('dragndrop')) { Request::shutdown(); } else { 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.'); } } // Create Directory // ------------------------------------- if (Request::post('directory_name')) { if (Security::check(Request::post('csrf'))) { $abs_path = $files_path . Security::safeName(Request::post('directory_name'), null, false); $error = false; if (!is_dir($abs_path)) { try { mkdir($abs_path); } catch (Exception $e) { $error = true; } } else { $error = true; } if ($error) { Alert::error(__('Directory was not created', 'filesmanager')); } else { Alert::success(__('Directory was created', 'filesmanager')); } } } // Get information about current path $_list = FilesmanagerAdmin::fdir($files_path); $files_list = array(); // Get files if (isset($_list['files'])) { foreach ($_list['files'] as $files) { $files_list[] = $files; } } $dir_list = array(); // Get dirs if (isset($_list['dirs'])) { foreach ($_list['dirs'] as $dirs) { if (strpos($dirs, '.') === false && strpos($dirs, '..') === false) { $dir_list[] = $dirs; } } } // Display view View::factory('box/filesmanager/views/backend/index')->assign('path', $path)->assign('current', $current)->assign('files_list', $files_list)->assign('dir_list', $dir_list)->assign('forbidden_types', $forbidden_types)->assign('image_types', $image_types)->assign('site_url', $site_url)->assign('upload_max_filesize', FilesmanagerAdmin::uploadSize())->assign('files_path', $files_path)->assign('fileuploader', array('uploadUrl' => $site_url . '/admin/index.php?id=filesmanager&path=' . $path, 'csrf' => Security::token(), 'errorMsg' => __('Upload server error', 'filesmanager')))->display(); }
<?php // Form Submission if (Form::submitted("ban-user-uni6")) { // Check if all of the input you sent is valid: Validate::variable("Handle", $_POST['handle'], 1, 22); // Final Validation Test if (Validate::pass()) { $uniID = User::getIDByHandle($_POST['handle']); if (Database::query("UPDATE users SET clearance=? WHERE uni_id=? LIMIT 1", array(-3, $uniID))) { Alert::success("Ban Success", "You have successfully banned " . $_POST['handle']); } } } // Run Header require SYS_PATH . "/controller/includes/admin_header.php"; // Display the Editing Form echo ' <h3>Permanently Ban Which User?</h3> <form class="uniform" action="/admin/User/Ban User" method="post">' . Form::prepare("ban-user-uni6") . ' <p> <strong>Handle:</strong><br /> <input type="text" name="handle" value="" style="width:200px;" maxlength="22" /> </p> <p><input type="submit" name="submit" value="Ban User" /></p> </form>'; // Display the Footer require SYS_PATH . "/controller/includes/admin_footer.php";
/** * 改变专题状态 */ public function changeTopicStatusAction() { (int) ($topic_id = $this->getRequest()->getQuery('tid')); $data['is_show'] = $this->getRequest()->getQuery('isshow'); if (!$topic_id) { Alert::danger("非法请求"); Yaf_Controller_Abstract::redirect($this->referer); exit; } //判断当前操作者是否具有权限 if (!$this->checkrole($topic_id)) { Alert::danger("权限错误"); Yaf_Controller_Abstract::redirect($this->referer); exit; } if ($this->topic->update('topic', $data, ['topic_id' => $topic_id])) { Alert::success("操作成功"); Yaf_Controller_Abstract::redirect($this->referer); } else { Alert::danger("操作失败"); Yaf_Controller_Abstract::redirect($this->referer); } exit; }
/** * Update the specified resource in storage. * POST /sellers/listings/{id}/photos * * @param int $id * @return Response */ public function addPhotos($listing) { $files = Input::file('photos'); foreach ($files as $file) { if ($file != null && $file->isValid()) { $lp = new ListingPhoto(); $lp->photo_url = 'listings/' . $listing->id . '/' . time() . $file->getClientOriginalName(); $file->move(public_path('files/listings/' . $listing->id), $lp->photo_url); $lp->listing()->associate($listing); $lp->save(); } } Alert::success('Your listing has been created successfully and will be available once verified by admin', 'Congratulations'); return Redirect::to(Auth::user()->role->name . '/listings'); }
/** * Stores an article * @return Response */ public function storeArticle() { $data = Input::all(); $article = new Article(); if ($article->validate($data)) { $file = Input::file('featured'); if ($file != null && $file->isValid()) { $data['featured_img'] = 'articles/' . $article->id . '/' . time() . $file->getClientOriginalName(); $file->move(public_path('files/articles/' . $article->id), $data['featured_img']); } $user = Auth::user(); $article->fill($data); $article->user_id = $user->id; $article->save(); Alert::success('Article created ' . ($article->published ? 'and published' : '') . ' successfully. You may go to menus to link this article to a menu', 'Success'); return Redirect::to('admin/articles')->withSuccess('<strong>Article created successfully.</strong>'); } Input::flash(); return View::make('admin.articles.create')->withErrors($article->getValidator()); }
/** * Delete a particular Resource * @param $id * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function destroy($id) { $academy = Academy::findOrFail($id); $academy->delete(); \Alert::success('Academy Deleted Successfully'); return redirect('academies/all'); }
// Installation Header require dirname(ROUTE_SECOND_PATH) . "/includes/install_header.php"; // Attempt to cheat if (Database::initRoot('mysql')) { Database::exec("CREATE DATABASE IF NOT EXISTS `" . $dbName . '`'); } // 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; } }
/** * 改变专题文章状态 */ public function changeStatusAction() { $id = $this->getRequest()->getQuery('id'); if (!$id) { Alert::danger("非法请求"); Yaf_Controller_Abstract::redirect($this->referer); exit; } $status = (int) $this->getRequest()->getQuery('status'); if (!$this->checkrole($id, "topic_data")) { Alert::danger("权限不足"); Yaf_Controller_Abstract::redirect($this->referer); exit; } if ($this->topic->update("topic_data", ['status' => $status], ['id' => $news_id])) { Alert::success("操作成功"); Yaf_Controller_Abstract::redirect("/admin/topicsubclass/index?tid=" . $tid); } else { Alert::danger("操作失败"); Yaf_Controller_Abstract::redirect($this->referer); } exit; }
/** * Update the specified resource in storage. * PUT /adverts/{id} * * @param int $id * @return Response */ public function update($advert) { $data = Input::all(); //unset all empty control foreach ($data as $key => $value) { if ($value == "") { unset($data[$key]); } } if ($advert->validate($data, 'update')) { $advert->update($data); $success = 'Your advert has been updated successfully.'; Alert::success($success, 'Congratulations'); return View::make(Auth::user()->role->name . '.adverts.edit')->with(compact('advert', isset($success) ? 'success' : 'a')); } Input::flash(); return View::make(Auth::user()->role->name . '.adverts.edit')->withErrors($advert->getValidator()); }
try { $pdo = new PDO("mysql:host={$sql_host};dbname={$sql_name};", $sql_user, $sql_pass, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)); $sql_error = false; } catch (PDOException $ex) { $sql_error = true; } if ($sql_error == true) { echo $alert->danger("Erreur MySQL!"); } else { $dbFile = fopen("../app/Config/database.php", "w"); $databaseStructure = "<?php\nclass DATABASE_CONFIG {\n public \$default = array(\n 'datasource' => 'Database/Mysql',\n 'persistent' => false,\n 'host' => '{$sql_host}', // Hôte\n 'login' => '{$sql_user}', // Nom d'utilisateur\n 'password' => '{$sql_pass}', // Mot de passe\n 'database' => '{$sql_name}', // Database\n 'prefix' => 'extaz_',\n 'encoding' => 'utf8',\n );\n}"; fwrite($dbFile, $databaseStructure); fclose($dbFile); $sql = file_get_contents("ExtazCMS.sql"); $pdo->exec($sql); echo $alert->success("Votre base de données a bien été installée, supprimer le fichier /install/."); $done = true; } } } if ($step == 1 && $done != true) { ?> <div id="bdd"> <form class="ui form" action="<?php echo $_SERVER["PHP_SELF"]; ?> " method="post"> <div class="field"> <label>Hôte SQL</label> <input type="text" name="sql_host" placeholder="Hôte SQL"> </div>
/** * 删除栏目 * @param void * @return void */ function deleteAction() { //接收参数 $category_id = (int) $_GET['cid']; //暂不考虑管理员权限 if ($category_id) { $result = $this->category->delete_category($category_id); if (!$result) { Alert::danger('删除失败'); Yaf_Controller_Abstract::redirect("/admin/category/index/"); } else { Alert::success('删除成功'); Yaf_Controller_Abstract::redirect("/admin/category/index/"); } } else { Yaf_Controller_Abstract::redirect("/admin/category/index/"); } exit; }
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> <p>Config File: ' . SYS_PATH . '/environment.php</p> <p style="margin-top:12px;">Make sure the following variables are set appropriately:</p> <p>
/** * Update the specified resource in the database. * * @param int $id * @return Response */ public function updateCrud(UpdateRequest $request = null) { // if edit_permission is false, abort if (isset($this->crud['edit_permission']) && !$this->crud['edit_permission']) { abort(403, 'Not allowed.'); } $model = $this->crud['model']; $this->prepareFields($model::find(\Request::input('id'))); $item = $model::find(\Request::input('id'))->update($this->compactFakeFields(\Request::all())); // if it's a relationship with a pivot table, also sync that foreach ($this->crud['fields'] as $k => $field) { if (isset($field['pivot']) && $field['pivot'] == true && \Request::has($field['name'])) { $model::find(\Request::input('id'))->{$field}['name']()->sync(\Request::input($field['name'])); } } // show a success message \Alert::success(trans('crud.update_success'))->flash(); return \Redirect::to($this->crud['route']); }
public function statusToggle($id) { $user = $this->usersRepo->findOrFail($id); if ($user->isBlocked()) { $user->blocked_at = null; \Alert::success("CMS::users.msg_user_unblocked"); } else { if ($user->id == $this->current_user->id) { \Alert::danger("CMS::users.msg_you_cant_block_yourself"); return redirect()->back(); } $user->blocked_at = Carbon::now(); \Alert::success("CMS::users.msg_user_blocked"); } $this->usersRepo->save($user); return redirect()->route('CMS::admin.users.edit', $user->id); }