public function updatePoint($id, request $request) { $hairstyles = hairstyles::find($id); $hairstyles->Xpoint = $request->input('Xpoint'); $hairstyles->Ypoint = $request->input('Ypoint'); $hairstyles->save(); return redirect()->intended('hairstyles/edit/' . $id); }
public function update($id, request $request) { $categories = Categories::find($id); $categories->name = $request->input('name'); $categories->description = $request->input('description'); $categories->save(); return redirect()->intended('categories'); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(request $request) { DB::enableQueryLog(); $imei = $request->input('imei'); $api = $request->input('api'); $client = ApiKeys::where('api', $api)->where('imei', $imei)->count(); if ($client > 0) { $jsonArray = ["api" => true, "message" => ""]; } else { $jsonArray = ["api" => false, "message" => "Client not registered."]; } return response()->json($jsonArray); }
/** * Store Emails for updates in the future * * @return Response */ public function store(request $request) { $email = new Email(); $email->email = $request->input('email'); $email->save(); return redirect()->back(); }
public function action_index() { $input = request::input(); // create object and load data $object = new numbers_backend_system_menu_model_datasource_menu(); $data = $object->get(['where' => ['type' => [1, 2], 'group1_code' => $input['group1_code'] ?? null, 'group2_code' => $input['group2_code'] ?? null, 'group3_code' => $input['group3_code'] ?? null]]); // assemble data $name = ''; $icon = ''; if (!empty($input['group1_code'])) { $name = $data[$input['group1_code']]['name']; $icon = $data[$input['group1_code']]['icon']; $data = $data[$input['group1_code']]['options']; // if we have options if (!empty($input['group2_code'])) { $name = $data[$input['group2_code']]['name']; $icon = $data[$input['group2_code']]['icon']; $data = $data[$input['group2_code']]['options']; // if we have options if (!empty($input['group3_code'])) { $name = $data[$input['group3_code']]['name']; $icon = $data[$input['group3_code']]['icon']; $data = $data[$input['group3_code']]['options']; } } } echo html::segment(['type' => 'primary', 'value' => $this->render_options($data, $name, $icon)]); }
public function update($id, request $request) { $apikeys = ApiKeys::find($id); $apikeys->imei = $request->input('imei'); $apikeys->save(); return redirect()->intended('clients'); }
public function action_index() { // clear buffer helper_ob::clean_all(); // validating do { $options = application::get('flag.numbers.backend.cron.base'); // token if (!empty($options['token']) && request::input('token') != $options['token']) { break; } // ip if (!empty($options['ip']) && !in_array(request::ip(), $options['ip'])) { break; } // get date parts $date_parts = format::now('parts'); print_r($date_parts); echo "GOOD\n"; } while (0); // we need to validate token //$token = request::input('token'); echo "OK\n"; // exit exit; }
/** * Show the application welcome screen to the user. * * @return Response */ public function index(request $request) { if ($request->input('st')) { $site_id = $request->input('st'); $state_id = DB::table('site_details')->where('id', '=', $site_id)->pluck('state_id'); if ($state_id) { $parameters = DB::table('parameters')->join('tests', 'tests.parameter_id', '=', 'parameters.id')->where('tests.state_id', '=', $state_id)->orderBy('parameters.name')->get(); } } else { $state_id = ""; $parameters = DB::table('parameters')->orderBy('parameters.name')->get(); } $users = DB::table('users')->where('role_id', '=', 3)->select('id', 'name', 'email')->get(); $customers = Customer::all(); $orders = Order::where('customer_id', '=', 14)->get(); return view('order/index')->with(compact('parameters', 'users', 'orders', 'customers', 'state_id')); }
public function update($id, request $request) { $frames = Frames::find($id); $image = $frames->image; $file = $request->file('image'); if (!empty($file)) { $destinationPath = 'uploads/frames'; // upload path $fileName = $request->file('image')->getClientOriginalName(); // renameing image $request->file('image')->move($destinationPath, $fileName); // uploading file to given path } else { $fileName = $image; } $frames->name = $request->input('name'); $frames->description = $request->input('description'); $frames->image = $fileName; $frames->save(); return redirect()->intended('frames'); }
/** * Renew session */ public function action_renew() { $input = request::input(null, true, true); $result = ['success' => false, 'error' => []]; if (!empty($input['token'])) { $crypt = new crypt(); $token_data = $crypt->token_validate($input['token'], ['skip_time_validation' => true]); if (!($token_data === false || $token_data['id'] !== 'general')) { $result['success'] = true; } } layout::render_as($result, 'application/json'); }
/** * This would process error message sent from frontend */ public function action_index() { $input = request::input(); if (!empty($input['token'])) { $crypt = new crypt(); $token_data = $crypt->token_validate($input['token'], ['skip_time_validation' => true]); if (!($token_data === false || $token_data['id'] !== 'general')) { $input['data'] = json_decode($input['data'], true); error_base::error_handler('javascript', $input['data']['message'], $input['data']['file'], $input['data']['line']); } } // rendering layout::render_as(file_get_contents(__DIR__ . '/error.png'), 'image/png'); }
public function render() { $input = request::input(); $settings = array(); $settings['limit'] = @$input['limit'] ? @intval($input['limit']) : 20; $settings['offset'] = @intval(@$input['offset']); // show starting from this row $settings['orderby'] = isset($input['orderby']) ? $input['orderby'] : $this->list_orderby; // order by column $settings['orderdesc'] = isset($input['orderdesc']) ? $input['orderdesc'] : $this->list_orderdesc; // order direction $settings['took'] = microtime(true); // building sql for select $from = ' FROM ' . $this->list_table . @$this->left_join . ' WHERE 1=1'; // full text search $full_text_search = array(); $gist_columns = array(); if (!empty($input['full_text_search']) && !empty($this->full_text_search_column)) { $full_text_search = db::tsquery($this->full_text_search_column, $input['full_text_search'], '|', true, array(), $this->link); $from .= $full_text_search['where']; } // other where if (!empty($this->where)) { $from .= $this->where; } // getting number of records if (@$this->list_count_rows) { $sql = 'SELECT COUNT(*) as rows_count ' . $from; $result = db::query($sql, '', array(), $this->link); if (@$result['error']) { layout::add_message($result['error'], 'error'); } // use this variable to get number of rows, isset for verification $settings['count_rows'] = @$result['rows'][0]['rows_count'] ? $result['rows'][0]['rows_count'] : 0; } else { // EXPERIMENTAL: increase number of rows fetched by 1 to check whether next row exists $settings['limit']++; } // quering $sql = 'SELECT ' . $this->select . (!empty($full_text_search['rank']) ? ', ' . $full_text_search['rank'] . ' ts_rank2' : '') . $from; $sql .= ' ORDER BY ' . (@$full_text_search['orderby'] ? @$full_text_search['orderby'] . ", " : "") . $settings['orderby'] . ($settings['orderdesc'] ? ' DESC' : ''); $sql .= $settings['limit'] ? ' LIMIT ' . $settings['limit'] : ''; $sql .= $settings['offset'] ? ' OFFSET ' . $settings['offset'] : ''; $result = db::query($sql, '', array(), $this->link); $settings['took'] = round(microtime(true) - $settings['took'], 2); // processing count if (!@$this->list_count_rows) { if (isset($result['rows'][$settings['limit'] - 1])) { $settings['flag_next_row_exists'] = true; } unset($result['rows'][$settings['limit'] - 1]); $settings['limit']--; } $settings['num_rows'] = count($result['rows']); // rendering list $ms = ''; // Hidden elements $ms .= h::hidden(array('name' => 'orderby', 'id' => 'orderby', 'value' => $settings['orderby'])); $ms .= h::hidden(array('name' => 'orderdesc', 'id' => 'orderdesc', 'value' => $settings['orderdesc'])); $ms .= h::hidden(array('name' => 'offset', 'id' => 'offset', 'value' => $settings['offset'])); $ms .= h::hidden(array('name' => 'limit', 'id' => 'limit', 'value' => $settings['limit'])); // if we have no rows if (empty($result['rows'])) { $ms .= 'No records found!'; } else { // main container $header = $this->header($settings); $ms .= $header; $ms .= '<br/>'; $ms .= '<table cellpadding="0" cellspacing="0" class="editor table" width="100%">'; // types $types = model_presets::get('he_post_type'); // rows $row_counter = 1; foreach ($result['rows'] as $k => $v) { $ms .= '<tr>'; $ms .= '<td class="editor cell numeration" valign="top">' . $row_counter . '. </td>'; $ms .= '<td class="editor cell regular" align="left">'; // generating urls $url_post = call_user_func_array($this->url_posts, array($v['type'], $v['post_id'], $v['uri'])); $url_type = call_user_func_array($this->url_type, array($v['type'])); // title with icon goes first $value = $v['title']; if ($v['type'] == 20) { $v['icon'] = 'help16.png'; } else { if ($v['type'] == 10) { $v['icon'] = 'faq16.png'; } } if (!empty($v['icon'])) { $value = icon::render($v['icon']) . ' ' . $value; } $ms .= h::a(array('href' => $url_post, 'value' => $value)); if (isset($v['ts_rank2'])) { $ms .= ' [' . $v['ts_rank2'] . ']'; } // entry type $ms .= ' ' . h::a(array('href' => $url_type, 'value' => $types[$v['type']]['name'], 'style' => 'color:black;')); $ms .= '<br/>'; $ms .= h::a(array('href' => $url_post, 'value' => $url_post, 'style' => 'color: green;')); if (!empty($input['full_text_search'])) { $ms .= '<br/>'; $temp = keywords::highlight($v['body'], $input['full_text_search'], array('<b style="color:red;">', '</b>')); } else { $ms .= '<br/>'; $temp = $v['body']; } $ms .= $temp; $ms .= '<br/>'; $ms .= '<br/>'; $ms .= '</td>'; $ms .= '</tr>'; $row_counter++; } $ms .= '</table>'; $ms .= $header; $ms .= '<br class="clearfloat">'; } return $ms; }
/** * Process magic variables */ public static function process_magic_variables() { $variables_object = new object_magic_variables(); $variables = $variables_object->get(); $input = request::input(null, true, true); foreach ($variables as $k => $v) { if (!array_key_exists($k, $input)) { continue; } if ($k == '__content_type') { $object = new object_content_types(); $data = $object->get(); if (isset($data[$input[$k]])) { self::$settings['flag']['global'][$k] = $input[$k]; } } else { self::$settings['flag']['global'][$k] = $input[$k]; } } }
public function action_edit() { $form = new numbers_backend_documents_basic_model_form_catalogs(['input' => request::input()]); echo $form->render(); }
/** * @see html::tabs(); */ public static function tabs($options = []) { $header = $options['header'] ?? []; $values = $options['options'] ?? []; $id = $options['id'] ?? 'tabs_default'; // determine active tab $active_id = $id . '_active_hidden'; $active_tab = $options['active_tab'] ?? request::input($active_id); if (empty($active_tab)) { $active_tab = key($header); } $result = ''; $result .= '<div id="' . $id . '" class="' . ($options['class'] ?? '') . '">'; $result .= html::hidden(['name' => $active_id, 'id' => $active_id, 'value' => $active_tab]); $tabs = []; $panels = []; $class = $li_class = $id . '_tab_li'; foreach ($header as $k => $v) { $li_id = $id . '_tab_li_' . $k; $content_id = $id . '_tab_content_' . $k; $class2 = $class; if ($k == $active_tab) { $class2 .= ' active'; } if (!empty($options['tab_options'][$k]['hidden'])) { $class2 .= ' hidden'; } $tabindex = ''; if (!empty($options['tab_options'][$k]['tabindex'])) { $tabindex = ' tabindex="' . $options['tab_options'][$k]['tabindex'] . '" '; } $tabs[$k] = '<li id="' . $li_id . '" class="' . $class2 . '"' . $tabindex . ' role="presentation"><a href="#' . $content_id . '" tab-data-id="' . $k . '" aria-controls="' . $content_id . '" role="tab" data-toggle="tab">' . $v . '</a></li>'; $panels[$k] = '<div role="tabpanel" class="tab-pane ' . ($k == $active_tab ? 'active' : '') . ' ' . $k . '" id="' . $content_id . '">' . $values[$k] . '</div>'; } $result .= '<ul class="nav nav-tabs" role="tablist" id="' . $id . '_links' . '">'; $result .= implode('', $tabs); $result .= '</ul>'; $result .= '<div class="tab-content">'; $result .= implode('', $panels); $result .= '</div>'; $result .= '</div>'; $js = <<<TTT \t\t\t\$('#{$id}_links a').click(function(e) { \t\t\t\te.preventDefault(); \t\t\t\t\$(this).tab('show'); \t\t\t\t\$('#{$active_id}').val(\$(this).attr('tab-data-id')); \t\t\t}); \t\t\t\$('.{$li_class}').mousedown(function(e) { \t\t\t\tvar that = \$(this); \t\t\t\tif (!that.is(':focus')) { \t\t\t\t\tthat.data('mousedown', true); \t\t\t\t} \t\t\t}); \t\t\t\$('.{$li_class}').focus(function(e) { \t\t\t\te.preventDefault(); \t\t\t\tvar mousedown = \$(this).data('mousedown'), tabindex = parseInt(\$(this).attr('tabindex')); \t\t\t\t\$(this).removeData('mousedown'); \t\t\t\t\$(this).find('a:first').click(); \t\t\t\tif (!mousedown && tabindex > 0) { \t\t\t\t\t\$("[tabindex='" + (tabindex + 1) + "']").focus(); \t\t\t\t} else if (mousedown) { \t\t\t\t\t\$(this).blur(); \t\t\t\t} \t\t\t\te.preventDefault(); \t\t\t}); TTT; layout::onload($js); return $result; }
public function postCz(request $request) { $user = $request->user(); $charge_type_id = $request->input('charge_type_id'); $url = $request->input('url'); $order = Order::apiCreateCz($charge_type_id); if (is_object($order)) { $business = new Business(env('WECHAT_APPID'), env('WECHAT_APPSECRET'), env('WECHAT_MCHID'), env('WECHAT_KEY')); $wxorder = new WxOrder(); $wxorder->body = $order->odrno; $wxorder->out_trade_no = $order->odrno; $wxorder->total_fee = $order->final * 100; // 单位为 “分”, 字符串类型 $wxorder->openid = $user->user_open_id; $wxorder->notify_url = API_PAY_CALLBACK_URL; $unifiedOrder = new UnifiedOrder($business, $wxorder); $payment = new Payment($unifiedOrder); $res = redirect('/pay')->with(['payment' => $payment, 'order' => $order, 'wxorder' => $wxorder, 'url' => $url, 'type' => 'CZ']); } else { $res = redirect()->back()->with('msgError', $order); } return $res; }
public function action_edit() { $form = new numbers_backend_i18n_languages_model_form_languages(['input' => request::input()]); echo $form->render(); }
public function unpaid_report($semester_id, request $request) { $statistics = Student::select('name', 'username', 'email', 'mobile', 'gender', 'national_id')->where('state', 'active')->where('free_percent', 0)->whereNotIn('id', function ($query) { $query->select('student_id')->from('financial_invoices')->where('semester_id', 9)->where('type', 'credit'); })->whereIn('id', function ($query) { $query->select('student_id')->from('student_subjects')->where('semester_id', 9)->where('state', 'study')->distinct(); }); if ($request->has('name')) { $statistics->where('name', 'LIKE', "%" . $request->input('name') . '%'); } if ($request->has('code')) { $statistics->where('username', $request->input('code')); } $statistics = $statistics->orderBy('name', 'ASC')->get(); /* $statistics = DB::select(" SELECT name , username , email, mobile , gender , national_id from students where state = 'active' AND free_percent = 0 AND id not IN ( SELECT student_id from financial_invoices where semester_id = 9 and type = 'credit') AND id IN ( SELECT DISTINCT student_id from student_subjects where semester_id = 9 and state = 'study') "); */ return view('financials::reports.unpaid', compact('statistics')); }
/** * Sanitizes global GET, POST and COOKIE data. Also takes care of * magic_quotes and register_globals, if they have been enabled. * * @return void */ public function __construct() { // Use XSS clean? $this->use_xss_clean = (bool) Eight::config('core.global_xss_filtering'); if (self::$instance === nil) { // Convert all global variables to UTF-8. $_GET = Input::clean($_GET); $_POST = Input::clean($_POST); $_COOKIE = Input::clean($_COOKIE); $_SERVER = Input::clean($_SERVER); if (PHP_SAPI == 'cli') { // Convert command line arguments $_SERVER['argv'] = Input::clean($_SERVER['argv']); } // magic_quotes_runtime is enabled if (get_magic_quotes_runtime()) { exit('Disable magic_quotes_runtime! It is evil and deprecated: http://php.net/magic_quotes'); } // magic_quotes_gpc is enabled if (get_magic_quotes_gpc()) { exit('Disable magic_quotes_gpc! It is evil and deprecated: http://php.net/magic_quotes'); } // register_globals is enabled if (ini_get('register_globals')) { exit('Disable register_globals! It is evil and deprecated: http://php.net/register_globals'); } if (is_array($_GET)) { foreach ($_GET as $key => $val) { // Sanitize $_GET $_GET[$this->clean_input_keys($key)] = $this->clean_input_data($val); } } else { $_GET = array(); } if (is_array($_POST)) { foreach ($_POST as $key => $val) { // Sanitize $_POST $_POST[$this->clean_input_keys($key)] = $this->clean_input_data($val); } } else { $_POST = array(); } if (is_array($_COOKIE)) { foreach ($_COOKIE as $key => $val) { // Sanitize $_COOKIE $_COOKIE[$this->clean_input_keys($key)] = $this->clean_input_data($val); } } else { $_COOKIE = array(); } // Create a singleton self::$instance = $this; Eight::log('debug', 'Global GET, POST and COOKIE data sanitized'); } // Assign global vars to request helper vars request::$get = $_GET; request::$post = $_POST; request::$input = array_merge(URI::instance()->segments(2, YES), $_REQUEST); }
/** * Get an item from the input data. * * This method is used for all request verbs (GET, POST, PUT, and DELETE) * * @param string $key * @param mixed $default * @return mixed */ public static function get($key = null, $default = null) { return request::input($key, $default); }
public function action_edit() { $form = new numbers_backend_i18n_basic_model_form_missing(['input' => request::input()]); echo $form->render(); }
/** * Sanitizes global GET, POST and COOKIE data. Also takes care of * magic_quotes and register_globals, if they have been enabled. * * @return void */ public function __construct() { // Use XSS clean? $this->use_xss_clean = (bool) Eight::config('core.global_xss_filtering'); if (self::$instance === nil) { // Convert all global variables to UTF-8. $_GET = Input::clean($_GET); $_POST = Input::clean($_POST); $_COOKIE = Input::clean($_COOKIE); $_SERVER = Input::clean($_SERVER); if (PHP_SAPI == 'cli') { // Convert command line arguments $_SERVER['argv'] = Input::clean($_SERVER['argv']); } // magic_quotes_runtime is enabled if (get_magic_quotes_runtime()) { set_magic_quotes_runtime(0); Eight::log('debug', 'Disable magic_quotes_runtime! It is evil and deprecated: http://php.net/magic_quotes'); } // magic_quotes_gpc is enabled if (get_magic_quotes_gpc()) { $this->magic_quotes_gpc = YES; Eight::log('debug', 'Disable magic_quotes_gpc! It is evil and deprecated: http://php.net/magic_quotes'); } // register_globals is enabled if (ini_get('register_globals')) { if (isset($_REQUEST['GLOBALS'])) { // Prevent GLOBALS override attacks exit('Global variable overload attack.'); } // Destroy the REQUEST global $_REQUEST = array(); // These globals are standard and should not be removed $preserve = array('GLOBALS', '_REQUEST', '_GET', '_POST', '_FILES', '_COOKIE', '_SERVER', '_ENV', '_SESSION'); // This loop has the same effect as disabling register_globals foreach ($GLOBALS as $key => $val) { if (!in_array($key, $preserve)) { global ${$key}; ${$key} = nil; // Unset the global variable unset($GLOBALS[$key], ${$key}); } } // Warn the developer about register globals Eight::log('debug', 'Disable register_globals! It is evil and deprecated: http://php.net/register_globals'); } if (is_array($_GET)) { foreach ($_GET as $key => $val) { // Sanitize $_GET $_GET[$this->clean_input_keys($key)] = $this->clean_input_data($val); } } else { $_GET = array(); } if (is_array($_POST)) { foreach ($_POST as $key => $val) { // Sanitize $_POST $_POST[$this->clean_input_keys($key)] = $this->clean_input_data($val); } } else { $_POST = array(); } if (is_array($_COOKIE)) { foreach ($_COOKIE as $key => $val) { // Sanitize $_COOKIE $_COOKIE[$this->clean_input_keys($key)] = $this->clean_input_data($val); } } else { $_COOKIE = array(); } // Create a singleton self::$instance = $this; Eight::log('debug', 'Global GET, POST and COOKIE data sanitized'); } // Assign global vars to request helper vars request::$get = $_GET; request::$post = $_POST; request::$input = array_merge(URI::instance()->segments(2, YES), $_REQUEST); }
public function searchOffers(request $request) { $rules = array('latitude' => 'required', 'longitude' => 'required'); $Validator = $this->customValidator($request->all(), $rules, array()); if ($Validator->fails()) { return response()->json(['response_code' => 'ERR_RULES', 'messages' => $Validator->errors()->all()], 400); } if (!empty($request->input('veg'))) { $veg = ' AND store.veg = ' . $request->input('veg'); } else { $veg = ''; } $now = Carbon::now(); $keyword = $request->input('q'); $location = $request->only('latitude', 'longitude'); $user_id = Auth::user()->id; if (!empty($keyword)) { $offers = DB::select(DB::raw("select offers.*,store.store_name,store.logoUrl,store.landline,store.veg,store.cost_two,address.latitude,address.longitude,merchant.name, \n\t\t\t \t(select count(*) from offer_vote where offer_id = offers.id) as votes, \n\t\t\t \t(select count(*) from offer_vote where offer_id = offers.id AND user_id =" . $user_id . ") as hasUserVoted ,\n\t\t\t \t(select GROUP_CONCAT(tag_id SEPARATOR ',') FROM tag_store where store_id=offers.store_id GROUP BY store_id) as tags,\n\t\t\t \t(((acos(sin((" . $location['latitude'] . "*pi()/180)) * \n\t\t\t\t sin((`Latitude`*pi()/180))+cos((" . $location['latitude'] . "*pi()/180)) * \n\t\t\t\t cos((`Latitude`*pi()/180)) * cos(((" . $location['longitude'] . "- `Longitude`)* \n\t\t\t\t pi()/180))))*180/pi())*60*1.1515\n\t\t\t\t ) as distance \n\t\t\t \tfrom offers \n\t\t\t \tleft join merchant_store as store on store.id = offers.store_id \n\t\t\t \tleft join users as merchant on merchant.id = store.user_id \n\t\t\t \tleft join merchant_store_address as address on address.store_id = offers.store_id\n\t\t\t \twhere offers.status = 1 AND offers.deleted_at IS NULL " . $veg . " AND offers.startDate <= '" . $now . "' AND offers.endDate >= '" . $now . "' AND ( offers.title LIKE '%" . $keyword . "%' OR store.store_name LIKE '%" . $keyword . "%')\n\t\t\t \tORDER BY distance ASC;")); } else { return response()->json(['response_code' => 'RES_EQS', 'messages' => 'Empty Query String'], 400); } return response()->json(['response_code' => 'RES_OFF', 'messages' => 'Offers', 'data' => $offers]); }
public function sendOtp(request $request) { $user = Auth::user(); if ($request->input('mobile') == $user->mobile) { return response()->json(['response_code' => 'FAIL', 'message' => 'Please Enter New Mobile Number']); } $rules = array('mobile' => 'unique:users'); $validator = $this->customValidator($request->all(), $rules, array()); if ($validator->fails()) { return response()->json(['response_code' => 'FAIL', 'message' => 'Mobile Taken']); } $previousMobile = TempMobile::where('mobile', $request->input('mobile'))->first(); if ($previousMobile != '') { $previousMobile->delete(); } $otp = rand(100000, 999999); $sms = Curl::to('https://control.msg91.com/api/sendhttp.php?authkey=101670ALSycXxv0ZZX56920dcd&mobiles=' . $request->input('mobile') . '&message=Your%20Kaching%20OTP%20is%20' . $otp . '.%20Start%20dealing!&sender=KACHIN&route=4')->get(); $mobile = ['mobile' => $request->input('mobile')]; $tempMobile = TempMobile::create($mobile); $smsDb = ['mobile_id' => $tempMobile->id, 'code' => $otp, 'reference_id' => $sms]; $smsObj = UserSmsCode::create($smsDb); Session::set('smsId', $smsObj->id); return response()->json(['response_code' => 'PASS', 'message' => 'OTP Sent', 'dataValue' => Session::get('smsId')]); }
/** * Names action */ public function action_names() { $input = request::input(); // legend echo self::render_topic('names'); // code naming conventions echo html::a(['name' => 'code']); echo '<h3>Naming Conventions: Code</h3>'; echo object_name_code::explain(null, ['html' => true]); // testing form echo html::a(['name' => 'code_test']); echo '<h3>Test name</h3>'; if (!empty($input['submit_yes'])) { $result = object_name_code::check($input['type'] ?? null, $input['name'] ?? null); if (!$result['success']) { echo html::message(['options' => $result['error'], 'type' => 'danger']); } else { echo html::message(['options' => 'Name is good!', 'type' => 'success']); } } $ms = 'Name: ' . html::input(['name' => 'name', 'value' => $input['name'] ?? null]) . ' '; $ms .= 'Type: ' . html::select(['name' => 'type', 'options' => object_name_code::$types, 'value' => $input['type'] ?? null]) . ' '; $ms .= html::submit(['name' => 'submit_yes']); echo html::form(['name' => 'code', 'action' => '#code_test', 'value' => $ms]); // database naming convention echo '<br/><br/><hr/>'; echo html::a(['name' => 'db']); echo '<h3>Naming Conventions: Database</h3>'; echo object_name_db::explain(null, ['html' => true]); // testing form echo html::a(['name' => 'db_test']); echo '<h3>Test name</h3>'; if (!empty($input['submit_yes2'])) { $result = object_name_db::check($input['type2'] ?? null, $input['name2'] ?? null); if (!$result['success']) { echo html::message(['options' => $result['error'], 'type' => 'danger']); } else { echo html::message(['options' => 'Name is good!', 'type' => 'success']); } } $ms = 'Name: ' . html::input(['name' => 'name2', 'value' => $input['name2'] ?? null]) . ' '; $ms .= 'Type: ' . html::select(['name' => 'type2', 'options' => object_name_db::$types, 'value' => $input['type2'] ?? null]) . ' '; $ms .= html::submit(['name' => 'submit_yes2']); echo html::form(['name' => 'db', 'action' => '#db_test', 'value' => $ms]); }
public function action_index() { $steps = self::$steps; // error verification if (empty($steps)) { throw new Exception('No steps?'); } // building form first $input = request::input(); $ms = '<div class="form">'; $ms .= '<table width="100%" class="simple">'; if (sizeof($steps) > 1) { $ms .= '<tr><td width="1%">' . h::radio(array('name' => 'execute_step', 'class' => 'radio', 'value' => 'all', 'checked' => @$input['execute_step'] == 'all' ? true : false)) . '</td><td>All steps</td></tr>'; } foreach ($steps as $k => $v) { $ms .= '<tr><td width="1%">' . h::radio(array('name' => 'execute_step', 'class' => 'radio', 'value' => $k, 'checked' => @$input['execute_step'] == $k ? true : false)) . '</td><td>Step ' . $k . ' ' . $v['name'] . '</td></tr>'; // appending extra html if (!empty($v['html'])) { $ms .= '<tr><td width="1%"></td><td>' . $v['html'] . '</td></tr>'; } } $ms .= '</table>'; $ms .= '<br />'; $ms .= h::submit(array('name' => 'submit', 'class' => 'button yellow')); $ms .= '</div>'; $ms = h::form(array('name' => 'executioner', 'value' => $ms)); echo h::frame($ms, 'simple'); // executing steps if (!empty($input['execute_step'])) { $time_start = time(); //echo '<hr />'; foreach ($steps as $k => $v) { // double check if (!isset($v['execute'])) { throw new Exception('execute?'); } // executing if ($input['execute_step'] == 'all' || $input['execute_step'] == $k) { echo '<hr /><h4>Step [' . $k . '. ' . $v['name'] . ']: </h4>'; // redirecting request if set $params = array(); if (!empty($input['redirect_request'][$k])) { $params = $input['redirect_request'][$k]; } else { if (!empty($v['params'])) { $params = $v['params']; } } // we will be keeping alive alive::start(); $result2 = call_user_func_array($v['execute'], $params); alive::stop(); // processing result if (is_scalar($result2)) { echo $result2; } else { if (is_array($result2)) { if (@$result2['hint']) { layout::add_message($result2['hint'], 'info'); } if (@$result2['error']) { layout::add_message($result2['error'], 'error'); // important: we terminate batch echo 'Batch terminated due to error!'; break; } } } } } // time $time_end = time(); echo '<hr />'; echo '<b>Run time: ' . ($time_end - $time_start) . 'sec</b>'; } }
public function updateActivityPersonToken(request $request, $tokenId, $activityId, $persoonId) { try { // check token $valid = 0; if (!empty($tokenId)) { //check token $query = DB::table('tbl_token'); $query->select('token', 'type', 'valid_from', 'valid_untill', 'validated'); $query->where('token', '=', $tokenId); $result = $query->get(); $valid = 1; if (!empty($result)) { if ($result[0]->type == "PERIOD") { //Check periode $valid = 1; } elseif ($result[0]->type == "SINGLE") { $valid = 1; } else { $valid = 0; } } } if ($valid == 1) { // validate activityId $actPersStatus = $request->input('actPersonStatus'); // Get person id $data = DB::table('tbl_persoon')->select('persoon_id')->where('persoon_token', '=', $tokenId)->get(); DB::table('tbl_act_persoon')->where('persoon_id', $persoonId)->where('activiteit_ID', $activityId)->update(['act_Persoon_PersAanwezig' => $actPersStatus]); return response()->json(array("status" => "Succes")); } else { return response()->json(array("status" => "Succes", "data" => "Token not valid")); } } catch (Exception $e) { return response()->json(array("Status" => "Error", "data" => null, "Message" => $e->getMessage()), 412); } }
public function postStore(request $request) { $rules = array('store_name' => 'required|min:2|max:60', 'description' => 'required|min:10', 'tags' => 'required', 'cost_two' => 'required', 'landline' => 'required'); $Validator = $this->customValidator($request->all(), $rules, array()); if ($Validator->fails()) { return response()->json(['response_code' => 'ERR_RULES', 'messages' => $Validator->errors()->all()], 400); } $storeInput = $request->only('store_name', 'description', 'cost_two', 'landline'); if ($request->has('veg')) { $storeInput['veg'] = $request->input('veg'); } $storeInput['user_id'] = Auth::id(); $tags = $request->only('tags'); $tagStore = explode(',', $tags['tags']); $store = MerchantStore::create($storeInput); if ($request->hasFile('logo')) { $image = $request->file('logo'); $imageName = strtotime(Carbon::now()) . md5($store->id) . '.' . $image->getClientOriginalExtension(); $path = public_path('assets/img/stores/' . $imageName); Image::make($image->getRealPath())->resize(280, null, function ($constraint) { $constraint->aspectRatio(); })->save($path); $store->logoUrl = $imageName; } $store->status = true; //commet it when required $store->save(); $store->tags()->attach($tagStore); return response()->json(['response_code' => 'RES_SC', 'messages' => 'Store Created', 'data' => $store], 201); }
public function editSuperMerchant(request $request) { $validator = Validator::make($request->all(), ['superMerchant' => 'required', 'childMerchants' => 'required']); if ($validator->fails()) { return redirect('admin/addSuperMerchant')->withErrors($validator); } $childs = explode(',', $request->input('childMerchants')); foreach (array_keys($childs, $request->input('superMerchant')) as $key) { unset($childs[$key]); } /*$old_parent_id = $request->input('parent_id'); /// first reset all previously added parent and child linking MerchantStore::where('id',$old_parent_id)->orWhere('parent_id',$old_parent_id)->update(['is_parent'=> false , 'is_child' => false , 'parent_id' => '0']);*/ $superMerchant = MerchantStore::find($request->input('superMerchant')); // if(!$superMerchant->is_parent){ // $superMerchant->is_parent = true; // $superMerchant->save(); // } // else{ // return redirect('admin/addSuperMerchant') // ->with('message','Super Merchant Selected already used as Super Merchant'); // } $message = ''; foreach ($childs as $value) { $childMerchant = MerchantStore::find($value); if (!$childMerchant->is_child) { $childMerchant->is_child = true; $childMerchant->parent_id = $superMerchant->id; $childMerchant->save(); } else { $message .= $childMerchant->store_name . ','; } unset($childMercahnt); } if (!empty($message)) { $message = 'Given Child Merchants ' . $message . ' cannot be added as child for the give super merchant.' . $superMerchant->store_name; return redirect('admin/addSuperMerchant')->with('message', $message); } return redirect('admin/superMerchants'); }
public function getLinkedStoreOffers(request $request) { $rules = array('store_token' => 'required'); $Validator = $this->customValidator($request->all(), $rules, array()); if ($Validator->fails()) { return response()->json(['response_code' => 'ERR_RULES', 'messages' => $Validator->errors()->all()], 400); } $store_id = Crypt::decrypt($request->input('store_token')); if (!$this->checkUserHasStorePermission($store_id)) { return response()->json(['response_code' => 'ERR_UNA', 'messages' => 'User Not Authorized'], 403); } return response()->json(['response_code' => 'RES_OFF', 'messages' => 'Offers', 'data' => Offers::with('votesCount', 'Store.Address.Area')->where('store_id', $store_id)->get()]); }