gluu
公開メンバ関数 | 全メンバ一覧
ModelModuleGluuSSO クラス
ModelModuleGluuSSO の継承関係図
Inheritance graph
ModelModuleGluuSSO 連携図
Collaboration graph

公開メンバ関数

 adding_gluu_data ()
 
 uninstall ()
 
 gluu_db_query_update ($gluu_action, $gluu_value)
 
 gluu_db_query_select ($gluu_action)
 
 gluu_db_query_insert ($gluu_action, $gluu_value)
 
 getCustomerGroup ()
 
 drop_table ()
 
 gluu_db_query_select ($gluu_action)
 
 getCountry_by_iso ($iso_code_2)
 
 getZone ($name, $country_id)
 
 editCustomer ($customer_id, $data)
 

詳解

関数詳解

◆ adding_gluu_data()

ModelModuleGluuSSO::adding_gluu_data ( )
44  {
45  $base_url = HTTPS_CATALOG;
46  $this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "gluu_table` (
47  `gluu_action` varchar(255) NOT NULL,
48  `gluu_value` longtext NOT NULL,
49  UNIQUE(`gluu_action`)
50  ) ENGINE=InnoDB DEFAULT CHARSET=utf8");
51 
52  if(!json_decode($this->gluu_db_query_select('gluu_scopes'))){
53  $get_scopes = json_encode(array("openid", "profile","email"));
54  $this->gluu_db_query_insert('gluu_scopes', $get_scopes);
55  }
56  if(!json_decode($this->gluu_db_query_select('gluu_acr'))){
57  $custom_scripts = json_encode(array('none'));
58  $this->gluu_db_query_insert('gluu_acr', $custom_scripts);
59  }
60  if(!json_decode($this->gluu_db_query_select('gluu_config'))){
61  $gluu_config = json_encode(array(
62  "gluu_oxd_port" =>8099,
63  "admin_email" => $this->config->get('config_email'),
64  "authorization_redirect_uri" => $base_url.'index.php?route=module/gluu_sso/login_by_sso',
65  "post_logout_redirect_uri" => $base_url.'index.php?route=account/logout',
66  "config_scopes" => ["openid","profile","email"],
67  "gluu_client_id" => "",
68  "gluu_client_secret" => "",
69  "config_acr" => []
70  ));
71  $this->gluu_db_query_insert('gluu_config', $gluu_config);
72  }
73 
74  if(!$this->gluu_db_query_select('gluu_auth_type')){
75  $gluu_auth_type = 'default';
76  $this->gluu_db_query_insert('gluu_auth_type', $gluu_auth_type);
77  }
78  if(!$this->gluu_db_query_select('gluu_send_user_check')){
79  $gluu_send_user_check = 'no';
80  $this->gluu_db_query_insert('gluu_send_user_check', $gluu_send_user_check);
81  }
82 
83  if(!$this->gluu_db_query_select('gluu_users_can_register')){
84  $gluu_users_can_register = 1;
85  $this->gluu_db_query_insert('gluu_users_can_register', $gluu_users_can_register);
86  }
87  if(!$this->gluu_db_query_select('gluu_new_role')){
88  $this->gluu_db_query_insert('gluu_new_role', json_encode(array()));
89  }
90  if(!json_decode($this->gluu_db_query_select('gluu_other_config'))){
91  $gluu_other_config = json_encode(array(
92  'gluu_user_role'=>$this->config->get('config_customer_group_id'),
93  'gluu_oxd_id' => '',
94  'gluu_provider' => '',
95  'gluu_custom_logout' => $base_url,
96  ));
97  $this->gluu_db_query_insert('gluu_other_config', $gluu_other_config);
98  }
99 
100  }
gluu_db_query_insert($gluu_action, $gluu_value)
Definition: gluu_sso.php:118
gluu_db_query_select($gluu_action)
Definition: gluu_sso.php:112

◆ drop_table()

ModelModuleGluuSSO::drop_table ( )
125  {
126  $this->db->query("DROP TABLE IF EXISTS `" . DB_PREFIX ."gluu_table`;");
127 
128  }

◆ editCustomer()

ModelModuleGluuSSO::editCustomer (   $customer_id,
  $data 
)
21  {
22  $this->load->model('module/gluu_sso');
23  $query = '"UPDATE " . DB_PREFIX . "customer SET ';
24  if($data['customer_first_name']){
25  $query.= " firstname = '" .$this->db->escape($data['customer_first_name']). "',";
26  }
27  if($data['customer_last_name']){
28  $query.= " lastname = '" .$this->db->escape($data['customer_last_name']). "',";
29  }
30  if($data['customer_email']){
31  $query.= " email = '" .$this->db->escape($data['customer_email']). "',";
32  }
33  if($data['customer_telephone']){
34  $query.= " telephone = '" .$this->db->escape($data['customer_telephone']). "',";
35  }
36  if($data['customer_fax']){
37  $query.= " fax = '" .$this->db->escape($data['customer_fax']). "',";
38  }
39  if($data['customer_address_1']){
40  $query.= " address_1 = '" .$this->db->escape($data['customer_address_1']). "',";
41  }
42  if($data['customer_address_2']){
43  $query.= " address_2 = '" .$this->db->escape($data['customer_address_2']). "',";
44  }
45  if($data['customer_city']){
46  $query.= " city = '" .$this->db->escape($data['customer_city']). "',";
47  }
48  if($data['customer_postcode']){
49  $query.= " postcode = '" .$this->db->escape($data['customer_postcode']). "',";
50  }
51  $country_id = $this->getCountry_by_iso($data ['customer_country'])['country_id'] ? $this->getCountry_by_iso($data ['customer_country'])['country_id'] : 0;
52  if($data['customer_country']){
53  $query.= " country = '" .(int)$country_id. "',";
54  }
55  if($data['customer_zone']){
56  $zone_id = $this->getZone($data ['customer_zone'],$country_id)['zone_id'] ? $this->getZone($data ['customer_zone'],$country_id)['zone_id'] : 0;
57 
58  $query.= " zone = '" .(int)$zone_id. "',";
59  }
60  if($data['customer_custom_field']){
61  $query.= " custom_field = '".$this->db->escape(isset($data['custom_field']) ? json_encode($data['custom_field']) : '');
62  }
63  $query.= "' WHERE customer_id = '" . (int)$customer_id . "'";
64  $this->db->query($query);
65  }
getCountry_by_iso($iso_code_2)
Definition: gluu_sso.php:11
getZone($name, $country_id)
Definition: gluu_sso.php:16

◆ getCountry_by_iso()

ModelModuleGluuSSO::getCountry_by_iso (   $iso_code_2)
11  {
12  $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "country WHERE iso_code_2 LIKE '%" . $iso_code_2 . "%' AND status = '1'");
13 
14  return $query->row;
15  }

◆ getCustomerGroup()

ModelModuleGluuSSO::getCustomerGroup ( )
121  {
122  $query = $this->db->query("SELECT * FROM " . DB_PREFIX ."customer_group_description ");
123  return $query->rows;
124  }

◆ getZone()

ModelModuleGluuSSO::getZone (   $name,
  $country_id 
)
16  {
17  $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "_zone WHERE name LIKE '%" . $name . "%' AND country_id = '" . $country_id . "'");
18 
19  return $query->row;
20  }

◆ gluu_db_query_insert()

ModelModuleGluuSSO::gluu_db_query_insert (   $gluu_action,
  $gluu_value 
)
118  {
119  return $this->db->query("INSERT INTO `" . DB_PREFIX . "gluu_table` (gluu_action, gluu_value) VALUES ('$gluu_action','$gluu_value')");
120  }

◆ gluu_db_query_select() [1/2]

ModelModuleGluuSSO::gluu_db_query_select (   $gluu_action)
5  {
6  $query = $this->db->query("SELECT `gluu_value` FROM `" . DB_PREFIX ."gluu_table` WHERE `gluu_action` LIKE '".$gluu_action."'");
7  if($query->num_rows)
8  return $query->row['gluu_value'];
9  else return '';
10  }

◆ gluu_db_query_select() [2/2]

ModelModuleGluuSSO::gluu_db_query_select (   $gluu_action)
112  {
113  $query = $this->db->query("SELECT `gluu_value` FROM `" . DB_PREFIX ."gluu_table` WHERE `gluu_action` LIKE '".$gluu_action."'");
114  if($query->num_rows)
115  return $query->row['gluu_value'];
116  else return '';
117  }

◆ gluu_db_query_update()

ModelModuleGluuSSO::gluu_db_query_update (   $gluu_action,
  $gluu_value 
)
105  {
106  $this->db->query("UPDATE `" . DB_PREFIX . "gluu_table` SET `gluu_value` = '$gluu_value' WHERE `gluu_action` LIKE '$gluu_action'");
107  $query = $this->db->query("SELECT `gluu_value` FROM `" . DB_PREFIX ."gluu_table` WHERE `gluu_action` LIKE '".$gluu_action."'");
108  if($query->num_rows)
109  return $gluu_value;
110  else return '';
111  }

◆ uninstall()

ModelModuleGluuSSO::uninstall ( )
101  {
102  $this->drop_table();
103  $this->db->query("UPDATE `" . DB_PREFIX ."setting` SET `value` = '0' WHERE `key` = 'gluu_sso_status';");
104  }
drop_table()
Definition: gluu_sso.php:125

このクラス詳解は次のファイルから抽出されました: