/** * Test the Messages::get method. * * @group laravel */ public function testMessagesRespectFormat() { $this->messages->add('email', 'test'); $this->assertEquals('<p>test</p>', $this->messages->first('email', '<p>:message</p>')); $this->assertEquals(array('<p>test</p>'), $this->messages->get('email', '<p>:message</p>')); $this->assertEquals(array('<p>test</p>'), $this->messages->all('<p>:message</p>')); }
/** * Обработка узла: разделение на подмножества, переход к следующему узлу, * формирование ответа. */ function handleNode() { $this->callId = CallId::getID(); self::$messages->open($this->callId); self::$messages->add([], "Нули на предыдущих этапах:" . $this->history()); if ($this->branchnBound->solved) { $lastBranch = new BranchAndBound([], $this->branchnBound->minBorder); $lastBranch->rowRam = key($this->branchnBound->table); $lastBranch->columnRam = key(current($this->branchnBound->table)); $lastBranch->includeVet = true; $lastBranch2 = new BranchAndBound([], INF); $lastBranch2->rowRam = key($this->branchnBound->table); $lastBranch2->columnRam = key(current($this->branchnBound->table)); $this->childrens[] = new Node($lastBranch2, $this); $this->childrens[] = new Node($lastBranch, $this); $this->makeAnswer(); return; } $devideResult = $this->branchnBound->devide(); self::$messages->close(); if (is_array($devideResult)) { $this->addNewNodes($devideResult); } else { $this->removeMyselfFromMins(); $this->addMyselfToMins(); $this->chooseForWorkFromMins(); } }
function __construct($step_table, $url_is_tab = false) { global $CFG; $this->table = $step_table; $this->url_is_tab = $CFG->url == $step_table ? $CFG->is_tab : $url_is_tab; if (!DB::tableExists($step_table)) { if (DB::createTable($step_table, array('name' => 'vchar', 'group_id' => 'int', 'user_id' => 'int', 'supervisor_id' => 'int', 'days_available' => 'int', 'step_order' => 'int'))) { Messages::add($CFG->table_created); } } }
public function add() { if (isset($_POST['text'])) { // add a new message under current credentials if (Messages::add($_POST['text'], Fari_User::getCredentials())) { // handle with JSON echo json_encode(array('status' => 'success')); } else { echo json_encode(array('status' => 'fail')); } } }
public function post_edit() { $rules = array('id' => 'required|exists:gallery', 'title' => 'required|max:255'); $validation = Validator::make(Input::all(), $rules); if ($validation->fails()) { Messages::add('error', $validation->errors->all()); return Redirect::to('admin/' . $this->views . '/edit')->with_input(); } else { $gallery = Gallery::find(Input::get('id')); $gallery->title = Input::get('title'); $gallery->description = Input::get('description'); $gallery->created_by = $this->data['user']->id; $gallery->save(); Messages::add('success', 'Gallery Saved'); return Redirect::to('admin/' . $this->views . ''); } }
/** * Attempts to upload a file, adds it to the database and removes other database entries for that file type if they are asked to be removed * @param string $field The name of the $_FILES field you want to upload * @param boolean $upload_type The type of upload ('news', 'gallery', 'section') etc * @param boolean $type_id The ID of the item (above) that the upload is linked to * @param boolean $remove_existing Setting this to true will remove all existing uploads of the passed in type (useful for replacing news article images when a new on * @param boolean $title Sets the title of the upload * @param boolean $path_to_store Sets the path to the upload (where it should go) * @return object Returns the upload object so we can work with the uploaded file and details */ public static function upload($details = array()) { $upload_details = array('remove_existing_for_link' => true, 'path_to_store' => path('public') . 'uploads/', 'resizing' => array('small' => array('w' => 200, 'h' => 200), 'thumb' => array('w' => 200, 'h' => 200))); if (!empty($details)) { $required_keys = array('upload_field_name', 'upload_type', 'upload_link_id', 'title'); $continue = true; foreach ($required_keys as $key) { if (!isset($details[$key]) || empty($details[$key])) { Messages::add('error', 'Your upload array details are not complete... please fill this in properly.'); $continue = false; } } if ($continue) { $configuration = $details + $upload_details; $input = Input::file($configuration['upload_field_name']); if ($input && $input['error'] == UPLOAD_ERR_OK) { if ($configuration['remove_existing_for_link']) { static::remove($configuration['upload_type'], $configuration['upload_link_id']); } $ext = File::extension($input['name']); $filename = Str::slug($configuration['upload_type'] . '-' . $configuration['upload_link_id'] . '-' . Str::limit(md5($input['name']), 10, false) . '-' . $configuration['title'], '-'); Input::upload($configuration['upload_field_name'], $configuration['path_to_store'], $filename . '.' . $ext); $upload = new Upload(); $upload->link_type = $configuration['upload_type']; $upload->link_id = $configuration['upload_link_id']; $upload->filename = $filename . '.' . $ext; if (Koki::is_image($configuration['path_to_store'] . $filename . '.' . $ext)) { $upload->small_filename = $filename . '_small' . '.' . $ext; $upload->thumb_filename = $filename . '_thumb' . '.' . $ext; $upload->image = 1; } $upload->extension = $ext; $upload->user_id = Auth::user()->id; $upload->save(); if (Koki::is_image($configuration['path_to_store'] . $filename . '.' . $ext)) { WideImage::load($configuration['path_to_store'] . $upload->filename)->resize($configuration['resizing']['small']['w'], $configuration['resizing']['small']['h'])->saveToFile($configuration['path_to_store'] . $upload->small_filename); WideImage::load($configuration['path_to_store'] . $upload->small_filename)->crop('center', 'center', $configuration['resizing']['thumb']['w'], $configuration['resizing']['thumb']['h'])->saveToFile($configuration['path_to_store'] . $upload->thumb_filename); } return true; } } } else { Messages::add('error', 'Your upload array details are empty... please fill this in properly.'); } return false; }
function receivePayment() { global $CFG; if (empty($_REQUEST['tx'])) { return false; } $auth_info = Link::executeScript($CFG->paypal_submit_url, array('tx' => $_REQUEST['tx'], 'at' => $CFG->paypal_tocken, 'cmd' => '_notify-synch')); $is_approved = stristr($auth_info, 'SUCCESS'); if ($is_approved) { $auth_info = str_ireplace('SUCCESS', '', $auth_info); Messages::add($CFG->paypal_success_message); self::$item_count = mb_substr_count($auth_info, 'item_number'); return self::parseInfo($auth_info); } else { Errors::add($CFG->paypal_failure_message); return false; } }
public function post_edit() { $rules = array('id' => 'required|exists:news', 'title' => 'required|max:255', 'content' => 'required', 'image' => 'image|max:2500'); $validation = Validator::make(Input::all(), $rules); if ($validation->fails()) { Messages::add('error', $validation->errors->all()); return Redirect::to('admin/' . $this->views . '/edit/' . Input::get('id'))->with_input(); } else { $article = News::find(Input::get('id')); $article->title = Input::get('title'); $article->url_title = Str::slug(Input::get('title'), '-'); $article->content = Input::get('content'); $article->save(); $upload_details = array('upload_field_name' => 'image', 'upload_type' => 'news', 'upload_link_id' => $article->id, 'remove_existing_for_link' => false, 'title' => $article->title, 'path_to_store' => path('public') . 'uploads/', 'resizing' => array('small' => array('w' => 200, 'h' => 200), 'thumb' => array('w' => 150, 'h' => 150))); $upload = Uploadr::upload($upload_details); Messages::add('success', 'News article saved'); return Redirect::to('admin/' . $this->views . '/edit/' . Input::get('id')); } }
public function post_index() { $rules = array('issue' => 'required'); $validation = Validator::make(Input::all(), $rules); if ($validation->fails()) { Messages::add('error', 'Please make sure you fill out the form to let us know what problem you are having.'); return Redirect::to('admin/' . $this->views . '')->with_input(); } else { // Get the Swift Mailer instance $mailer = IoC::resolve('mailer'); // Construct the message $message = Swift_Message::newInstance('Message From Website')->setFrom(array($this->data['user']->email => $this->data['user']->fullname))->setTo(array('*****@*****.**' => 'Framework Support For ' . COMPANY_NAME))->setBody('<p><strong>' . $this->data['user']->fullname . ' has emailed you:</strong></p> <q>' . Input::get('issue') . '</q> <p><strong>Email Address: </strong> ' . $this->data['user']->email . '</p> <p><strong>IP Address: </strong> ' . Request::ip() . '</p> <p><strong>User Agent: </strong> ' . Request::server('HTTP_USER_AGENT') . '</p>', 'text/html'); // Send the email $mailer->send($message); Messages::add('success', '<strong>Support Issue Sent</strong> We\'ll be in touch shortly.'); return Redirect::to('admin/help'); } }
public function post_edit() { $rules = array('id' => 'required|exists:news', 'title' => 'required|max:255', 'content' => 'required', 'image' => 'image|max:2500'); $validation = Validator::make(Input::all(), $rules); if ($validation->fails()) { Messages::add('error', $validation->errors->all()); return Redirect::to('admin/' . $this->views . '/edit')->with_input(); } else { $article = News::find(Input::get('id')); $article->title = Input::get('title'); $article->url_title = Str::slug(Input::get('title'), '-'); $article->content = Input::get('content'); $article->save(); $upload = Uploadr::upload('image', 'news', $article->id, true); if ($upload) { WideImage::load('./uploads/' . $upload->filename)->resize(200, 200)->saveToFile('./uploads/' . $upload->small_filename); WideImage::load('./uploads/' . $upload->small_filename)->crop('center', 'center', 150, 150)->saveToFile('./uploads/' . $upload->thumb_filename); } Messages::add('success', 'News article saved'); return Redirect::to('admin/' . $this->views . ''); } }
public function post_delsparepart() { $sparepart = array('id' => 'required|exists:spareparts'); $validation = Validator::make(Input::all(), $sparepart); if ($validation->fails()) { Messages::add('error', 'You tried to delete a sparepart that doesn\'t exist.'); return Redirect::to($this->views . ''); } else { $sp = Sparepart::find(Input::get('id')); $sp->delete(); Messages::add('success', 'Sparepart Removed'); return Redirect::to($this->views . ''); } }
} } */ if (!empty($_REQUEST['message'])) { if ($_REQUEST['message'] == 'settings-personal-message') { Messages::add(Lang::string('settings-personal-message')); } elseif ($_REQUEST['message'] == 'settings-settings-message') { Messages::add(Lang::string('settings-settings-message')); } elseif ($_REQUEST['message'] == 'settings-account-deactivated') { Messages::add(Lang::string('settings-account-deactivated')); } elseif ($_REQUEST['message'] == 'settings-account-reactivated') { Messages::add(Lang::string('settings-account-reactivated')); } elseif ($_REQUEST['message'] == 'settings-account-locked') { Messages::add(Lang::string('settings-account-locked')); } elseif ($_REQUEST['message'] == 'settings-account-unlocked') { Messages::add(Lang::string('settings-account-unlocked')); } } if (!empty($_REQUEST['notice']) && $_REQUEST['notice'] == 'email') { $notice = Lang::string('settings-change-notice'); } $cur_sel = array(); if ($CFG->currencies) { foreach ($CFG->currencies as $key => $currency) { if (is_numeric($key) || $currency['currency'] == 'BTC') { continue; } $cur_sel[$key] = $currency; } } $page_title = Lang::string('settings');
Errors::add(Lang::string('settings-request-expired')); } if (!is_array(Errors::$errors)) { Messages::add(Lang::string('security-success-message')); $step4 = true; } else { $step3 = true; } } else { $step3 = true; } } if (!empty($_REQUEST['notice']) && $_REQUEST['notice'] == 'email') { $notice = Lang::string('settings-change-notice'); } elseif (!empty($_REQUEST['message']) && $_REQUEST['message'] == 'security-disabled-message') { Messages::add(Lang::string('security-disabled-message')); } if (User::$info['verified_authy'] == 'Y' || $step2) { API::add('Content', 'getRecord', array('security-setup')); } elseif (User::$info['verified_google'] == 'Y' || $step4) { API::add('Content', 'getRecord', array('security-setup-google')); } elseif ($step1) { API::add('Content', 'getRecord', array('security-token')); } elseif ($step3) { API::add('Content', 'getRecord', array('security-google')); API::add('User', 'getGoogleSecret'); } else { API::add('Content', 'getRecord', array('security-explain')); } $query = API::send(); $content = $query['Content']['getRecord']['results'][0];
<?php session_start(); require_once '../scripts/session/class.messages.php'; $msg = new Messages(); if (isset($_SESSION['id'])) { //echo '<br>'; //echo "Welcome user " .$_SESSION['id']."<a href='../scripts/session/logout.php'> logout</a>"; } else { header("Location: ../index.php"); echo $msg->add('e', '<div style="width: 100%px;" class="alert alert-danger">Debes autenticarte!</p>'); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="author" content="Dashboard"> <meta name="keyword" content="Informe de, equipos microinformatica, prosegur"> <title>Web de informes GLPI</title> <!-- Bootstrap core CSS --> <link href="assets/css/bootstrap.css" rel="stylesheet"> <!--external css--> <link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" /> <link rel="stylesheet" type="text/css" href="assets/css/zabuto_calendar.css"> <link rel="stylesheet" type="text/css" href="assets/js/gritter/css/jquery.gritter.css" />
$type1 = !empty($_REQUEST['type']) ? preg_replace("/[^0-9]/", "", $_REQUEST['type']) : false; $page1 = !empty($_REQUEST['page']) ? preg_replace("/[^0-9]/", "", $_REQUEST['page']) : false; $trans_realized1 = !empty($_REQUEST['transactions']) ? preg_replace("/[^0-9]/", "", $_REQUEST['transactions']) : false; $bypass = !empty($_REQUEST['bypass']); API::add('Transactions', 'get', array(1, $page1, 30, $currency1, 1, $start_date1, $type1, $order_by1, $order_desc1)); $query = API::send(); $total = $query['Transactions']['get']['results'][0]; API::add('Transactions', 'get', array(false, $page1, 30, $currency1, 1, $start_date1, $type1, $order_by1, $order_desc1)); API::add('Transactions', 'getTypes'); $query = API::send(); $transactions = $query['Transactions']['get']['results'][0]; $transaction_types = $query['Transactions']['getTypes']['results'][0]; $pagination = Content::pagination('transactions.php', $page1, $total, 30, 5, false); $currency_info = $currency1 ? $CFG->currencies[strtoupper($currency1)] : array(); if ($trans_realized1 > 0) { Messages::add(str_replace('[transactions]', $trans_realized1, Lang::string('transactions-done-message'))); } $page_title = Lang::string('transactions'); if (!$bypass) { include 'includes/head.php'; ?> <div class="page_title"> <div class="container"> <div class="title"><h1><?php echo $page_title; ?> </h1></div> <div class="pagenation"> <a href="<?php echo Lang::url('index.php'); ?> "><?php
$_SESSION["register_uniq"] = md5(uniqid(mt_rand(), true)); Link::redirect('verify-token.php'); } elseif (!empty($login['message']) && $login['message'] == 'logged-in' && $login['no_logins'] == 'Y') { $_SESSION["register_uniq"] = md5(uniqid(mt_rand(), true)); Link::redirect('first_login.php'); } elseif (!empty($login['message']) && $login['message'] == 'logged-in') { $_SESSION["register_uniq"] = md5(uniqid(mt_rand(), true)); Link::redirect('account.php'); } } elseif (!$login || !empty($login['error'])) { Errors::add(Lang::string('login-invalid-login-error')); } } } if (!empty($_REQUEST['message']) && $_REQUEST['message'] == 'registered') { Messages::add(Lang::string('register-success')); } $_SESSION["register_uniq"] = md5(uniqid(mt_rand(), true)); include 'includes/head.php'; ?> <div class="page_title"> <div class="container"> <div class="title"><h1><?php echo Lang::string('home-login'); ?> </h1></div> <div class="pagenation"> <a href="index.php"><?php echo Lang::string('home'); ?> </a> <i>/</i> <a href="login.php"><?php echo Lang::string('home-login');
foreach ($items as $order => $id) { if (in_array('page_map_reorders', $table_fields) && $table == 'admin_pages') { $rec = DB::getRecord('admin_pages', $id, 0, 1); if ($rec['page_map_reorders'] > 0) { continue; } } DB::update($table, array('order' => $i), $id); $i++; } } } if (is_array($_REQUEST['page_map'])) { if (is_array($_REQUEST['page_map']['methods'])) { foreach ($_REQUEST['page_map']['methods'] as $order => $id) { DB::update('admin_controls_methods', array('order' => $order), $id); } } if (is_array($_REQUEST['page_map']['pages'])) { foreach ($_REQUEST['page_map']['pages'] as $order => $id) { DB::update('admin_pages', array('order' => $order, 'page_map_reorders' => 1), $id); } } } if (!$errors) { Messages::add($CFG->ajax_save_message); Messages::display(); } else { Errors::merge($errors); Errors::display(); }
if (!empty($_REQUEST['edit_order']) && !$trans_realized1) { Messages::add(Lang::string('transactions-orders-edit-message')); } elseif (!empty($_REQUEST['new_order']) && $trans_realized1 > 0) { Messages::add(str_replace('[transactions]', $trans_realized1, Lang::string('transactions-orders-done-message'))); } elseif (!empty($_REQUEST['edit_order']) && $trans_realized1 > 0) { Messages::add(str_replace('[transactions]', $trans_realized1, Lang::string('transactions-orders-done-edit-message'))); } elseif (!empty($_REQUEST['message']) && $_REQUEST['message'] == 'order-doesnt-exist') { Errors::add(Lang::string('orders-order-doesnt-exist')); } elseif (!empty($_REQUEST['message']) && $_REQUEST['message'] == 'not-your-order') { Errors::add(Lang::string('orders-not-yours')); } elseif (!empty($_REQUEST['message']) && $_REQUEST['message'] == 'order-cancelled') { Messages::add(Lang::string('orders-order-cancelled')); } elseif (!empty($_REQUEST['message']) && $_REQUEST['message'] == 'deleteall-error') { Errors::add(Lang::string('orders-order-cancelled-error')); } elseif (!empty($_REQUEST['message']) && $_REQUEST['message'] == 'deleteall-success') { Messages::add(Lang::string('orders-order-cancelled-all')); } $page_title = Lang::string('open-orders'); $_SESSION["openorders_uniq"] = md5(uniqid(mt_rand(), true)); if (!$bypass) { include 'includes/head.php'; ?> <div class="page_title"> <div class="container"> <div class="title"><h1><?php echo $page_title; ?> </h1></div> <div class="pagenation"> <a href="<?php echo Lang::url('index.php'); ?>
$enable->submitButton('submit', 'Enable 2FA'); $enable->display(); } } else { if ($CFG->action == 'disable') { $show_form = false; $CFG->form_legend = 'Please enter your token...'; $disable = new Form('users_form_disable', false, false, false, false, true); if (!empty($_REQUEST['users_form_disable'])) { $key = User::$info['authy_id']; $response = Google2FA::verify_key($key, $disable->info['token']); if (!$response) { $response->errors[] = 'Invalid token.'; } else { db_update('admin_users', User::$info['id'], array('verified_authy' => 'N')); Messages::add('You have succesfully disabled 2FA.'); $show_form = true; } } if (!$show_form) { $disable->verify(); $disable->show_errors(); $disable->HTML('<img class="qrcode" src="includes/qrcode.php?sec=1&code=otpauth://totp/Backstage2?secret=' . $key . '" />'); $disable->textInput('token', 'Enter token', true); $disable->submitButton('submit', 'Disable 2FA'); $disable->display(); } } } if ($show_form) { Messages::display();
/** * Tests Messages::add method * * @group laravel */ public function testAddMethodAddsEntrytoArray() { $this->messages->add('success', 'ok'); $this->assertEquals(array('success' => array(new Entry('ok', 'success'))), $this->messages->messages); }
API::add('User', 'getAvailable'); API::add('User', 'getVolume'); API::add('FeeSchedule', 'getRecord', array(User::$info['fee_schedule'])); API::add('Stats', 'getBTCTraded', array($_SESSION['c_currency'])); API::add('Currencies', 'getMain'); $query = API::send(); $currencies = $CFG->currencies; $on_hold = $query['User']['getOnHold']['results'][0]; $available = $query['User']['getAvailable']['results'][0]; $volume = $query['User']['getVolume']['results'][0]; $fee_bracket = $query['FeeSchedule']['getRecord']['results'][0]; $total_btc_volume = $query['Stats']['getBTCTraded']['results'][0][0]['total_btc_traded']; $main = $query['Currencies']['getMain']['results'][0]; if (!empty($_REQUEST['message'])) { if ($_REQUEST['message'] == 'settings-personal-message') { Messages::add(Lang::string('settings-personal-message')); } } $page_title = Lang::string('account'); include 'includes/head.php'; ?> <div class="page_title"> <div class="container"> <div class="title"><h1><?php echo $page_title; ?> </h1></div> <div class="pagenation"> <a href="index.php"><?php echo Lang::string('home'); ?> </a> <i>/</i> <a href="account.php"><?php
Link::redirect('withdraw.php?message=withdraw-success'); } } } } elseif (!$no_token) { $request_2fa = true; } } } } } if (!empty($_REQUEST['message'])) { if ($_REQUEST['message'] == 'withdraw-2fa-success') { Messages::add(Lang::string('withdraw-2fa-success')); } elseif ($_REQUEST['message'] == 'withdraw-success') { Messages::add(Lang::string('withdraw-success')); } } if (!empty($_REQUEST['notice']) && $_REQUEST['notice'] == 'email') { $notice = Lang::string('withdraw-email-notice'); } $page_title = Lang::string('withdraw'); if (empty($_REQUEST['bypass'])) { $_SESSION["withdraw_uniq"][time()] = md5(uniqid(mt_rand(), true)); include 'includes/head.php'; ?> <div class="page_title"> <div class="container"> <div class="title"><h1><?php echo $page_title; ?>
public function post_edit() { $rules = array('id' => 'required|exists:users', 'username' => 'required|max:255', 'first_name' => 'required|max:255', 'last_name' => 'required|max:255', 'email' => 'required|email'); $validation = Validator::make(Input::all(), $rules); if ($validation->fails()) { Messages::add('error', $validation->errors->all()); return Redirect::to('admin/' . $this->views . '/edit')->with_input(); } else { $usr = User::find(Input::get('id')); $usr->username = Input::get('username'); $usr->email = Input::get('email'); $usr->first_name = Input::get('first_name'); $usr->last_name = Input::get('last_name'); $usr->admin = Input::get('admin') ? 1 : 0; $usr->active = 1; if (Input::get('password')) { $usr->password = Input::get('password'); } $usr->roles()->delete(); if (Input::get('roles')) { foreach (Input::get('roles') as $rolekey => $val) { $usr->roles()->attach($rolekey); } } $usr->save(); Messages::add('success', 'User updated'); return Redirect::to('admin/' . $this->views . ''); } }
public function post_changepassword() { $usr = User::find(Auth::user()->id); if (Input::get('password')) { $usr->password = Input::get('password'); } $usr->save(); Messages::add('success', 'Password Changed!'); return Redirect::to('users/changepassword'); }
$info_message = str_replace('[secret]', $secret, Lang::string('api-add-show-secret')); API::add('APIKeys', 'get'); $query = API::send(); $api_keys = $query['APIKeys']['get']['results'][0]; } elseif ($_REQUEST['action'] == 'delete') { Link::redirect('api-access.php?message=delete'); } } else { $request_2fa = true; } } } if (!empty($_REQUEST['message']) && $_REQUEST['message'] == 'edit') { Messages::add(Lang::string('api-edit-message')); } elseif (!empty($_REQUEST['message']) && $_REQUEST['message'] == 'delete') { Messages::add(Lang::string('api-delete-message')); } elseif (!empty($_REQUEST['error']) && $_REQUEST['error'] == 'delete') { Errors::add(Lang::string('api-delete-error')); } $page_title = Lang::string('api-access-setup'); include 'includes/head.php'; ?> <div class="page_title"> <div class="container"> <div class="title"><h1><?php echo $page_title; ?> </h1></div> <div class="pagenation"> <a href="index.php"><?php echo Lang::string('home'); ?>
public function post_edit() { $rules = array('id' => 'required|exists:facturasxpagar', 'folio' => 'required|max:20', 'proveedor_id' => 'required|numeric|exists:proveedores,id', 'fecha_exp' => 'required', 'fecha_venc' => 'required', 'subtotal' => 'required|numeric', 'piva' => 'required|numeric', 'iva' => 'required|numeric', 'total' => 'required|numeric'); $validation = Validator::make(Input::all(), $rules); if ($validation->fails()) { Messages::add('error', $validation->errors->all()); return Redirect::to('admin/' . $this->controlador . '/edit')->with_input(); } else { //Validamos el detalle tambien. foreach (Input::get('concepto') as $key => $value) { if ($key == 0) { } elseif (!empty($_POST['cantidad'][$key]) && is_numeric($_POST['cantidad'][$key]) && !empty($_POST['concepto'][$key]) && !empty($_POST['precio_unitario'][$key]) && is_numeric($_POST['precio_unitario'][$key]) && !empty($_POST['importe'][$key]) && is_numeric($_POST['importe'][$key])) { } else { Messages::add('error', "Verificar detalle de la factura. Todos los valores deben de ser llenados, validos\n y en caso de ser numéricos, mayores a 0. (Cantidad, Concepto, Precio Unitario e Importe, el Producto es Opcional)"); return Redirect::to('admin/' . $this->controlador . '/create')->with_input(); } } //Agregamos la hora a la fecha de expedicion $exp = $this->addHoursToExpDate(Input::get('fecha_exp')); //Actualizamos los datos de la factura $fxp = Facturaxpagar::find(Input::get('id')); $fxp->folio_fxp = Input::get('folio'); $fxp->proveedor_id = Input::get('proveedor_id'); $fxp->plazo = 30; $fxp->fecha_expedicion = $exp; $fxp->fecha_vencimiento = Input::get('fecha_venc'); $fxp->subtotal = Input::get('subtotal'); $fxp->piva = Input::get('piva'); $fxp->iva = Input::get('iva'); $fxp->pdesc = 0; $fxp->descuento = 0; $fxp->total = Input::get('total'); $fxp->save(); //Primero borramos el detalle viejo. $fxp->detalles()->delete(); //Finalmente guardamos el detalle foreach (Input::get('concepto') as $key => $value) { if ($key == 0) { } else { $dfxp = new Dfacturaxpagar(); $dfxp->fxp_id = $fxp->id; $dfxp->cantidad = $_POST['cantidad'][$key]; $dfxp->concepto = $value; $dfxp->precio_unitario = $_POST['precio_unitario'][$key]; $dfxp->importe = $_POST['importe'][$key]; if (!empty($_POST['material_id'][$key])) { $dfxp->material_id = $_POST['material_id'][$key]; } $dfxp->save(); } } Messages::add('success', 'Factura Actualizada'); return Redirect::to('admin/' . $this->controlador . ''); } }
public function post_edit() { $rules = array('id' => 'required|exists:roles', 'name' => 'required|max:255'); $validation = Validator::make(Input::all(), $rules); if ($validation->fails()) { Messages::add('error', $validation->errors->all()); return Redirect::to($this->views . '/edit')->with_input(); } else { $role = Role::find(Input::get('id')); $role->name = Input::get('name'); $role->slug = Str::slug(Input::get('name'), '-'); $role->users()->delete(); if (Input::get('users')) { foreach (Input::get('users') as $rolekey => $val) { $role->users()->attach($rolekey); } } $role->save(); Messages::add('success', 'Role updated'); return Redirect::to($this->views . ''); } }
include_once 'securimage/securimage.php'; $securimage = new Securimage(); $captcha_error = empty($_REQUEST['forgot']['captcha']) || !$securimage->check($_REQUEST['forgot']['captcha']); } else { $captcha = new Form('captcha'); $captcha->reCaptchaCheck(1); if (!empty($captcha->errors) && is_array($captcha->errors)) { $captcha_error = true; Errors::add($captcha->errors['recaptcha']); } } if (!$captcha_error) { API::add('User', 'resetUser', array($email1)); $query = API::send(); Messages::$messages = array(); Messages::add(Lang::string('login-password-sent-message')); } else { Errors::add(Lang::string('login-capcha-error')); } } $_SESSION["forgot_uniq"] = md5(uniqid(mt_rand(), true)); include 'includes/head.php'; ?> <div class="page_title"> <div class="container"> <div class="title"><h1><?php echo Lang::string('login-forgot'); ?> </h1></div> <div class="pagenation"> <a href="index.php"><?php echo Lang::string('home');
public function post_edit() { $rules = array('id' => 'required|exists:categoriamaterial', 'name' => 'required|max:30'); $validation = Validator::make(Input::all(), $rules); if ($validation->fails()) { Messages::add('error', $validation->errors->all()); return Redirect::to('admin/' . $this->controlador . '/edit/' . Input::get('id'))->with_input(); } else { $cat = Categoriamaterial::find(Input::get('id')); $cat->nombre = strtoupper(Input::get('name')); $cat->save(); Messages::add('success', 'Categoria Actualizada'); return Redirect::to('admin/' . $this->controlador . ''); } }
function display($use_fckeditor = false, $require_email = false, $ask_website = false, $editor_height = false) { global $CFG; if ($CFG->backstage_mode && !($this->record_id > 0) && !$this->show_all) { return false; } $use_fckeditor = $this->use_fckeditor ? $this->use_fckeditor : $use_fckeditor; $require_email = $this->require_email ? $this->require_email : $require_email; $ask_website = $this->ask_website ? $this->ask_website : $ask_website; $editor_height = $this->editor_height ? $this->editor_height : $editor_height; if ($_REQUEST['comments_' . $this->i] && !$this->comments_closed) { if (!empty($_REQUEST['comments_' . $this->i]['comments1'])) { $_REQUEST['comments_' . $this->i]['comments'] = $_REQUEST['comments_' . $this->i]['comments1']; unset($_REQUEST['comments_' . $this->i]['comments1']); } $CFG->save_called = false; $form = new Form('comments_' . $this->i, false, false, $this->class . '_form', 'comments'); $form->verify(); if (!$form->errors) { $form->save(); Messages::add($CFG->comments_sent_message); Messages::display(); } else { $form->show_errors(); } } $comments = Comments::get(); $c = count(Comments::get(false, true)); $show = $this->autoshow ? '' : 'style="display:none;"'; if ($this->label) { if ($CFG->pm_editor) { $method_name = Form::peLabel($this->label['method_id'], 'label'); } echo '<div class="grid_label"><div class="label">' . $this->label['text'] . ' ' . $method_name . '</div><div class="clear"></div></div>'; } if (!$this->short_version) { if ($comments) { echo '<div class="expand">' . str_ireplace('[field]', $c, $CFG->comments_there_are) . ' ' . (!$_REQUEST['comments_' . $this->i] ? '<a href="#" onclick="showComments(' . $this->i . ',this);return false;">' . $CFG->comments_expand . '</a>' : '') . '<a style="display:none;" href="#" onclick="hideComments(' . $this->i . ',this);return false;">' . $CFG->comments_hide . '</a></div>'; } else { echo '<div class="expand">' . $CFG->comments_none . ' <a href="#" onclick="showComments(' . $this->i . ',this);return false;">' . $CFG->comments_be_first . '</a><a style="display:none;" href="#" onclick="hideComments(' . $this->i . ',this);return false;">' . $CFG->comments_hide . '</a></div>'; } } echo ' <div id="comments_' . $this->i . '" class="' . $this->class . '" ' . (!$_REQUEST['comments_' . $this->i] ? $show : '') . '>'; if ($comments) { Comments::show($comments); } echo ' <div id="movable_form" style="display:none;">'; if (!$this->comments_closed) { Comments::showForm($use_fckeditor, $require_email, $ask_website, 1, $editor_height); } echo ' </div>'; if (!$this->comments_closed) { Comments::showForm($use_fckeditor, $require_email, $ask_website, 0, $editor_height); } echo ' <div style="clear:both;height:0;"></div> </div>'; }