示例#1
0
 public function import($file)
 {
     try {
         $users = array();
         $params = array(1 => 'user_name', 'user_password', 'user_first_name', 'user_last_name', 'user_email', 'user_group', 'user_vhost');
         $excel = new Spreadsheet_Excel_Reader($file);
         $rows = $excel->rowcount($sheet_index = 0);
         $cols = $excel->colcount($sheet_index = 0);
         for ($row = 2; $row <= $rows; $row++) {
             if ($cols == 7) {
                 for ($col = 1; $col <= $cols; $col++) {
                     $users[$row][$params[$col]] = $excel->val($row, $col);
                     $users[$row]['user_vhost'] = explode(',', $excel->val($row, 7));
                     $users[$row]['user_group'] = '';
                 }
             }
         }
         $this->userimport = new userimport();
         $users = $this->userimport->import($users);
         $_SESSION['message'] = $this->userimport->get_message();
         return $users;
     } catch (Exception $e) {
         display_page_error();
     }
 }
示例#2
0
 public function import($file)
 {
     try {
         $users = array();
         $params = array(1 => 'username', 'password', 'first_name', 'last_name', 'email', 'admin', 'active');
         $excel = new Spreadsheet_Excel_Reader($file);
         $rows = $excel->rowcount($sheet_index = 0);
         $cols = $excel->colcount($sheet_index = 0);
         for ($row = 2; $row <= $rows; $row++) {
             for ($col = 1; $col <= $cols; $col++) {
                 $users[$row][$params[$col]] = $excel->val($row, $col);
             }
         }
         $this->userimport = new userimport();
         $users = $this->userimport->import($users);
         $_SESSION['message'] = $this->userimport->get_message();
         return $users;
     } catch (Exception $e) {
         display_page_error();
     }
 }
示例#3
0
文件: index.php 项目: jabouzi/pizza
    require APPPATH . "app/languages/" . get_site_lang() . "/{$file}.php";
}
$session = new Session();
session_set_save_handler(array(&$session, '_open'), array(&$session, '_close'), array(&$session, '_read'), array(&$session, '_write'), array(&$session, '_destroy'), array(&$session, '_clean'));
session_start();
$params = get_controller_params($_GET);
if (isset($_GET['u']) and isset($params['lang'])) {
    if (!is_valid_site_lang()) {
        redirect('/');
    }
}
if (isset($params['controller'])) {
    if (controller_exists($params['controller'])) {
        $obj = new $params['controller']();
        if (isset($params['method'])) {
            if (is_callable(array($obj, $params['method']))) {
                echo call_user_func_array(array($obj, $params['method']), $params['args']);
            } else {
                display_page_error();
            }
        } else {
            if (is_callable(array($obj, 'index'))) {
                echo call_user_func_array(array($obj, 'index'), array());
            } else {
                display_page_error();
            }
        }
    } else {
        display_page_error();
    }
}