Example #1
2
 /**
  * Display a page with this order of priority (based on the provided page name) :
  *  1. Does the page exist into local/pages/{lang}/ (this allows you to overwrite default pages)?
  *  2. Does the page exist into the views available in views/pages/ folder?
  * Pages are not public and we take into account the language of the connected user.
  * If the page name contains the keyword export, then we don't output the default template.
  * @param string $page Name of the view (and of the corresponding PHP file)
  * @author Benjamin BALET <benjamin.balet@gmail.com>
  */
 public function view($page = 'home')
 {
     $data = getUserContext($this);
     $trans = array("-" => " ", "_" => " ", "." => " ");
     $data['title'] = ucfirst(strtr($page, $trans));
     // Capitalize the first letter
     //The page containing export in their name are returning another MIMETYPE
     if (strpos($page, 'export') === FALSE) {
         //Don't include header and menu
         $this->load->view('templates/header', $data);
         $this->load->view('menu/index', $data);
     }
     $view = 'pages/' . $this->language_code . '/' . $page . '.php';
     $pathCI = APPPATH . 'views/';
     $pathLocal = FCPATH . 'local/';
     //Check if we have a user-defined view
     if (file_exists($pathLocal . $view)) {
         $this->load->customView($pathLocal, $view, $data);
     } else {
         //Load the page from the default location (CI views folder)
         if (!file_exists($pathCI . $view)) {
             redirect('notfound');
         }
         $this->load->view($view, $data);
     }
     if (strpos($page, 'export') === FALSE) {
         $this->load->view('templates/footer', $data);
     }
 }
Example #2
2
function islogged()
{
    if (session_status() === PHP_SESSION_ACTIVE) {
        return;
    }
    redirect("login.php");
}
 public function index()
 {
     if (!$this->ion_auth->logged_in()) {
         // redirect them to the login page
         redirect('camapaignmanager/login', 'refresh');
     }
 }
Example #4
1
 public function incluir()
 {
     // Coloca os valores em variáveis
     $dados['descricao'] = $this->input->post("descricao");
     $dados['telefone'] = $this->input->post("telefone");
     $dados['email'] = $this->input->post("email");
     $dados['nome'] = $this->input->post("nome");
     $dados['data_nascimento'] = preg_replace('/^(\\d+)\\/(\\d+)\\/(\\d+)$/', '${3}-${2}-${1}', $this->input->post("data_nascimento"));
     $dados['prontuario'] = $this->input->post("prontuario");
     $dados['cpf'] = $this->input->post("cpf");
     $dados['tipo'] = $this->input->post("tipo");
     $dados['id_anuncio'] = $this->anuncios_model->inserir($dados);
     if ($_FILES['image']['name'] != '') {
         $path = 'maso/uploads/anuncios/';
         // Configura o upload
         $config = array('upload_path' => $path, 'allowed_types' => 'gif|jpg|png', 'file_name' => "anuncio_" . $dados['id_anuncio'], 'maintain_ratio' => true, 'max_size' => 0, 'max_filename' => 0);
         $this->load->library('upload');
         $this->upload->initialize($config);
         if ($this->upload->do_upload('image')) {
             // Informações do arquivo apos upload
             $infoDoc = $this->upload->data();
             // Salvando as informações da imagem
             $dadosDoc = array('id_anuncio' => $dados['id_anuncio'], 'imagem' => $infoDoc['file_name']);
             $this->anuncios_model->update($dadosDoc);
         } else {
             $this->session->set_flashdata("error", $this->upload->display_errors('<div class="alert alert-error">', '</div>'));
         }
     }
     $this->session->set_flashdata("messege", "Anúncio enviado com sucesso !");
     redirect('page/anuncios');
 }
Example #5
1
 public function index($error = '')
 {
     $data['error'] = $error;
     $this->load->model('information/search_minute_model', '', TRUE);
     //title for the page
     //$header['title']='Search Removed Minutes';
     //$this->load->view('templates/header',$header);
     if ($this->input->post('go') == FALSE) {
         //$header['title']='Search Removed Minutes';
         $this->drawHeader("Search Removed Minutes");
         $data['id'] = $this->search_minute_model->get_minute_ids();
         //var_dump($data);
         if ($data['id'] == NULL) {
             $this->session->set_flashdata('flashError', 'There is no any removed minutes.');
             redirect('information/search');
         }
         $this->load->view('information/search_minute', $data);
     } else {
         //$header['title'] = 'View Minutes';
         $this->drawHeader("View Minutes");
         $data['id'] = $this->search_minute_model->get_minute_ids();
         $data['selected'] = $this->input->post('minute_id');
         $this->load->view('information/search_minute', $data);
         $data['minute_row'] = $this->search_minute_model->get_minute_row($data['selected']);
         //var_dump($data);
         $this->load->view('information/view_minuteR', $data);
     }
     $this->drawFooter();
 }
Example #6
1
 public function logout()
 {
     $this->delete_remember_me();
     $this->session->unset_userdata('user');
     $this->session->sess_destroy();
     redirect('/', 'refresh');
 }
Example #7
1
 public function logAppDevice($type, $token)
 {
     $forever = time() + 10 * 365 * 24 * 60 * 60;
     setcookie('device_type', $type, $forever, '/');
     setcookie('device_token', $token, $forever, '/');
     return redirect('auth/login');
 }
function invitetogroup_submit(Pieform $form, $values)
{
    global $SESSION, $USER, $group, $user;
    group_invite_user($group, $user->id, $USER, isset($values['role']) ? $values['role'] : null);
    $SESSION->add_ok_msg(get_string('userinvited', 'group'));
    redirect(profile_url($user));
}
 public function intlDomain(Request $request)
 {
     $data = $request->all();
     $contacts = (object) $data['contacts'];
     //Registrant Contact Array
     $registrant = ['Firstname' => $contacts->Registrant_FirstName, 'Lastname' => $contacts->Registrant_LastName, 'Organization' => 'My Company', 'CountryCode' => $contacts->Registrant_CountryCode, 'City' => $contacts->Registrant_City, 'Email' => $contacts->Registrant_Email, 'Street' => $contacts->Registrant_Street, 'PostalCode' => $contacts->Registrant_PostalCode, 'PhoneNumber' => $this->intlphoneNumber($contacts->Registrant_PhoneNumber, $contacts->Registrant_CountryCode)];
     // Admin Contact Array
     $admin = ['Firstname' => $contacts->Admin_FirstName, 'Lastname' => $contacts->Admin_LastName, 'Organization' => 'My Company', 'CountryCode' => $contacts->Admin_CountryCode, 'City' => $contacts->Admin_City, 'Email' => $contacts->Admin_Email, 'Street' => $contacts->Admin_Street, 'PostalCode' => $contacts->Admin_PostalCode, 'PhoneNumber' => $this->intlphoneNumber($contacts->Registrant_PhoneNumber, $contacts->Registrant_CountryCode)];
     $c = array('Registrant' => $registrant, 'Admin' => $admin, 'Technical' => $admin, 'Billing' => $admin);
     $nameservers = ['Ns_list' => implode(',', $data['name_servers'])];
     try {
         InternetBS::init('X1A7S0D7X8N0U0U0I6S2', 'Toto197500cxz');
         if (Domain::find($data['domain_id'])->domain_status == 0) {
             $response = (object) json_decode(InternetBS::api()->domainCreate($data['domain_name'], $c, 1, $nameservers));
             if ($response->product[0]->status == 'SUCCESS') {
                 $domain = Domain::find($data->domain_id);
                 $domain->domain_status = 1;
                 $domain->save();
                 // Send an email of confirmation and do a redirection automatically
                 return redirect('admin/dashboard');
             } else {
                 // Redict to error page
                 return redirect('admin/errors');
             }
         } else {
             // Update Domain Name //
             InternetBS::api()->domainAssignNS($data['domain_name'], $data['name_servers']);
             $updates = InternetBS::api()->domainUpdate($data['domain_name'], $c);
             return ['response' => $updates];
         }
     } catch (Exception $e) {
         return ['response' => 'error detected', 'error_msg' => $e->getMessage()];
     }
 }
Example #10
1
 public function slots()
 {
     $user = Auth::user();
     $location = $user->location;
     $slot = Slot::where('location', '=', $location)->first();
     $input = Input::get('wager');
     $owner = User::where('name', '=', $slot->owner)->first();
     $num1 = rand(1, 10);
     $num2 = rand(5, 7);
     $num3 = rand(5, 7);
     if ($user->name != $owner->name) {
         if ($num1 & $num2 & $num3 == 6) {
             $money = rand(250, 300);
             $payment = $money += $input * 1.75;
             $user->money += $payment;
             $user->save();
             session()->flash('flash_message', 'You rolled three sixes!!');
             return redirect('/home');
         } else {
             $user->money -= $input;
             $user->save();
             $owner->money += $input;
             $owner->save();
             session()->flash('flash_message_important', 'You failed to roll three sixes!!');
             return redirect(action('SlotsController@show', [$slot->location]));
         }
     } else {
         session()->flash('flash_message_important', 'You own this slot!!');
         return redirect(action('SlotsController@show', [$slot->location]));
     }
 }
Example #11
1
 /**
  * Convert an authentication exception into an unauthenticated response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Illuminate\Auth\AuthenticationException  $exception
  * @return \Illuminate\Http\Response
  */
 protected function unauthenticated($request, AuthenticationException $exception)
 {
     if ($request->expectsJson()) {
         return response()->json(['error' => 'Unauthenticated.'], 401);
     }
     return redirect()->guest('login');
 }
Example #12
1
 public function not_loggedin()
 {
     $CI =& get_instance();
     if (!$CI->session->is_loggedin) {
         redirect('/index');
     }
 }
 function action()
 {
     if (isset($_POST['action']['save'])) {
         $fields = $_POST['fields'];
         $permissions = $fields['permissions'];
         $name = trim($fields['name']);
         $page_access = $fields['page_access'];
         if (strlen($name) == 0) {
             $this->_errors['name'] = 'This is a required field';
             return;
         } elseif ($this->_driver->roleExists($name)) {
             $this->_errors['name'] = 'A role with the name <code>' . $name . '</code> already exists.';
             return;
         }
         $sql = "INSERT INTO `tbl_members_roles` VALUES (NULL, \n\t\t\t\t\t\t\t\t\t\t\t\t'{$name}', \n\t\t\t\t\t\t\t\t\t\t\t\t" . (strlen(trim($fields['email_subject'])) > 0 ? "'" . addslashes($fields['email_subject']) . "'" : 'NULL') . ", \n\t\t\t\t\t\t\t\t\t\t\t\t" . (strlen(trim($fields['email_body'])) > 0 ? "'" . addslashes($fields['email_body']) . "'" : 'NULL') . ")";
         $this->_Parent->Database->query($sql);
         $role_id = $this->_Parent->Database->getInsertID();
         if (is_array($page_access) && !empty($page_access)) {
             foreach ($page_access as $page_id) {
                 $this->_Parent->Database->query("INSERT INTO `tbl_members_roles_page_permissions` VALUES (NULL, {$role_id}, {$page_id}, 'yes')");
             }
         }
         if (is_array($permissions) && !empty($permissions)) {
             $sql = "INSERT INTO `tbl_members_roles_event_permissions` VALUES ";
             foreach ($permissions as $event_handle => $p) {
                 foreach ($p as $action => $allow) {
                     $sql .= "(NULL,  {$role_id}, '{$event_handle}', '{$action}', '{$allow}'),";
                 }
             }
             $this->_Parent->Database->query(trim($sql, ','));
         }
         redirect(extension_members::baseURL() . 'edit/' . $role_id . '/created/');
     }
 }
Example #14
1
 /**
  * Remove the specified resource from storage.
  *
  * @param  string $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $social_media = $this->social_medias->find($id);
     $social_media->delete();
     flash()->info('Deleted', 'Social Media has been deleted');
     return redirect()->route('admin.social_media.index');
 }
Example #15
1
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     dd(1111);
     $advert = new Advert();
     $advert->create($request->all());
     return redirect()->route('/');
 }
 public function index()
 {
     $this->load->helper('cookie');
     delete_cookie('login');
     $this->load->helper('url');
     redirect('/login/', 'refresh');
 }
Example #17
1
 public function autenticar()
 {
     $this->load->library('form_validation');
     $this->form_validation->set_error_delimiters('<div class="alert alert-warning">', '</div>');
     $this->establecer_reglas();
     if ($this->form_validation->run() === FALSE) {
         $this->load->view('templates/login');
     } else {
         $datos = array('email' => $this->input->post('email'), 'clave' => $this->input->post('clave'));
         $this->load->model('login_model');
         if ($this->login_model->autenticar_usuario($datos)) {
             #iniciar sesión, guardar datos necesarios
             $this->load->model('usuario_model');
             $usuario = $this->usuario_model->obtener_usuario_por_email($datos['email']);
             $_SESSION['usuario_id'] = $usuario->id_usuario;
             $_SESSION['usuario_email'] = $usuario->email;
             $_SESSION['usuario_autenticado'] = TRUE;
             $this->load->helper('url');
             redirect('principal');
         } else {
             #mostrar error
             $data['mostrar_error'] = TRUE;
             $this->load->view('templates/login', $data);
         }
     }
 }
 public function index($error = '')
 {
     $data['error'] = $error;
     $this->load->model('information/search_edit_circular_model', '', TRUE);
     //title for the page
     //$header['title']='Search Edit Minutes';
     //$this->load->view('templates/header',$header);
     if ($this->input->post('go') == FALSE) {
         //$header['title']='Search Edit Circular';
         $this->drawHeader("Search(Edit) Circular");
         $data['id'] = $this->search_edit_circular_model->get_circular_ids();
         //var_dump($data);
         if ($data['id'] == NULL) {
             $this->session->set_flashdata('flashError', 'There is no any circular to edit.');
             redirect('information/search_edit');
         }
         $this->load->view('information/search_edit_circular', $data);
     } else {
         //$header['title'] = 'View Circular';
         $this->drawHeader("View Circular");
         $data['id'] = $this->search_edit_circular_model->get_circular_ids();
         $data['selected'] = $this->input->post('circular_id');
         $this->load->view('information/search_edit_circular', $data);
         $data['circular_row'] = $this->search_edit_circular_model->get_circular_row($data['selected']);
         //var_dump($data);
         $this->load->view('information/view_circular', $data);
     }
     $this->draewFooter();
 }
 function delete_sales_region($sales_region_id)
 {
     $this->load->model('sales_region_model');
     $this->sales_region_model->delete_sales_region($sales_region_id);
     $this->session->set_flashdata('message', 'Successfully Deleted');
     redirect('masters/sales_region');
 }
Example #20
0
 function checkaccess($access)
 {
     $accesslevel = $this->session->userdata('accesslevel');
     if (!in_array($accesslevel, $access)) {
         redirect(base_url() . 'index.php/site?alerterror=You do not have access to this page. ', 'refresh');
     }
 }
Example #21
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!Session::has('user')) {
         return redirect('/');
     }
     return $next($request);
 }
Example #22
0
 /**
  * Removes the specified user from the specified role.
  *
  * @param int|string $roleId
  * @param int|string $userId
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function destroy($roleId, $userId)
 {
     $this->authorize('admin.roles.users.destroy');
     $role = $this->role->findOrFail($roleId);
     $user = $role->users()->findOrFail($userId);
     // Retrieve the administrators name.
     $adminName = Role::getAdministratorName();
     // Retrieve all administrators.
     $administrators = $this->user->whereHas('roles', function ($query) use($adminName) {
         $query->whereName($adminName);
     })->get();
     $admin = Role::whereName($adminName)->first();
     // We need to verify that if the user is trying to remove all roles on themselves,
     // and they are the only administrator, that we throw an exception notifying them
     // that they can't do that. Though we want to allow the user to remove the
     // administrator role if more than one administrator exists.
     if ($user->hasRole($admin) && $user->id === auth()->user()->id && count($administrators) === 1) {
         flash()->setTimer(null)->error('Error!', "Unable to remove the administrator role from this user. You're the only administrator.");
         return redirect()->route('admin.roles.show', [$roleId]);
     }
     if ($role->users()->detach($user)) {
         flash()->success('Success!', 'Successfully removed user.');
         return redirect()->route('admin.roles.show', [$roleId]);
     }
     flash()->error('Error!', 'There was an issue removing this user. Please try again.');
     return redirect()->route('admin.roles.show', [$roleId]);
 }
Example #23
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $message = null;
     if ($this->validator($request->all())->fails()) {
         flash()->error('Please fill all the required field!');
         return redirect()->back()->withInput();
     }
     if ($this->user->email) {
         $employee = $this->user->employee;
         $sender = ['email' => $this->user->email, 'name' => $employee ? $employee->fullName() : $this->user->username];
         $recipient = $request->recipient;
         $message = Mail::raw($request->content, function ($msg) use($request, $sender) {
             $msg->from($sender['email'], $sender['name']);
             $msg->to($request->recipient);
             $msg->subject($request->subject);
             $request->cc ? $message->cc($request->cc) : null;
             $request->bcc ? $message->cc($request->bcc) : null;
         });
     }
     if ($message) {
         flash()->success('Message successfully sent!');
     } else {
         flash()->error('Message not sent!');
     }
     return redirect()->back();
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (false === env('APP_INSTALLED', false)) {
         return redirect(route('installer.index'));
     }
     return $next($request);
 }
Example #25
0
 public function createIssue()
 {
     $this->load->model('createIssue_m1');
     $dashboard = '';
     //controller path
     $this->load->library('form_validation');
     $this->form_validation->set_error_delimiters('<div class="error">', '</div>');
     $this->form_validation->set_rules('issueCode', 'Issue Code', 'required');
     $this->form_validation->set_rules('issueType', 'Issue Type', 'required');
     $this->form_validation->set_rules('description', 'Description ', 'required');
     //run the validating
     if ($this->form_validation->run() == TRUE) {
         $currentDate = date("Y/m/d");
         $pid = $this->session->userdata('project_id');
         $uid = $this->session->userdata('uid');
         $name = $this->createIssue_m1->getSignedInUser($uid);
         $name = $name[0]->name;
         $lastId = $this->createIssue_m1->getLastIssueId($pid);
         $lastId = $lastId[0]->last + 1;
         $data = array('issue_id' => $lastId, 'issue_code' => $this->input->post('issueCode'), 'project_id' => $pid, 'priority_type' => $this->input->post('priority'), 'member_id' => $uid, 'created_by' => $name, 'description' => $this->input->post('description'), 'summary' => $this->input->post('summary'), 'issue_type' => $this->input->post('issueType'), 'created_date' => $currentDate, 'availability_status' => 1);
         $this->createIssue_m1->createIssue($data);
         redirect("admin/viewAllIssues_c");
     }
     // $this->load->model('createIssue_m1');
     // $this->data['priority'] = $this->project_model->getPriority();
     // $this->data['subview'] = 'manager/user/projectManagement_view';
     // $this->load->view("manager/_layout_main", $this->data);
 }
Example #26
0
 private function _is_logged_in()
 {
     $is_logged_in = $this->session->userdata('is_logged_in');
     if (!isset($is_logged_in) || $is_logged_in != true) {
         redirect('logout');
     }
 }
function _index()
{
    //	$data['msg'][]=View::do_fetch(VIEW_PATH.'login.tpl.php');
    //	View::do_dump(VIEW_PATH.'layout.php',$data);
    isUserLoggedIn();
    redirect('news/showNews');
}
Example #28
0
 public function index()
 {
     $this->load->model('printing_model');
     $this->load->model('settings_model');
     $this->load->model('contests_model');
     $arg_list = func_get_args();
     $contest = $this->contests_model->getCurrentContest();
     $points_table_used = $this->contests_model->getPointsUsed();
     if (!$this->contests_model->table_exists($points_table_used) or $this->contests_model->tableEmpty($points_table_used)) {
         redirect("/competitors?redirected_from='site.php'");
     }
     $data['all_input_tables'] = $this->printing_model->allWrittenInputTables($contest);
     $data['all_charters'] = $this->printing_model->allWrittenCharters($contest);
     $data['gcp_status'] = $this->settings_model->getGCPStatus();
     if (!$this->printing_model->printerConfigured()) {
         $data['printer_set_up'] = FALSE;
     }
     if ($this->input->get('class_selection') and $this->input->get('print_function')) {
         $this->load->model('classes_model');
         $data['class_selection']['class_id'] = $this->input->get('class_selection');
         $data['class_selection']['class_name'] = $this->classes_model->getClassName($data['class_selection']['class_id']);
         $data['print_function'] = $this->input->get('print_function');
     }
     if (isset($arg_list[0]['input_tables']['printing']['status']['completed']) && $arg_list[0]['input_tables']['printing']['status']['completed']) {
         $data['input_tables']['printing']['status']['completed'] = $arg_list[0]['input_tables'];
     }
     if (isset($arg_list[0]['error']['uncomplete']) && $arg_list[0]['error']['uncomplete']) {
         $data['error']['uncomplete'] = true;
     }
     $data['main_content'] = 'printing_view.php';
     $this->load->view('/includes/template.php', $data);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->check()) {
         return redirect('/home');
     }
     return $next($request);
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $callLog = new callLog();
     $callLog->user_id = $id;
     $callLog->save();
     return redirect()->action('callLogsController@index');
 }