Пример #1
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $token = Input::get('token', '');
     if ($token != '') {
         $compare = GlobalLibrary::compareToken($token);
         if ($compare) {
             $ttl = Input::get('ttl', '');
             $hea = Input::get('hea', '');
             $det = Input::get('det', '');
             $med = Input::get('med', '');
             $upl = Input::get('upl', '');
             $las = Input::get('las', '');
             $ins = Input::get('ins', '');
             $upd = Input::get('upd', '');
             $exp = Input::get('exp', '');
             $pub = Input::get('pub', '');
             $cat = Input::get('cat', '');
             $rep = Input::get('rep', '');
             $field_user_detail = array('content_title' => $ttl, 'content_headline' => $hea, 'content_detail' => $det, 'content_media_id' => $med, 'content_users_uploader' => $upl, 'content_last_editor' => $las, 'content_date_insert' => $ins, 'content_date_update' => $upd, 'content_date_expired' => $exp, 'content_publish' => $pub, 'content_category_id' => $cat, 'content_repost_from' => $rep);
             $user = table_content::create($field_user_detail);
             return (new Response(array('status' => true, 'msg' => 'Register successfully'), 200))->header('Content-Type', "json");
         } else {
             return (new Response(array('status' => false, 'msg' => 'Authentication Failed'), 200))->header('Content-Type', "json");
         }
     } else {
         return (new Response(array('status' => false, 'msg' => 'Authentication Failed'), 200))->header('Content-Type', "json");
     }
 }
Пример #2
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function findAll()
 {
     $token = Input::get('token', '');
     if ($token != '') {
         $compare = GlobalLibrary::compareToken($token);
         if ($compare) {
             $dataAll = table_content::get();
             $dataConverted = array();
             $app = app();
             $i = 0;
             foreach ($dataAll as $row) {
                 $dataConverted[$i] = $app->make('stdClass');
                 $dataConverted[$i]->id = $row->content_id;
                 $dataConverted[$i]->ttl = $row->content_title;
                 $dataConverted[$i]->det = $row->content_detail;
                 $dataConverted[$i]->med = $row->content_media_id;
                 $dataConverted[$i]->upl = $row->content_users_uploader;
                 $dataConverted[$i]->las = $row->content_last_editor;
                 $dataConverted[$i]->ins = $row->content_date_insert;
                 $dataConverted[$i]->upd = $row->content_date_update;
                 $dataConverted[$i]->exp = $row->content_date_expired;
                 $dataConverted[$i]->pub = $row->content_publish;
                 $dataConverted[$i]->cat = $row->content_category_id;
                 $dataConverted[$i]->rep = $row->content_repost_from;
                 $i++;
             }
             return (new Response(array('status' => true, 'data' => $dataConverted), 200))->header('Content-Type', "json");
         } else {
             return (new Response(array('status' => false, 'msg' => 'Authentication Failed'), 200))->header('Content-Type', "json");
         }
     } else {
         return (new Response(array('status' => false, 'msg' => 'Authentication Failed'), 200))->header('Content-Type', "json");
     }
 }
Пример #3
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //$token = Input::post('token');
     if (Request::has('token')) {
         $token = Request::input('token');
         $compare = GlobalLibrary::compareToken($token);
         if ($compare) {
             $fullname = Request::input('f');
             $username = Request::input('u');
             $phone = Request::input('pn');
             $email = Request::input('e');
             $password = Request::input('pwd');
             $roles = Request::input('r');
             $field_users = array('name' => $username, 'email' => $email, 'password' => bcrypt($password));
             $count_users = User::where('email', '=', $email)->count();
             if ($count_users <= 0) {
                 $user = User::create($field_users);
                 $user_login = User::where('email', '=', $email)->first();
                 foreach ($user_login as $key => $value) {
                     $id = $user_login->id;
                 }
                 $field_user_detail = array('users_id' => $id, 'users_name' => $username, 'users_fullname' => $fullname, 'users_group_id' => $roles, 'users_email' => $email, 'users_status_id' => '1');
                 $user = table_users_detail::create($field_user_detail);
                 return (new Response(array('status' => true, 'msg' => 'Register successfully'), 200))->header('Content-Type', "json");
             } else {
                 return (new Response(array('status' => false, 'msg' => 'Email already registered'), 200))->header('Content-Type', "json");
             }
         } else {
             return (new Response(array('status' => false, 'msg' => 'Authentication Failed 2'), 200))->header('Content-Type', "json");
         }
     } else {
         return (new Response(array('status' => false, 'msg' => 'Authentication Failed 1'), 200))->header('Content-Type', "json");
     }
 }
Пример #4
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function findAll()
 {
     $token = Input::get('token', '');
     if ($token != '') {
         $compare = GlobalLibrary::compareToken($token);
         if ($compare) {
             $dataAll = table_users_group::where('users_group_is_public', '=', 1)->get();
             $dataConverted = array();
             $app = app();
             $i = 0;
             foreach ($dataAll as $row) {
                 $dataConverted[$i] = $app->make('stdClass');
                 $dataConverted[$i]->i = $row->users_group_id;
                 $dataConverted[$i]->t = $row->users_group_name;
                 $dataConverted[$i]->d = $row->users_group_description;
                 $i++;
             }
             return (new Response(array('status' => true, 'data' => $dataConverted), 200))->header('Content-Type', "json");
         } else {
             return (new Response(array('status' => false, 'msg' => 'Authentication Failed'), 200))->header('Content-Type', "json");
         }
     } else {
         return (new Response(array('status' => false, 'msg' => 'Authentication Failed'), 200))->header('Content-Type', "json");
     }
 }
Пример #5
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     if (Request::has('token')) {
         $token = Request::input('token', '');
         $compare = GlobalLibrary::compareToken($token);
         if ($compare) {
             $this->middleware('guest', ['except' => 'getLogout']);
             $email = Request::input('u', '');
             $password = Request::input('pwd', '');
             if (Auth::attempt(array('email' => $email, 'password' => $password))) {
                 $users_detail = table_users_detail::where('users_email', '=', $email)->first();
                 $users_default = User::where('email', '=', $email)->first();
                 $status = $users_detail->users_status_id;
                 if ($status == "2") {
                     //return (new Response(array('status' => true,'msg' => 'You are Logged in'),200))->header('Content-Type', "json");
                     $field_users = array();
                     $field_users['id'] = $users_default->id;
                     $field_users['ids'] = $users_detail->users_detail_id;
                     $field_users['users_name'] = $users_detail->users_name;
                     $field_users['users_email'] = $email;
                     $field_users['users_group_id'] = $users_detail->users_group_id;
                     $field_users['users_fullname'] = $users_detail->users_fullname;
                     $field_users = (object) $field_users;
                     $token = GlobalLibrary::tokenGenerator($field_users);
                     $js = array();
                     $js = (object) $js;
                     $js->i = $users_detail->users_detail_id;
                     $js->n = $users_detail->users_name;
                     $js->fu = $users_detail->users_fullname;
                     $js->d = $users_detail->users_description;
                     $js->ugid = $users_detail->users_group_id;
                     $js->token = $token;
                     return (new Response(array('status' => true, 'msg' => 'You are Logged in', 'data' => $js), 200))->header('Content-Type', "json");
                 } else {
                     return (new Response(array('status' => true, 'msg' => 'You are still pending verification'), 200))->header('Content-Type', "json");
                 }
             } else {
                 return (new Response(array('status' => false, 'msg' => 'Authentication Failed '), 200))->header('Content-Type', "json");
             }
         } else {
             return (new Response(array('status' => false, 'msg' => 'Authentication Failed2'), 200))->header('Content-Type', "json");
         }
     } else {
         return (new Response(array('status' => false, 'msg' => 'Authentication Failed1'), 200))->header('Content-Type', "json");
     }
 }
Пример #6
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $token = Input::get('token', '');
     if ($token != '') {
         $compare = GlobalLibrary::compareToken($token);
         if ($compare) {
             $users_by = Input::get('ub', '');
             $content_id = Input::get('ci', '');
             $users_dest = Input::get('ud', '');
             $banned_report_message = Input::get('brm', '');
             $banned_report = array('users_by' => $users_by, 'content_id' => $content_id, 'users_dest' => $users_dest, 'banned_report_message' => $banned_report_message);
             $bannedreport = table_banned_report::create($banned_report);
             return (new Response(array('status' => true, 'msg' => 'Report successfully'), 200))->header('Content-Type', "json");
         } else {
             return (new Response(array('status' => false, 'msg' => 'Report Failed'), 200))->header('Content-Type', "json");
         }
     } else {
         return (new Response(array('status' => false, 'msg' => 'Report Failed'), 200))->header('Content-Type', "json");
     }
 }
Пример #7
0
 public function save_edit()
 {
     $app = app();
     if (Request::has('token')) {
         $token = Request::input('token', '');
         $compare = GlobalLibrary::tokenExtractor($token);
         $users_checker = GlobalLibrary::CheckUsersToken($compare);
         //echo '<pre>'.print_r($compare).'</pre>';
         if ($users_checker[0]) {
             $uid = $users_checker[2];
             $email = $users_checker[3];
             $field_data = array('users_telp' => Request::input('ph'), 'users_description' => Request::input('d'), 'users_fullname' => Request::input('fu'), 'long' => Request::input('long'), 'lat' => Request::input('lat'), 'providerID' => Request::input('provider'), 'deviceVersion' => Request::input('devVersion'), 'deviceBrand' => Request::input('devBrand'), 'deviceID' => Request::input('devID'));
             $data = table_users_detail::find($uid);
             $data->update($field_data);
             return (new Response(array('status' => true, 'msg' => 'Update Profile Success'), 200))->header('Content-Type', "json");
         } else {
             return (new Response(array('status' => false, 'msg' => 'Authentication Failed2'), 200))->header('Content-Type', "json");
         }
     } else {
         return (new Response(array('status' => false, 'msg' => 'Authentication Failed'), 200))->header('Content-Type', "json");
     }
 }
Пример #8
0
 public function input()
 {
     $app = app();
     if (Request::has('token')) {
         $token = Request::input('token', '');
         $compare = GlobalLibrary::tokenExtractor($token);
         $users_checker = GlobalLibrary::CheckUsersToken($compare);
         //echo '<pre>'.print_r($compare).'</pre>';
         if ($users_checker[0]) {
             $uname = $users_checker[1];
             $uid = $users_checker[2];
             $email = $users_checker[3];
             $field_user_detail = array('schedule_title' => Request::input('ttl'), 'schedule_type_id' => Request::input('typ'), 'schedule_users_creator' => $uid, 'schedule_users_source' => Request::input('usc'), 'schedule_date_start' => Request::input('dst'), 'schedule_date_end' => Request::input('dnd'), 'schedule_description' => Request::input('des'), 'schedule_headline' => Request::input('hed'), 'schedule_media_id' => Request::input('med'), 'schedule_publish' => Request::input('pub'), 'schedule_repeat' => Request::input('rpt'));
             $schedule = table_schedule::create($field_user_detail);
             return (new Response(array('status' => true, 'msg' => 'success'), 200))->header('content-Type', "json");
         } else {
             return (new Response(array('status' => false, 'msg' => 'Authentication Failed2'), 200))->header('content-Type', "json");
         }
     } else {
         return (new Response(array('status' => false, 'msg' => 'Authentication Failed1'), 200))->header('content-Type', "json");
     }
 }
Пример #9
0
 public function post_request_follower()
 {
     $app = app();
     if (Request::has('token')) {
         $token = Request::input('token', '');
         $compare = GlobalLibrary::tokenExtractor($token);
         $users_checker = GlobalLibrary::CheckUsersToken($compare);
         if ($users_checker[0]) {
             $uname = $users_checker[1];
             $uid = $users_checker[2];
             $email = $users_checker[3];
             $followingid = Request::input('fol', '');
             $follow_requesting = table_request_follow::where('users_id', $uid)->first();
             if ($follow_requesting == null) {
                 $field = array('users_id' => $uid, 'json_request_follow' => $fol . ',');
                 $user = table_request_follow::create($field);
             } else {
                 $field = array('json_request_follow' => $follow_requesting->json_request_follow . $fol . ',');
                 $data2 = table_request_follow::find($uid);
                 $data2->update($field);
             }
             return (new Response(array('status' => true, 'msg' => 'success, request sent'), 200))->header('Content-Type', "json");
         } else {
             return (new Response(array('status' => false, 'msg' => 'Authentication Failed2'), 200))->header('Content-Type', "json");
         }
     } else {
         return (new Response(array('status' => false, 'msg' => 'Authentication Failed1'), 200))->header('Content-Type', "json");
     }
 }
Пример #10
0
 public function repost()
 {
     $app = app();
     if (Request::has('token')) {
         $token = Request::input('token', '');
         $compare = GlobalLibrary::tokenExtractor($token);
         $users_checker = GlobalLibrary::CheckUsersToken($compare);
         //echo '<pre>'.print_r($compare).'</pre>';
         if ($users_checker[0]) {
             $uname = $users_checker[1];
             $uid = $users_checker[2];
             $email = $users_checker[3];
             if (Request::input('cid') == null) {
                 return (new Response(array('status' => true, 'msg' => 'Please select a content that you want to repost '), 200))->header('content-Type', "json");
             } else {
                 //get content resource
                 $target = table_content::where('content_id', '=', Request::input('cid'))->first();
                 //input content
                 $field_content = array('content_title' => $target->content_title, 'content_headline' => $target->headline, 'content_detail' => $target->content_detail, 'content_media_id' => $target->content_media_id, 'content_users_uploader' => $uid, 'content_last_editor' => $target->content_last_editor, 'content_date_insert' => date('Y-m-d H:i:s'), 'content_date_expired' => $target->content_date_expired, 'content_publish' => $target->content_publish, 'content_category_id' => $target->content_category_id, 'content_hashtag_id' => $target->content_hashtag_id, 'content_repost_from' => $target->content_id);
                 $content = table_content::create($field_content);
                 //notification repost
                 //input content
                 $field_notiication = array('users_id' => $target->content_users_uploader, 'datetime' => date('Y-m-d H:i:s'), 'status' => 'send');
                 $content = table_notification::create($field_notiication);
                 /*
                 //it always return 1 iterate. i made it but i don't know where a message of notiication store?
                  $dataConverted = array();
                  $app = app();
                  $i=0;
                 $whorepost = table_users_detail::where('users_id', '=',$uid)->first();
                 foreach($whorepost as $row){
                     $dataConverted[$i]->uid = $row->users_id; //send user ID who repost his/her content
                     $dataConverted[$i]->unm = $row->users_name; //send user Name who repost his/her content
                     $dataConverted[$i]->ttl = $target->content_title; //send the Title that reposted
                     $dataConverted[$i]->nci = $whorepost; //send the new content ID to him/her 
                     $dataConverted[$i]->cdi = date('Y-m-d H:i:s'); //send the date repost (insert)
                 
                 }
                 */
                 return (new Response(array('status' => true, 'msg' => 'success'), 200))->header('content-Type', "json");
             }
         } else {
             return (new Response(array('status' => false, 'msg' => 'Authentication Failed2'), 200))->header('content-Type', "json");
         }
     } else {
         return (new Response(array('status' => false, 'msg' => 'Authentication Failed1'), 200))->header('content-Type', "json");
     }
 }