コード例 #1
0
ファイル: login.php プロジェクト: pardoc/FAB-UI
 public function do_login()
 {
     if ($this->input->post()) {
         $this->load->helper('ft_file_helper');
         clean_temp('hour', 12);
         $post = $this->input->post();
         //carico X class database
         $this->load->database();
         $this->load->model('user');
         $email = $this->input->post('email');
         $password = $this->input->post('password');
         if ($this->user->login($email, $password) == TRUE) {
             $user = $this->user->get_user($email);
             $_settings = json_decode($user->settings, TRUE);
             $_user_session['id'] = $user->id;
             $_user_session['first_name'] = $user->first_name;
             $_user_session['last_name'] = $user->last_name;
             $_user_session['email'] = $user->email;
             $_user_session['avatar'] = $_settings['avatar'];
             $_user_session['theme-skin'] = $_settings['theme-skin'];
             $_user_session['lock-screen'] = isset($_settings['lock-screen']) ? $_settings['lock-screen'] : 0;
             $_user_session['layout'] = isset($_settings['layout']) ? $_settings['layout'] : '';
             $_SESSION['user'] = $_user_session;
             $_SESSION['logged_in'] = TRUE;
             $_SESSION['type'] = 'fabtotum';
             $_SESSION['ask_wizard'] = TRUE;
             /** LOAD HELPER */
             $this->load->helper('update_helper');
             $_fabui_local = myfab_get_local_version();
             $_fw_local = marlin_get_local_version();
             $_fabui_update = false;
             $_fw_update = false;
             $_updates = array();
             $_updates['number'] = 0;
             $_updates['time'] = time();
             if (is_internet_avaiable()) {
                 $_fabui_remote_version = myfab_get_remote_version();
                 $_fw_remote_version = marlin_get_remote_version();
                 $_fabui_update = $_fabui_remote_version > $_fabui_local;
                 $_fw_update = $_fw_remote_version > $_fw_local;
                 $_updates['number'] += $_fabui_update ? 1 : 0;
                 $_updates['number'] += $_fw_update ? 1 : 0;
                 $_updates['fabui'] = $_fabui_update;
                 $_updates['fw'] = $_fw_update;
             }
             $_SESSION['fabui_version'] = $_fabui_local;
             $_SESSION['updates'] = $_updates;
             $this->user->update_login($user->id);
             redirect('dashboard', 'location');
         } else {
             /**  */
             $_SESSION['login_failed'] = true;
             $_SESSION['login_failed_mail'] = $email;
             redirect('login');
         }
     }
 }
コード例 #2
0
ファイル: importppt.php プロジェクト: veritech/pare-project
print_header_simple("{$strimportppt}", " {$strimportppt}", "<a href=\"index.php?id={$course->id}\">{$strlessons}</a> -> <a href=\"{$CFG->wwwroot}/mod/{$modname}/view.php?id={$cm->id}\">" . format_string($mod->name, true) . "</a>-> {$strimportppt}");
if ($form = data_submitted()) {
    /// Filename
    if (empty($_FILES['newfile'])) {
        // file was just uploaded
        notify(get_string("uploadproblem"));
    }
    if (!is_uploaded_file($_FILES['newfile']['tmp_name']) or $_FILES['newfile']['size'] == 0) {
        notify(get_string("uploadnofilefound"));
    } else {
        // Valid file is found
        if ($rawpages = readdata($_FILES, $course->id, $modname)) {
            // first try to reall all of the data in
            $pageobjects = extract_data($rawpages, $course->id, $mod->name, $modname);
            // parse all the html files into objects
            clean_temp();
            // all done with files so dump em
            $mod_create_objects = $modname . '_create_objects';
            $mod_save_objects = $modname . '_save_objects';
            $objects = $mod_create_objects($pageobjects, $mod->id);
            // function to preps the data to be sent to DB
            if (!$mod_save_objects($objects, $mod->id, $pageid)) {
                // sends it to DB
                error("could not save");
            }
        } else {
            error('could not get data');
        }
        echo "<hr>";
        print_continue("{$CFG->wwwroot}/mod/{$modname}/view.php?id={$cm->id}");
        print_footer($course);
コード例 #3
0
        notify(get_string("uploadproblem"));
    }
    if (!is_uploaded_file($_FILES['newfile']['tmp_name']) or $_FILES['newfile']['size'] == 0) {
        notify(get_string("uploadnofilefound"));
    } else {
        // Valid file is found
        if (readdata($course->id, 'game', $dirtemp, $r_levels, $r_titles, $r_texts, $dirfordelete)) {
            // first try to reall all of the data in
            $subchapter = $_POST['subchapter'] != 0;
            $overwrite = (int) $_POST['overwrite'] != 0;
            if ($overwrite) {
                game_bookquiz_deletebook($course->id, $bookid);
            }
            $pageobjects = extract_data($course->id, 'book', $bookid, $dirtemp, $subchapter, $r_levels, $r_titles, $r_texts);
            // parse all the html files into objects
            clean_temp($dirfordelete);
            // all done with files so dump em
            $objects = game_bookquiz_create_objects($pageobjects, $bookid);
            // function to preps the data to be sent to DB
            if (!game_bookquiz_save_objects($objects)) {
                // sends it to DB
                error("could not save");
            }
        } else {
            error('could not get data');
        }
        print_continue("{$CFG->wwwroot}/mod/game/view.php?id={$cm->id}");
        print_footer($course);
        exit;
    }
}