public function record()
 {
     if (\Request::hasFile('image') && \Request::file('image')->isValid() && \Auth::user()->suspend == false) {
         $file = \Request::file('image');
         $input = \Request::all();
         $date = new \DateTime();
         if (isset($input['anon'])) {
             $name = 'anon';
         } else {
             $name = \Auth::user()->name;
         }
         $validator = \Validator::make(array('image' => $file, 'category' => $input['category'], 'title' => $input['title'], 'caption' => $input['caption']), array('image' => 'required|max:1200|mimes:jpeg,jpg,gif', 'category' => 'required', 'title' => 'required|max:120', 'caption' => 'required|max:360'));
         if ($validator->fails()) {
             return redirect('/publish')->withErrors($validator);
         } else {
             $unique = str_random(10);
             $fileName = $unique;
             $destinationPath = 'database/pictures/stream_' . $input['category'] . '/';
             \Request::file('image')->move($destinationPath, $fileName);
             \DB::insert('insert into public.moderation (p_cat, p_ouser, p_title, p_caption, p_imgurl, p_status, p_reported, p_rating, created_at, updated_at) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', [$input['category'], $name, $input['title'], $input['caption'], $unique, 'available', 0, 0, $date, $date]);
             $messages = 'Your content has been succesfully submitted. Going on moderation process.';
             return redirect('/system/notification')->with('messages', $messages);
         }
     } else {
         $messages = 'Your content data is invalid. The process is aborted.';
         return redirect('/system/notification')->with('messages', $messages);
     }
 }
Exemplo n.º 2
0
 public function SubmitScoreFinal(Requests\ScoreEntryFinalRequest $request)
 {
     $input = $request->all();
     \DB::$user = '******';
     \DB::$password = '******';
     \DB::$dbName = 'Euro2016';
     $row = \DB::queryFirstRow("select * from Scores where MatchID = %i and UserID = %i", $request->matchid, Auth::user()->id);
     $count = \DB::count();
     //Log::info($count.' '.$request->matchid);
     \DB::startTransaction();
     if ($count == 0) {
         \DB::insert('Scores', array('MatchID' => $request->matchid, 'UserID' => Auth::user()->id, 'CountryHome' => $request->CountryHomeScore, 'CountryAway' => $request->CountryAwayScore));
     } else {
         \DB::update('Scores', array('CountryHome' => $request->CountryHomeScore, 'CountryAway' => $request->CountryAwayScore), "ID=%i", $row['ID']);
     }
     $affectedcount = \DB::affectedRows();
     \DB::update('Matches', array('CountryHomeID' => $request->CountryHomeID, 'CountryAwayID' => $request->CountryAwayID), "MatchID=%i", $request->matchid);
     \DB::commit();
     \DB::disconnect();
     // retrieve country names and flag
     $countrynamehome = \DB::queryFirstRow("select CountryName, Flag from Countries where CountryID = %i", $request->CountryHomeID);
     $countrynameaway = \DB::queryFirstRow("select CountryName, Flag from Countries where CountryID = %i", $request->CountryAwayID);
     $input['CountryHomeID'] = $countrynamehome['CountryName'];
     $input['CountryAwayID'] = $countrynameaway['CountryName'];
     $input['CountryHomeImage'] = $countrynamehome['Flag'];
     $input['CountryAwayImage'] = $countrynameaway['Flag'];
     //$input['CountryHID'] = $request->CountryHomeID;
     //$input['CountryAID'] = $request->CountryAwayID;
     return json_encode($input);
 }
 public function getSensor()
 {
     $id = $_SERVER['REMOTE_ADDR'];
     if (\DB::select('select 1 from module_vanguard where id = ?', [$id])) {
         if (\DB::select('select 1 from app_status where validity = true and sensor_register = true')) {
             $results = \DB::select('select * from module_vanguard where id = ?', [$id]);
             foreach ($results as $result) {
                 $alias = $result->alias;
                 $status = $result->status;
             }
             $timestamp = new \DateTime();
             if ($status == 'active') {
                 $must_report = true;
             }
             if ($status == 'passive') {
                 $must_report = false;
             }
             $is_reported = false;
             \DB::insert('insert into vanguard_log values (?, ?, ?, ?, ?)', [$id, $alias, $must_report, $is_reported, $timestamp]);
             //open to adjustment.
             exec("nodejs /var/www/topsus/nodejs/telegram_check.js");
             return 'OK';
         } else {
             return 'NOT OK - APPLICATION IS NOT LISTENING';
         }
     } else {
         return 'NOT OK - SENSOR IS INVALID';
     }
 }
 public function access_2()
 {
     $date = new \DateTime();
     $read = false;
     $value = \Request::input('value');
     $client = \Request::input('client');
     \DB::insert('insert into public.arduino (v_val, v_cli, v_read, created_at, updated_at) values (?, ?, ?, ?, ?)', [$value, $client, $read, $date, $date]);
     return 'This is X553M Server, your value is: ' . $value . ', From client: ' . $client;
 }
Exemplo n.º 5
0
 public function submitEditRequest()
 {
     $request = \App::make('request');
     $request['store-id'] = '1';
     $request['key'] = 'sub-category';
     $request['value'] = 'swimming';
     $request['action'] = 'insert';
     \DB::insert("INSERT INTO `store_edit_requests` (`id`, `store_id`, `key`, `value`, `action`, `approved`, `created_at`, `updated_at`) VALUES (NULL, ?, ?, ?, ?, '', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)", [$request['store-id'], $request['key'], $request['value'], $request['action']]);
 }
Exemplo n.º 6
0
 public function insert_robi_ticket()
 {
     date_default_timezone_set('Asia/Dhaka');
     $escalation_time = date('Y/m/d h:i:s a', time());
     //secho $date;
     $client_id = $_SESSION['TICKET_USER_CLIENT_ID'];
     $client_type = $_SESSION['TICKET_USER_CLIENT_TYPE'];
     // $client_priority = Request::get('client_priority');
     // $link_type = Request::get('link_type');
     $problem_category = Request::get('problem_category');
     $problem_source = Request::get('problem_source');
     // $region = Request::get('region');
     $district = Request::get('district');
     // $reason = Request::get('reason');
     $event_time = Request::get('event_time');
     $link_name = Request::get('link_name');
     $client_impact = Request::get('client_impact');
     $client_site_count = Request::get('client_site_count');
     // $vendor_site_count = Request::get('vendor_site_count');
     // $vendor_impact = Request::get('vendor_impact');
     $remarks = Request::get('remarks');
     // $ticket_status = Request::get('ticket_status');
     // $responsible_vendor = Request::get('responsible_vendor');
     // $responsible_concern = Request::get('responsible_concern');
     // $responsible_field_team = Request::get('responsible_field_team');
     $query_insert_robi_ticket = "INSERT INTO ticket_table (client_id,client_type,client_priority,link_type,problem_category,problem_source,region,district,reason,event_time,escalation_time,link_name,client_impact,client_site_count,vendor_site_count, vendor_impact, remarks,ticket_status,responsible_vendor,responsible_concern,responsible_field_team,attachment_path) values ('" . $client_id . "','" . $client_type . "','NULL','NULL','" . $problem_category . "','" . $problem_source . "','NULL','" . $district . "','NULL','" . $event_time . "','" . $escalation_time . "','" . $link_name . "','" . $client_impact . "','" . $client_site_count . "','NULL','NULL','" . $remarks . "','open','NULL','NULL','NULL','NULL');";
     \DB::insert(\DB::raw($query_insert_robi_ticket));
     $result_list = \DB::select(\DB::raw("SELECT ticket_table_row_id FROM ticket_table ORDER BY ticket_table_row_id DESC limit 1"));
     foreach ($result_list as $result) {
         $ticket_table_row_id = $result->ticket_table_row_id;
     }
     if (Input::hasFile('attachment_path')) {
         // $path_test = '../Uploaded_Files/'.$ticket_table_row_id;
         // if(File::exists($path_test))
         // {
         //     File::delete($path_test);
         // }
         $dirPath = '../Uploaded_Files/';
         $files = Input::file('attachment_path');
         foreach ($files as $file) {
             // $filename = "test.txt";
             // $file->move($dirPath,$filename);
             $filename = $file->getClientOriginalName();
             $file->move($dirPath, $filename);
         }
     }
     $attachment_path = 'uploaded_files/' . $ticket_table_row_id;
     $ticket_update_querystring = "UPDATE ticket_table SET attachment_path='" . $attachment_path . "',ticket_id='" . $ticket_table_row_id . "' WHERE ticket_table_row_id='" . $ticket_table_row_id . "'";
     \DB::update(\DB::raw($ticket_update_querystring));
 }
Exemplo n.º 7
0
 public function incrementVisitorCount(Request $request)
 {
     $username = $request->username;
     $visitorUsername = $request->visitorusername;
     //return $username;
     try {
         if ($result = \DB::insert(\DB::raw("INSERT INTO  ProfileVisitor(prousername,visusername)\n              VALUES ('" . $username . "','" . $visitorUsername . "') "))) {
             return response()->json(['status' => 200], 200);
         } else {
             return response()->json(['status' => 505], 505);
         }
     } catch (Illuminate\Database\QueryException $e) {
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param CreateGroupRequest $request
  * @return Response
  */
 public function store(CreateGroupRequest $request)
 {
     $input = $request->all();
     $group = new Group();
     $group->name = $input['name'];
     $group->founderId = Auth::id();
     \DB::insert('INSERT INTO conversations VALUE ()');
     $conversationId = \DB::select('SELECT id FROM conversations ORDER BY id DESC LIMIT 1')[0]->id;
     $group->conversationId = $conversationId;
     $group->private = $request->type == "private" ? true : false;
     storeGroup($group);
     $mygroup = loadGroup($group->name)[0];
     addMemberToGroup($mygroup->founderId, $mygroup->id);
     return redirect('groups/' . $mygroup->id);
 }
Exemplo n.º 9
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response|null
  */
 public function store(Request $request)
 {
     /**
      * @var $user \App\User
      */
     $user = \Auth::user();
     if (!$user) {
         return null;
     }
     $product_id = $request->get('product_id');
     $product_model = \App\Models\Product::findOrFail($product_id);
     $sql = 'INSERT IGNORE INTO ' . \App\Models\OrderedProduct::TABLE . ' (created_at, user_id, product_id, catalog_id, is_deferred) ' . 'VALUES (now(), ?, ?, ?, 1)';
     \DB::insert($sql, [$user->id, $product_id, $product_model->catalog_id]);
     return ['calls' => [['call' => 'updateHtmlContext', 'params' => ['#product-mini-item-' . $product_id, view('catalog.product_mini_item', ['product' => $product_model])->render()]], ['call' => 'updateHtmlContext', 'params' => ['#basket-mini-box', view('basket.mini_box')->render()]], ['call' => 'updateHtmlContext', 'params' => ['#basket-orders-container', view('basket.orders_items')->render()]]]];
 }
Exemplo n.º 10
0
 public function SubmitScore(Requests\ScoreEntryRequest $request)
 {
     $input = $request->all();
     \DB::$user = '******';
     \DB::$password = '******';
     \DB::$dbName = 'Euro2016';
     $row = \DB::queryFirstRow("select * from Scores where MatchID = %i and UserID = %i", $request->matchid, Auth::user()->id);
     $count = \DB::count();
     if ($count == 0) {
         \DB::insert('Scores', array('MatchID' => $request->matchid, 'UserID' => Auth::user()->id, 'CountryHome' => $request->CountryHomeScore, 'CountryAway' => $request->CountryAwayScore));
     } else {
         \DB::update('Scores', array('CountryHome' => $request->CountryHomeScore, 'CountryAway' => $request->CountryAwayScore), "ID=%i", $row['ID']);
     }
     \DB::disconnect();
     return json_encode($input);
 }
Exemplo n.º 11
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response|null
  */
 public function store(Request $request)
 {
     /**
      * @var $user \App\User
      */
     $user = \Auth::user();
     if (!$user) {
         return null;
     }
     $product_id = $request->get('product_id');
     $product_model = \App\Models\Product::findOrFail($product_id);
     $sql = 'INSERT INTO ' . \App\Models\OrderedProduct::TABLE . ' (created_at, user_id, product_id, catalog_id, price, quantity) ' . 'VALUES (now(), ?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE quantity = quantity + ?, updated_at = now()';
     $public_price = $product_model->getPublicPrice();
     $quantity = $request->get('quantity');
     \DB::insert($sql, [$user->id, $product_id, $product_model->catalog_id, $public_price, $quantity, $quantity]);
     return ['calls' => [['call' => 'updateHtmlContext', 'params' => ['#product-mini-item-' . $product_id, view('catalog.product_mini_item', ['product' => $product_model])->render()]], ['call' => 'updateHtmlContext', 'params' => ['#basket-mini-box', view('basket.mini_box')->render()]], ['call' => 'updateHtmlContext', 'params' => ['#basket-orders-container', view('basket.orders_items')->render()]]]];
 }
Exemplo n.º 12
0
 public function Addcontactus()
 {
     //getting values of php form text boxes
     $name = $this->request->input('name');
     $email = $this->request->input('email');
     $phone = $this->request->input('phone');
     $services = $this->request->input('service');
     $subject = $this->request->input('subject');
     $message = $this->request->input('message');
     //return $this->request;
     try {
         $eventCatlist = \DB::select('select * from event_types');
         \DB::insert('insert into contactus (name, email, phone,service,subject,message) values (?, ?, ?, ?,?,?)', [$name, $email, $phone, $services, $subject, $message]);
     } catch (\Illuminate\Database\QueryException $e) {
         return view('website.contact')->with('message', 'Error occured while inserting data to the database')->with('type', 'error')->with('title', 'Error')->with('eventCatlist', $eventCatlist);
     }
     return view('website.contact')->with('message', 'Message Sent Successfully!')->with('type', 'success')->with('title', 'Message Sent Successfully!')->with('eventCatlist', $eventCatlist);
 }
 function postCopy(Request $request)
 {
     foreach (\DB::select("SHOW COLUMNS FROM tb_weight_pricing ") as $column) {
         if ($column->Field != 'id') {
             $columns[] = $column->Field;
         }
     }
     $toCopy = implode(",", $request->input('id'));
     $sql = "INSERT INTO tb_weight_pricing (" . implode(",", $columns) . ") ";
     $sql .= " SELECT " . implode(",", $columns) . " FROM tb_weight_pricing WHERE id IN (" . $toCopy . ")";
     \DB::insert($sql);
     return response()->json(array('status' => 'success', 'message' => \Lang::get('core.note_success')));
 }
Exemplo n.º 14
0
 public function postMultiupdate(Request $request)
 {
     if ($this->access['is_add'] == 0) {
         return response()->json(array('status' => 'error', 'message' => \Lang::get('core.note_restric')));
         die;
     }
     // update status rows
     if (count($request->input('ids')) >= 1) {
         $ids = $request->input('ids');
         $data['status'] = 1;
         foreach ($ids as $value) {
             \DB::table('attendence_import_t')->where('import_id', $value)->update($data);
         }
         ///insertinto to another tanbel
         $sql = "INSERT INTO attendence_t  (attendence_id, employee_id, period_id, entry_date, entry_time, include_payroll, onduty) SELECT attendence_id, employee_id, period_id, date, time, includepayroll, onduty FROM attendance_importtoentry_v WHERE 1=1";
         \DB::insert($sql);
         return response()->json(array('status' => 'success', 'message' => 'Approved Successfully'));
     } else {
         return response()->json(array('status' => 'error', 'message' => \Lang::get('core.note_error')));
     }
 }
Exemplo n.º 15
0
 public function postAdd()
 {
     $input = \Request::all();
     if ($input['type'] == 'Vanguard') {
         if (\DB::select('select 1 from module_vanguard where id = ?', [$input['id']])) {
             $messages = 'Duplication, Sensor is Not Added.';
             return redirect('/add')->with('messages', $messages);
         } else {
             \DB::insert('insert into module_vanguard values (?, ?, ?)', [$input['id'], $input['alias'], 'passive']);
             $messages = 'A Sensor is Added.';
             return redirect('/add')->with('messages', $messages);
         }
     } else {
         $messages = 'A Sensor Type is Not Valid.';
         return redirect('/add')->with('messages', $messages);
     }
 }
Exemplo n.º 16
0
 public function applicationRecord()
 {
     if (\Auth::user()->admin == true) {
         $name = \Auth::user()->name;
         $input = \Request::all();
         $date = new \DateTime();
         // No validation for Admins
         \DB::table('public.app_info')->where('validity', true)->update(['app_version' => $input['app_version'], 'app_info' => $input['app_info'], 'app_domain' => $input['app_domain'], 'app_email' => $input['app_email'], 'app_terms' => $input['app_terms'], 'app_agree' => $input['app_agree'], 'app_policy' => $input['app_policy'], 'app_notification' => $input['app_notification'], 'updated_at' => $date]);
         $action = 'Submitting from Application Information State form. Probably changed.';
         \DB::insert('insert into log_application (p_admin, p_action, created_at, updated_at) values (?, ?, ?, ?)', [$name, $action, $date, $date]);
         $messages = 'Application Informatin State successfully changed.';
         return redirect('/admin/application')->with('messages', $messages);
     } else {
         $messages = 'You are not an admin. No rights to access administration area.';
         return redirect('/system/notification')->with('messages', $messages);
     }
 }
 public function postSetfav()
 {
     $id = \Auth::user()->id;
     $actNo = \Input::get('actNo');
     for ($i = 1; $i <= $actNo; $i++) {
         $act_name = \Input::get('act' . $i);
         $act_type = \Input::get('act_type' . $i);
         if ($act_type == 'lecture') {
             $act_type = 'lec';
         } else {
             $act_type = 'lab';
         }
         $query = \DB::table('set_activities')->where('users_id', $id)->where('name', $act_name)->where('type', $act_type)->get();
         $checker = json_decode(json_encode($query), true);
         if ($checker == null) {
             \DB::insert('insert into set_activities (users_id, name, type) values (?, ?, ?)', array($id, $act_name, $act_type));
         }
     }
     return \Redirect::to('instructor');
 }