Changeset 3191034
- Timestamp:
- 11/18/2024 09:19:53 AM (17 months ago)
- Location:
- netgsm/trunk
- Files:
-
- 4 edited
-
includes/netgsmsms.php (modified) (24 diffs)
-
index.php (modified) (6 diffs)
-
pages/index.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
netgsm/trunk/includes/netgsmsms.php
r3119907 r3191034 10 10 private $appkey = "63610054a66a4e22adeeae5f375b015f"; 11 11 12 public function __construct($usercode,$password,$title='', $TR_Char='') { //WP USE 12 public function __construct($usercode, $password, $title = '', $TR_Char = '') 13 { //WP USE 13 14 $this->usercode = trim($usercode); 14 $a =0;15 $a = 0; 15 16 $this->password = $password; 16 17 … … 18 19 19 20 $this->language = ''; 20 if ($TR_Char == 1) {21 if ($TR_Char == 1) { 21 22 $this->language = "dil='TR'"; 22 23 } … … 29 30 public function getStartDate() 30 31 { 31 if ($this->startDate == '') {32 if ($this->startDate == '') { 32 33 return ''; 33 34 } … … 35 36 } 36 37 37 public function sendSMS($phone,$mesaj,$filter){ //WP USE 38 public function sendSMS($phone, $mesaj, $filter) 39 { //WP USE 38 40 $phones = array(); 39 $parts = explode(',', $phone);40 foreach ($parts as $value) {41 if($value!=''){42 array_push($phones,$value);43 }44 } 45 $number = "";46 foreach ($phones as $value) {47 $number .= '<no>'.$value.'</no>';41 $parts = explode(',', $phone); 42 foreach ($parts as $value) { 43 if ($value != '') { 44 array_push($phones, $value); 45 } 46 } 47 $number = ""; 48 foreach ($phones as $value) { 49 $number .= '<no>' . $value . '</no>'; 48 50 } 49 51 50 52 $PostAdress = 'https://api.netgsm.com.tr/sms/send/xml'; 51 $xml =array('body'=>'<?xml version="1.0" encoding="UTF-8"?>53 $xml = array('body' => '<?xml version="1.0" encoding="UTF-8"?> 52 54 <mainbody> 53 55 <header> 54 <company wp="1" ' .$this->language.'>NETGSM</company>55 <usercode>' .$this->usercode.'</usercode>56 <password>' .$this->password.'</password>57 <appkey>' .$this->appkey.'</appkey>58 <startdate>' .$this->getStartDate().'</startdate>56 <company wp="1" ' . $this->language . '>NETGSM</company> 57 <usercode>' . $this->usercode . '</usercode> 58 <password>' . $this->password . '</password> 59 <appkey>' . $this->appkey . '</appkey> 60 <startdate>' . $this->getStartDate() . '</startdate> 59 61 <stopdate></stopdate> 60 62 <type>1:n</type> 61 <msgheader>' .$this->title.'</msgheader>62 <filter>' .$filter.'</filter>63 <msgheader>' . $this->title . '</msgheader> 64 <filter>' . $filter . '</filter> 63 65 </header> 64 66 <body> 65 <msg><![CDATA[' .$mesaj.']]></msg>66 ' .$number.'67 <msg><![CDATA[' . $mesaj . ']]></msg> 68 ' . $number . ' 67 69 </body> 68 70 </mainbody>'); 69 $response = wp_remote_post($PostAdress, $xml );71 $response = wp_remote_post($PostAdress, $xml); 70 72 return $this->smsCevap($this->responseDecoder($response)['body']); 71 73 } … … 75 77 * otp sms gönderimi 76 78 */ 77 public function sendOTPSMS($phone, $message){ 79 public function sendOTPSMS($phone, $message) 80 { 78 81 $request_url = 'https://api.netgsm.com.tr/sms/send/otp'; 79 $xml = array('body'=> '<?xml version="1.0"?> 82 $xml = array( 83 'body' => '<?xml version="1.0"?> 80 84 <mainbody> 81 85 <header> 82 <usercode>' .$this->usercode.'</usercode>83 <password>' .$this->password.'</password>84 <appkey>' .$this->appkey.'</appkey>85 <msgheader>' .$this->title.'</msgheader>86 <usercode>' . $this->usercode . '</usercode> 87 <password>' . $this->password . '</password> 88 <appkey>' . $this->appkey . '</appkey> 89 <msgheader>' . $this->title . '</msgheader> 86 90 </header> 87 91 <body> 88 <msg><![CDATA[' .substr($message,0,150).']]></msg>89 <no>' .$phone.'</no>92 <msg><![CDATA[' . substr($message, 0, 150) . ']]></msg> 93 <no>' . $phone . '</no> 90 94 </body> 91 95 </mainbody>' … … 95 99 } 96 100 97 public function sendBulkSMS($data, $filter) { //WP USE 101 public function sendBulkSMS($data, $filter) 102 { //WP USE 98 103 $PostAdress = 'https://api.netgsm.com.tr/sms/send/xml'; 99 $xml = array('body'=> '<?xml version="1.0" encoding="UTF-8"?>104 $xml = array('body' => '<?xml version="1.0" encoding="UTF-8"?> 100 105 <mainbody> 101 106 <header> 102 <company wp="1" ' .$this->language.'>Netgsm</company>103 <usercode>' .$this->usercode.'</usercode>104 <password>' .$this->password.'</password>105 <appkey>' .$this->appkey.'</appkey>107 <company wp="1" ' . $this->language . '>Netgsm</company> 108 <usercode>' . $this->usercode . '</usercode> 109 <password>' . $this->password . '</password> 110 <appkey>' . $this->appkey . '</appkey> 106 111 <startdate></startdate> 107 112 <stopdate></stopdate> 108 113 <type>n:n</type> 109 <msgheader>' .$this->title.'</msgheader>110 <filter>' .$filter.'</filter>114 <msgheader>' . $this->title . '</msgheader> 115 <filter>' . $filter . '</filter> 111 116 </header> 112 117 <body> 113 ' .$data.'</body>118 ' . $data . '</body> 114 119 </mainbody>'); 115 120 $response = wp_remote_post($PostAdress, $xml); … … 118 123 } 119 124 120 public function xmlCevap($input){ 125 public function xmlCevap($input) 126 { 121 127 $code = explode('<code>', $input); 122 128 $code = explode('</code>', $code[1]); … … 124 130 } 125 131 126 public function smsCevap($input) { //WP USE 132 public function smsCevap($input) 133 { //WP USE 127 134 $response = explode(' ', $input); 128 135 if ($response[0] == '00' || $response[0] == '02') { 129 $result = array('durum' => 1, 'kod'=>$response[0], 'gorevid'=>$response[1], 'mesaj' => 'Mesaj Gönderimi Başarılı.'); 130 } 131 elseif ($response[0] == '20') { 132 $result = array('durum' => 0, 'kod'=>$response[0], 'mesaj' => 'Mesaj metninde ki problemden dolayı gönderilemediğini veya standart maksimum mesaj karakter sayısını geçtiğini ifade eder. '); 133 } 134 elseif ($response[0] == '30') { 135 $result = array('durum' => 0, 'kod'=>$response[0], 'mesaj' => 'Geçersiz kullanıcı adı , şifre veya kullanıcınızın API erişim izninin olmadığını gösterir. 136 $result = array('durum' => 1, 'kod' => $response[0], 'gorevid' => $response[1], 'mesaj' => 'Mesaj Gönderimi Başarılı.'); 137 } elseif ($response[0] == '20') { 138 $result = array('durum' => 0, 'kod' => $response[0], 'mesaj' => 'Mesaj metninde ki problemden dolayı gönderilemediğini veya standart maksimum mesaj karakter sayısını geçtiğini ifade eder. '); 139 } elseif ($response[0] == '30') { 140 $result = array('durum' => 0, 'kod' => $response[0], 'mesaj' => 'Geçersiz kullanıcı adı , şifre veya kullanıcınızın API erişim izninin olmadığını gösterir. 136 141 Ayrıca eğer API erişiminizde IP sınırlaması yaptıysanız ve sınırladığınız ip dışında gönderim sağlıyorsanız 30 hata kodunu alırsınız. API erişim izninizi veya IP sınırlamanızı , web arayüzümüzden; sağ üst köşede bulunan ayarlar> API işlemleri menüsunden kontrol edebilirsiniz.'); 137 } 138 elseif ($response[0] == '40') { 139 $result = array('durum' => 0, 'kod'=>$response[0], 'mesaj' => 'Mesaj başlığınızın (gönderici adınızın) sistemde tanımlı olmadığını ifade eder. Gönderici adlarınızı API ile sorgulayarak kontrol edebilirsiniz.'); 140 }elseif ($response[0] == '50') { 141 $result = array('durum' => 0, 'kod'=>$response[0], 'mesaj' => 'Gönderilen numarayı kontrol ediniz.'); 142 }elseif ($response[0] == '51') { 143 $result = array('durum' => 0, 'kod'=>$response[0], 'mesaj' => 'Tanımlı İYS marka bilgisi bulunamadı, kontrol ediniz.'); 144 } 145 elseif ($response[0] == '60') { 146 $result = array('durum' => 0, 'kod'=>$response[0], 'mesaj' => 'Hesabınızda OTP SMS Paketi tanımlı değildir, kontrol ediniz.'); 142 } elseif ($response[0] == '40') { 143 $result = array('durum' => 0, 'kod' => $response[0], 'mesaj' => 'Mesaj başlığınızın (gönderici adınızın) sistemde tanımlı olmadığını ifade eder. Gönderici adlarınızı API ile sorgulayarak kontrol edebilirsiniz.'); 144 } elseif ($response[0] == '50') { 145 $result = array('durum' => 0, 'kod' => $response[0], 'mesaj' => 'Gönderilen numarayı kontrol ediniz.'); 146 } elseif ($response[0] == '51') { 147 $result = array('durum' => 0, 'kod' => $response[0], 'mesaj' => 'Tanımlı İYS marka bilgisi bulunamadı, kontrol ediniz.'); 148 } elseif ($response[0] == '60') { 149 $result = array('durum' => 0, 'kod' => $response[0], 'mesaj' => 'Hesabınızda OTP SMS Paketi tanımlı değildir, kontrol ediniz.'); 147 150 } elseif ($response[0] == '70') { 148 $result = array('durum' => 0, 'kod' =>$response[0], 'mesaj' => 'Hatalı sorgulama. Gönderdiğiniz parametrelerden birisi hatalı veya zorunlu alanlardan birinin eksik olduğunu ifade eder.');151 $result = array('durum' => 0, 'kod' => $response[0], 'mesaj' => 'Hatalı sorgulama. Gönderdiğiniz parametrelerden birisi hatalı veya zorunlu alanlardan birinin eksik olduğunu ifade eder.'); 149 152 } elseif ($response[0] == '80') { 150 $result = array('durum' => 0, 'kod'=>$response[0], 'mesaj' => 'Sorgulama sınır aşımı.(dakikada 100 adet gönderim yapılabilir.)'); 151 } 152 else { 153 $result = array('durum' => 0, 'kod'=>$response[0], 'mesaj' => 'Bilinmeyen bir hatadan dolayı mesaj gönderilemedi.'); 153 $result = array('durum' => 0, 'kod' => $response[0], 'mesaj' => 'Sorgulama sınır aşımı.(dakikada 100 adet gönderim yapılabilir.)'); 154 } else { 155 $result = array('durum' => 0, 'kod' => $response[0], 'mesaj' => 'Bilinmeyen bir hatadan dolayı mesaj gönderilemedi.'); 154 156 } 155 157 return $result; 156 158 } 157 159 158 public function getSmsBaslik(){ //WP USE 159 $PostAdress = "https://api.netgsm.com.tr/sms/header/get/?usercode=$this->usercode&password=$this->password&appkey=".$this->appkey; 160 public function getSmsBaslik() 161 { //WP USE 162 $PostAdress = "https://api.netgsm.com.tr/sms/header/get/?usercode=$this->usercode&password=$this->password&appkey=" . $this->appkey; 160 163 $result = wp_remote_get($PostAdress); 161 164 return $this->getSmsBaslikSonuc($this->responseDecoder($result)['body']); 162 165 } 163 166 164 private function getSmsBaslikSonuc($response){ 165 if($response==30){ 167 private function getSmsBaslikSonuc($response) 168 { 169 if ($response == 30) { 166 170 return 'Geçersiz kullanıcı adı , şifre veya kullanıcınızın API erişim izninin olmadığını gösterir. 167 171 Ayrıca eğer API erişiminizde IP sınırlaması yaptıysanız ve sınırladığınız ip dışında gönderim sağlıyorsanız 30 hata kodunu alırsınız. API erişim izninizi veya IP sınırlamanızı , web arayüzümüzden; sağ üst köşede bulunan ayarlar> API işlemleri menüsunden kontrol edebilirsiniz.'; 168 } else{169 $result = explode('<br>', $response);172 } else { 173 $result = explode('<br>', $response); 170 174 return $result; 171 175 } 172 176 } 173 177 174 private function getKrediSonuc($data){ 175 $response = explode(' ',$data); 178 private function getKrediSonuc($data) 179 { 180 $response = explode(' ', $data); 176 181 $errorCode = $response[0]; 177 if ($errorCode==30){182 if ($errorCode == 30) { 178 183 $result = '30Geçersiz kullanıcı adı , şifre veya kullanıcınızın API erişim izninin olmadığını gösterir. 179 184 Ayrıca eğer API erişiminizde IP sınırlaması yaptıysanız ve sınırladığınız ip dışında gönderim sağlıyorsanız 30 hata kodunu alırsınız. API erişim izninizi veya IP sınırlamanızı , web arayüzümüzden; sağ üst köşede bulunan ayarlar> API işlemleri menüsunden kontrol edebilirsiniz.'; 180 } elseif($errorCode==40){185 } elseif ($errorCode == 40) { 181 186 $result = '40Arama kriterlerinize göre listelenecek kayıt olmadığını ifade eder.'; 182 } elseif($errorCode==70){187 } elseif ($errorCode == 70) { 183 188 $result = '70Hatalı sorgulama. Gönderdiğiniz parametrelerden birisi hatalı veya zorunlu alanlardan birinin eksik olduğunu ifade eder.'; 184 } else{185 $result = '99' .$response[1];189 } else { 190 $result = '99' . $response[1]; 186 191 } 187 192 return $result; 188 193 } 189 194 190 public function addContact($first_name, $last_name, $phone, $groupname = 'Müşteriler', $tags = []) { //WP USE 191 $xml = array('body'=>'<?xml version="1.0" encoding="iso-8859-9"?> 192 <main> 193 <usercode>'.$this->usercode.'</usercode> 194 <pwd>'.$this->password.'</pwd> 195 <appkey>'.$this->appkey.'</appkey> 196 <grup>'.$groupname.'</grup> 197 <tel> 198 <ad><![CDATA['.$first_name.']]></ad> 199 <soyad><![CDATA['.$last_name.']]></soyad> 200 <telefon><![CDATA['.$phone.']]></telefon> 201 '. 202 (isset($tags['aciklama'])?'<aciklama><![CDATA['.$tags['aciklama'].']]></aciklama> 203 ':'') . 204 (isset($tags['hitap'])?' <hitap><![CDATA['.$tags['hitap'].']]></hitap> 205 ':'') . 206 (isset($tags['tckimlik'])?' <tckimlik><![CDATA['.$tags['tckimlik'].']]></tckimlik> 207 ':'') . 208 (isset($tags['dtarih'])?' <dtarih><![CDATA['.$tags['dtarih'].']]></dtarih> 209 ':'') . 210 (isset($tags['etarih'])?' <etarih><![CDATA['.$tags['etarih'].']]></etarih> 211 ':'') . 212 (isset($tags['unvan'])?' <unvan><![CDATA['.$tags['unvan'].']]></unvan> 213 ':'') . 214 (isset($tags['email'])?' <email><![CDATA['.$tags['email'].']]></email> 215 ':'') . 216 (isset($tags['sabittel'])?' <sabittel><![CDATA['.$tags['sabittel'].']]></sabittel> 217 ':'') . 218 (isset($tags['faxtel'])?' <faxtel><![CDATA['.$tags['faxtel'].']]></faxtel> 219 ':'') . 220 (isset($tags['cinsiyet'])?' <cinsiyet><![CDATA['.$tags['cinsiyet'].']]></cinsiyet> 221 ':'') . 222 (isset($tags['kangrubu'])?' <kangrubu><![CDATA['.$tags['kangrubu'].']]></kangrubu> 223 ':'') . 224 (isset($tags['ulke'])?' <ulke><![CDATA['.$tags['ulke'].']]></ulke> 225 ':'') . 226 (isset($tags['sehir'])?' <sehir><![CDATA['.$tags['sehir'].']]></sehir> 227 ':'') . 228 (isset($tags['sokak'])?' <sokak><![CDATA['.$tags['sokak'].']]></sokak> 229 ':'') . 230 (isset($tags['ekbilgi1'])?' <ekbilgi1><![CDATA['.$tags['ekbilgi1'].']]></ekbilgi1> 231 ':'') . 232 (isset($tags['ekbilgi2'])?' <ekbilgi2><![CDATA['.$tags['ekbilgi2'].']]></ekbilgi2> 233 ':'') . 234 (isset($tags['ekbilgi3'])?' <ekbilgi3><![CDATA['.$tags['ekbilgi3'].']]></ekbilgi3> 235 ':'') . 236 (isset($tags['semt'])?' <semt><![CDATA['.$tags['semt'].']]></semt>':'') 237 238 .' 239 </tel> 240 </main>'); 241 $response = wp_remote_post( 'http://api.netgsm.com.tr/contacts/group/add', $xml ); 242 if (file_exists('tags.txt')) { 243 unlink('tags.txt'); 244 } 245 return $this->responseDecoder($response)['body']; 246 } 247 248 public function netgsm_GetKredi($user,$pass) { //WP USE 249 $response = wp_remote_get( "https://api.netgsm.com.tr/get_kredi.asp?usercode=$user&password=$pass&appkey=".$this->appkey ); 195 196 197 public function netgsm_GetKredi($user, $pass) 198 { //WP USE 199 $response = wp_remote_get("https://api.netgsm.com.tr/get_kredi.asp?usercode=$user&password=$pass&appkey=" . $this->appkey); 250 200 $data = explode(' ', $this->responseDecoder($response)['body']); 251 if ($data[0]!='30') {252 if (isset($data[2]) && isset($data[2])=='AdetSMS')201 if ($data[0] != '30') { 202 if (isset($data[2]) && isset($data[2]) == 'AdetSMS') 253 203 $tip = 'SMS'; 254 204 else 255 205 $tip = 'Kredi'; 256 206 if ($data[1] > 0) { 257 $result = array('giris' =>'success', 'durum' => 'success', 'mesaj'=>'', 'kredi' => $data[1], 'tipmsj' => ' Kalan '.$tip);207 $result = array('giris' => 'success', 'durum' => 'success', 'mesaj' => '', 'kredi' => $data[1], 'tipmsj' => ' Kalan ' . $tip); 258 208 } else { 259 $result = array('giris'=>'success', 'durum' => 'warning', 'mesaj'=>' Bakiye Satın Al', 'kredi' => $data[1], 'tipmsj' => ' Kalan '.$tip); 260 } 261 } 262 else{ 263 $result = array('giris'=>'error', 'durum'=>'error', 'mesaj'=>'Geçersiz kullanıcı adı , şifre veya kullanıcınızın API erişim izninin olmadığını gösterir.'); 209 $result = array('giris' => 'success', 'durum' => 'warning', 'mesaj' => ' Bakiye Satın Al', 'kredi' => $data[1], 'tipmsj' => ' Kalan ' . $tip); 210 } 211 } else { 212 $result = array('giris' => 'error', 'durum' => 'error', 'mesaj' => 'Geçersiz kullanıcı adı , şifre veya kullanıcınızın API erişim izninin olmadığını gösterir.'); 264 213 } 265 214 return $result; 266 215 } 267 216 268 public function netgsm_GetPaket($user,$pass) { //WP USE 269 $response = wp_remote_get( "https://api.netgsm.com.tr/get_kredi.asp?usercode=$user&password=$pass&tip=1&appkey=".$this->appkey ); 217 public function netgsm_GetPaket($user, $pass) 218 { //WP USE 219 $response = wp_remote_get("https://api.netgsm.com.tr/get_kredi.asp?usercode=$user&password=$pass&tip=1&appkey=" . $this->appkey); 270 220 $data = explode(' ', $this->responseDecoder($response)['body']); 271 if($data[0]=='30') { 272 $result = array('giris'=>'error', 'durum'=>'error', 'mesaj'=>'Geçersiz kullanıcı adı , şifre veya kullanıcınızın API erişim izninin olmadığını gösterir.'); 273 } 274 elseif ($data[0]=='40') { 275 $result = array('giris'=>'success', 'durum'=>'error', 'mesaj'=>'Arama kriterlerinize göre listelenecek kayıt olmadığını ifade eder.'); 276 } 277 else { 221 if ($data[0] == '30') { 222 $result = array('giris' => 'error', 'durum' => 'error', 'mesaj' => 'Geçersiz kullanıcı adı , şifre veya kullanıcınızın API erişim izninin olmadığını gösterir.'); 223 } elseif ($data[0] == '40') { 224 $result = array('giris' => 'success', 'durum' => 'error', 'mesaj' => 'Arama kriterlerinize göre listelenecek kayıt olmadığını ifade eder.'); 225 } else { 278 226 if ($data[0] > 0) { 279 $result = array('giris'=>'success', 'durum' => 'success', 'mesaj'=>'', 'kredi' => $data[0], 'tipmsj' => ' Kalan SMS'); // sms 280 } 281 else{ 282 $result = array('giris'=>'success', 'durum' => 'warning', 'mesaj'=>' Bakiye Satın Al', 'kredi' => $data[0], 'tipmsj' => ' Kalan SMS'); 227 $result = array('giris' => 'success', 'durum' => 'success', 'mesaj' => '', 'kredi' => $data[0], 'tipmsj' => ' Kalan SMS'); // sms 228 } else { 229 $result = array('giris' => 'success', 'durum' => 'warning', 'mesaj' => ' Bakiye Satın Al', 'kredi' => $data[0], 'tipmsj' => ' Kalan SMS'); 283 230 } 284 231 } … … 286 233 } 287 234 288 public function netgsm_GirisSorgula($user,$pass) //WP USE 289 { 290 $response = $this->netgsm_GetKredi($user,$pass); 291 if($response['giris']=='success') { //Giriş Başarılı 292 if($response['durum']=='success') { //kredi varsa 293 $result = array('durum' => 'success', 235 public function netgsm_GirisSorgula($user, $pass) //WP USE 236 { 237 $response = $this->netgsm_GetKredi($user, $pass); 238 if ($response['giris'] == 'success') { //Giriş Başarılı 239 if ($response['durum'] == 'success') { //kredi varsa 240 $result = array( 241 'durum' => 'success', 294 242 'icon' => 'fa-chech', 295 'mesaj' => $response['tipmsj']." : ".$response['kredi'], 296 'btnkontrol'=>'enabled', 297 'href'=>'' ); 298 } 299 else{ //kredi yoksa 300 $getpackage = $this->netgsm_GetPaket($user,$pass); 301 if($getpackage['giris']=='success') { //giriş başarılı 302 if($getpackage['durum']=='success') { //kredi varsa 303 $result = array('durum' => 'success', 243 'mesaj' => $response['tipmsj'] . " : " . $response['kredi'], 244 'btnkontrol' => 'enabled', 245 'href' => '' 246 ); 247 } else { //kredi yoksa 248 $getpackage = $this->netgsm_GetPaket($user, $pass); 249 if ($getpackage['giris'] == 'success') { //giriş başarılı 250 if ($getpackage['durum'] == 'success') { //kredi varsa 251 $result = array( 252 'durum' => 'success', 304 253 'icon' => 'fa-check', 305 'mesaj' => "<i class='fa fa-envelope-o'></i> ". ' SMS Bakiyeniz : '.$getpackage['kredi'], 306 'btnkontrol'=>'enabled', 307 'href'=>'' ); 308 } 309 else { //kredi yoksa satın almaya yönlendir (Hem kredi hem paket yok.) 310 $result = array('durum' => 'warning', 254 'mesaj' => "<i class='fa fa-envelope-o'></i> " . ' SMS Bakiyeniz : ' . $getpackage['kredi'], 255 'btnkontrol' => 'enabled', 256 'href' => '' 257 ); 258 } else { //kredi yoksa satın almaya yönlendir (Hem kredi hem paket yok.) 259 $result = array( 260 'durum' => 'warning', 311 261 'icon' => 'fa-shopping-cart', 312 'mesaj' => ' Krediniz:'.$response['kredi'].'. Kredi satın al <i class=\'fa fa-external-link\'></i>', 313 'btnkontrol'=>'enabled', 314 'href'=>'https://www.netgsm.com.tr/webportal/satis_arayuzu/paketler.php' ); 262 'mesaj' => ' Krediniz:' . $response['kredi'] . '. Kredi satın al <i class=\'fa fa-external-link\'></i>', 263 'btnkontrol' => 'enabled', 264 'href' => 'https://www.netgsm.com.tr/webportal/satis_arayuzu/paketler.php' 265 ); 315 266 } 316 267 } 317 268 } 318 } 319 else { // giriş başarısız 320 if(empty($user) && !empty($pass)) 321 $message = " Kullanıcı adı alanı boş."; 269 } else { // giriş başarısız 270 if (empty($user) && !empty($pass)) 271 $message = " Kullanıcı adı alanı boş."; 322 272 elseif (empty($pass) && !empty($user)) 323 273 $message = " Şifre alanı boş."; … … 327 277 $message = " Kullanıcı adı veya şifreniz hatalı."; 328 278 } 329 $result = array('durum' => 'danger', 279 $result = array( 280 'durum' => 'danger', 330 281 'icon' => 'fa-exclamation-triangle', 331 282 'mesaj' => $message, 332 283 'btnkontrol' => 'disabled', 333 'href' => ''); 284 'href' => '' 285 ); 334 286 } 335 287 return json_encode($result); 336 288 } 337 289 338 private function inboxResponse($data){ 290 private function inboxResponse($data) 291 { 339 292 $result = array(); 340 293 $result['status'] = "400"; 341 294 $i = 1; 342 if ($data == 30){295 if ($data == 30) { 343 296 $result['message'] = " Geçersiz kullanıcı adı , şifre veya kullanıcınızın API erişim izninin olmadığını gösterir. 344 297 Ayrıca eğer API erişiminizde IP sınırlaması yaptıysanız ve sınırladığınız ip dışında gönderim sağlıyorsanız 30 hata kodunu alırsınız. API erişim izninizi veya IP sınırlamanızı , web arayüzümüzden; sağ üst köşede bulunan ayarlar> API işlemleri menüsunden kontrol edebilirsiniz."; 345 } 346 elseif ($data == 40){ 298 } elseif ($data == 40) { 347 299 $result['message'] = " Gösterilecek mesajınızın olmadığını ifade eder. Api ile mesajlarınızı eğer startdate ve stopdate parametlerini kullanmıyorsanız sadece bir kere listeyebilirsiniz. Listelenen mesajlar diğer sorgulamalarınızda gelmez."; 348 } 349 elseif ($data == 50){ 300 } elseif ($data == 50) { 350 301 $result['message'] = " Tarih formatı hatalıdır."; 351 } 352 elseif ($data == 51){ 302 } elseif ($data == 51) { 353 303 $result['message'] = " Tanımlı İYS marka kodu bilgisi bulunamadı."; 354 } 355 elseif ($data == 60){ 304 } elseif ($data == 60) { 356 305 $result['message'] = " Arama kiterlerindeki startdate ve stopdate zaman farkının 30 günden fazla olduğunu ifade eder."; 357 } 358 elseif ($data == 70){ 306 } elseif ($data == 70) { 359 307 $result['message'] = " Hatalı sorgulama. Gönderdiğiniz parametrelerden birisi hatalı veya zorunlu alanlardan birinin eksik olduğunu ifade eder."; 360 } 361 else { 308 } else { 362 309 $parts = explode('<br>', $data); 363 310 … … 376 323 } 377 324 378 public function inbox(){ 325 public function inbox() 326 { 379 327 $xml = array('body' => '<?xml version="1.0"?> 380 328 <mainbody> 381 329 <header> 382 330 <company>Netgsm</company> 383 <usercode>' .$this->usercode.'</usercode>384 <password>' .$this->password.'</password>385 <appkey>' .$this->appkey.'</appkey>386 <startdate>' .date('dmYHi', time() - 60*60*24*30).'</startdate>387 <stopdate>' .date('dmYHi', time() + 60*60*24).'</stopdate>331 <usercode>' . $this->usercode . '</usercode> 332 <password>' . $this->password . '</password> 333 <appkey>' . $this->appkey . '</appkey> 334 <startdate>' . date('dmYHi', time() - 60 * 60 * 24 * 30) . '</startdate> 335 <stopdate>' . date('dmYHi', time() + 60 * 60 * 24) . '</stopdate> 388 336 <type>0</type> 389 337 </header> 390 338 </mainbody>'); 391 $response = wp_remote_post( 'https://api.netgsm.com.tr/sms/receive/xml', $xml);339 $response = wp_remote_post('https://api.netgsm.com.tr/sms/receive/xml', $xml); 392 340 return $this->inboxResponse($this->responseDecoder($response)['body']); 393 341 } 394 342 395 public function phoneToUser($phone, $users){ 343 public function phoneToUser($phone, $users) 344 { 396 345 $result = array(); 397 346 foreach ($users as $user) { 398 if ($user->billing_phone==$phone){347 if ($user->billing_phone == $phone) { 399 348 $result = $user; 400 349 break; 401 } 402 else { 350 } else { 403 351 $result = 0; 404 352 } … … 414 362 { 415 363 date_default_timezone_set('Europe/Istanbul'); 416 $startDate = date('dmYHi', time() - 60 *60*24);364 $startDate = date('dmYHi', time() - 60 * 60 * 24); 417 365 $endDate = date('dmYHi', time()); 418 366 $PostAdress = 'https://api.netgsm.com.tr/netsantral/report/xml'; … … 421 369 <header> 422 370 <company>Netgsm</company> 423 <usercode>" .$this->usercode."</usercode>424 <password>" .$this->password."</password>371 <usercode>" . $this->usercode . "</usercode> 372 <password>" . $this->password . "</password> 425 373 <appkey>'.$this->appkey.'</appkey> 426 <startdate>" .$startDate."</startdate>427 <stopdate>" .$endDate."</stopdate>374 <startdate>" . $startDate . "</startdate> 375 <stopdate>" . $endDate . "</stopdate> 428 376 <version>3</version> 429 377 </header> 430 378 </mainbody>"); 431 $results = wp_remote_post($PostAdress, $xml);379 $results = wp_remote_post($PostAdress, $xml); 432 380 $results = $this->responseDecoder($results)['body']; 433 381 434 if ($results != '' && in_array(trim($results), [100, 101])){435 $response = ['error' =>['code'=>trim($results), 'message'=>'Dakikada en fazla 2 kez sorgulanabilir.']];436 return json_encode($response, 256);437 } 438 if ($results != '' && in_array(trim($results), [40])) {439 $response = ['error' =>['code'=>trim($results), 'message'=>'Son 24 saat içinde listelenecek kayıt yok.']];440 return json_encode($response, 256);441 } 442 if ($results != '' && in_array(trim($results), [30])) {443 $response = ['error' =>['code'=>trim($results), 'message'=>'Geçersiz kullanıcı adı, şifre veya kullanıcınızın API erişim izniniz yok.']];444 return json_encode($response, 256);445 } 446 447 if ($results != '' && in_array(trim($results), [50])) {448 $response = ['error' =>['code'=>trim($results), 'message'=>'Tarih formatının hatalı.']];449 return json_encode($response, 256);450 } 451 452 if ($results != '' && in_array(trim($results), [60])) {453 $response = ['error' =>['code'=>trim($results), 'message'=>'Zaman farkının 7 günden fazla']];454 return json_encode($response, 256);455 } 456 457 if ($results != '' && in_array(trim($results), [70])) {458 $response = ['error' =>['code'=>trim($results), 'message'=>'Hatalı sorgulama.']];459 return json_encode($response, 256);460 } 461 462 if ($results != '' && in_array(trim($results), [80])) {463 $response = ['error' =>['code'=>trim($results), 'message'=>'Netsantral hizmeti kullanılmıyor.']];464 return json_encode($response, 256);382 if ($results != '' && in_array(trim($results), [100, 101])) { 383 $response = ['error' => ['code' => trim($results), 'message' => 'Dakikada en fazla 2 kez sorgulanabilir.']]; 384 return json_encode($response, 256); 385 } 386 if ($results != '' && in_array(trim($results), [40])) { 387 $response = ['error' => ['code' => trim($results), 'message' => 'Son 24 saat içinde listelenecek kayıt yok.']]; 388 return json_encode($response, 256); 389 } 390 if ($results != '' && in_array(trim($results), [30])) { 391 $response = ['error' => ['code' => trim($results), 'message' => 'Geçersiz kullanıcı adı, şifre veya kullanıcınızın API erişim izniniz yok.']]; 392 return json_encode($response, 256); 393 } 394 395 if ($results != '' && in_array(trim($results), [50])) { 396 $response = ['error' => ['code' => trim($results), 'message' => 'Tarih formatının hatalı.']]; 397 return json_encode($response, 256); 398 } 399 400 if ($results != '' && in_array(trim($results), [60])) { 401 $response = ['error' => ['code' => trim($results), 'message' => 'Zaman farkının 7 günden fazla']]; 402 return json_encode($response, 256); 403 } 404 405 if ($results != '' && in_array(trim($results), [70])) { 406 $response = ['error' => ['code' => trim($results), 'message' => 'Hatalı sorgulama.']]; 407 return json_encode($response, 256); 408 } 409 410 if ($results != '' && in_array(trim($results), [80])) { 411 $response = ['error' => ['code' => trim($results), 'message' => 'Netsantral hizmeti kullanılmıyor.']]; 412 return json_encode($response, 256); 465 413 } 466 414 … … 472 420 $cdr = explode('|', $result); 473 421 $temp = []; 474 if (isset($cdr[0]) && $cdr[0] != '') {422 if (isset($cdr[0]) && $cdr[0] != '') { 475 423 $temp['call_id'] = $cdr[0]; 476 424 $temp['date'] = $cdr[1]; … … 483 431 } 484 432 } 485 $json['success'] = ['message' =>'Son 24 saatin kayıtları listeleniyor.'];433 $json['success'] = ['message' => 'Son 24 saatin kayıtları listeleniyor.']; 486 434 $json['data'] = $response; 487 435 488 return json_encode($json, 256);436 return json_encode($json, 256); 489 437 } 490 438 … … 496 444 { 497 445 date_default_timezone_set('Europe/Istanbul'); 498 $startDate = date('dmYHi', time() - 60 *60*24);446 $startDate = date('dmYHi', time() - 60 * 60 * 24); 499 447 $endDate = date('dmYHi', time()); 500 448 $PostAdress = 'https://api.netgsm.com.tr/voice/report/xml'; … … 503 451 <header> 504 452 <company>Netgsm</company> 505 <usercode>" .$this->usercode."</usercode>506 <password>" .$this->password."</password>453 <usercode>" . $this->usercode . "</usercode> 454 <password>" . $this->password . "</password> 507 455 <date></date> 508 456 <direction>4</direction> 509 457 </header> 510 458 </mainbody>"); 511 $results = wp_remote_post($PostAdress, $xml);459 $results = wp_remote_post($PostAdress, $xml); 512 460 $results = $this->responseDecoder($results)['body']; 513 461 514 462 515 if ($results != '' && in_array(trim($results), [100, 101])){516 $response = ['error' =>['code'=>trim($results), 'message'=>'Dakikada en fazla 2 kez sorgulanabilir.']];517 return json_encode($response, 256);518 } 519 if ($results != '' && in_array(trim($results), [40])) {520 $response = ['error' =>['code'=>trim($results), 'message'=>'Son 24 saat içinde listelenecek kayıt yok.']];521 return json_encode($response, 256);522 } 523 if ($results != '' && in_array(trim($results), [30])) {524 $response = ['error' =>['code'=>trim($results), 'message'=>'Geçersiz kullanıcı adı, şifre veya kullanıcınızın API erişim izniniz yok.']];525 return json_encode($response, 256);526 } 527 528 if ($results != '' && in_array(trim($results), [50])) {529 $response = ['error' =>['code'=>trim($results), 'message'=>'Tarih formatının hatalı.']];530 return json_encode($response, 256);531 } 532 533 if ($results != '' && in_array(trim($results), [70])) {534 $response = ['error' =>['code'=>trim($results), 'message'=>'Hatalı sorgulama.']];535 return json_encode($response, 256);463 if ($results != '' && in_array(trim($results), [100, 101])) { 464 $response = ['error' => ['code' => trim($results), 'message' => 'Dakikada en fazla 2 kez sorgulanabilir.']]; 465 return json_encode($response, 256); 466 } 467 if ($results != '' && in_array(trim($results), [40])) { 468 $response = ['error' => ['code' => trim($results), 'message' => 'Son 24 saat içinde listelenecek kayıt yok.']]; 469 return json_encode($response, 256); 470 } 471 if ($results != '' && in_array(trim($results), [30])) { 472 $response = ['error' => ['code' => trim($results), 'message' => 'Geçersiz kullanıcı adı, şifre veya kullanıcınızın API erişim izniniz yok.']]; 473 return json_encode($response, 256); 474 } 475 476 if ($results != '' && in_array(trim($results), [50])) { 477 $response = ['error' => ['code' => trim($results), 'message' => 'Tarih formatının hatalı.']]; 478 return json_encode($response, 256); 479 } 480 481 if ($results != '' && in_array(trim($results), [70])) { 482 $response = ['error' => ['code' => trim($results), 'message' => 'Hatalı sorgulama.']]; 483 return json_encode($response, 256); 536 484 } 537 485 … … 544 492 $cdr = explode(' | ', $result); 545 493 $temp = []; 546 if (isset($cdr[0]) && $cdr[0] != '') {494 if (isset($cdr[0]) && $cdr[0] != '') { 547 495 $temp['caller_number'] = $cdr[0]; 548 496 $temp['date'] = $cdr[1]; … … 552 500 } 553 501 } 554 $json['success'] = ['message' =>'Bugünün kayıtları listeleniyor.'];502 $json['success'] = ['message' => 'Bugünün kayıtları listeleniyor.']; 555 503 $json['data'] = $response; 556 504 557 return json_encode($json,256); 558 } 559 560 public function setContact($datas, $groupName = 'Opencart') 561 { 562 if (count($datas)>500){ 563 $contacts = array_chunk($datas, 500); 564 565 foreach ($contacts as $key=>$contact) { 566 $this->addContacts($contact, $groupName); 567 } 568 } else { 569 return $this->addContacts($datas, $groupName); 570 } 571 return true; 572 } 573 574 575 576 public function addContacts($datas, $groupName = 'Wordpress') 577 { 578 $body = ''; 579 $request_url = 'http://api.netgsm.com.tr/contacts/group/add'; 580 foreach ($datas as $data) { 581 $telephone = $this->getphoneClear($data['telephone']); 582 $body .= '<tel> 583 <ad><![CDATA['.$data['firstname'].']]></ad> 584 <soyad><![CDATA['.$data['lastname'].']]></soyad> 585 <telefon><![CDATA['.$telephone.']]></telefon> 586 </tel>'; 587 } 588 589 590 $xml = array('body'=> '<?xml version="1.0" encoding="iso-8859-9"?> 591 <main> 592 <usercode>'.$this->usercode.'</usercode> 593 <pwd>'.$this->password.'</pwd> 594 <appkey>'.$this->appkey.'</appkey> 595 <grup>'.$groupName.'</grup> 596 '.$body.' 597 </main>'); 598 599 $response = wp_remote_post( $request_url, $xml ); 600 if (file_exists('tags.txt')) { 601 unlink('tags.txt'); 602 } 603 return $this->responseDecoder($response)['body']; 604 } 605 606 public function getphoneClear($phone){ 607 $unwanted = array(' ', '+', '(', ')', '.', '-', '&', 'nbsp;' ); 608 $replace = array('', '', '', '', '', '', '', '' ); 505 return json_encode($json, 256); 506 } 507 508 509 510 511 512 513 514 public function getphoneClear($phone) 515 { 516 $unwanted = array(' ', '+', '(', ')', '.', '-', '&', 'nbsp;'); 517 $replace = array('', '', '', '', '', '', '', ''); 609 518 $result = str_replace($unwanted, $replace, $phone); 610 519 return $result; 611 520 } 612 521 613 public function timeconvert($time){ 614 if($time<60){ 522 public function timeconvert($time) 523 { 524 if ($time < 60) { 615 525 $second = ceil($time); 616 if ($second<10){617 $second = '0' .$second;618 } 619 return '00:00:' .$second;620 } 621 $minute = floor($time /60);622 $second = $time %60;623 if ($minute<60){624 if ($minute<10){625 $minute = '0' .$minute;626 } 627 if ($second<10){628 $second = '0' .$second;629 } 630 return '00:' .$minute.':'.$second;631 } 632 $hour = floor($minute /60);633 $minute = $minute %60;634 if ($hour<10){635 $hour = '0' .$hour;636 } 637 if ($minute<10){638 $minute = '0' .$minute;639 } 640 if ($second<10){641 $second = '0' .$second;642 } 643 return $hour .':'.$minute.':'.$second;526 if ($second < 10) { 527 $second = '0' . $second; 528 } 529 return '00:00:' . $second; 530 } 531 $minute = floor($time / 60); 532 $second = $time % 60; 533 if ($minute < 60) { 534 if ($minute < 10) { 535 $minute = '0' . $minute; 536 } 537 if ($second < 10) { 538 $second = '0' . $second; 539 } 540 return '00:' . $minute . ':' . $second; 541 } 542 $hour = floor($minute / 60); 543 $minute = $minute % 60; 544 if ($hour < 10) { 545 $hour = '0' . $hour; 546 } 547 if ($minute < 10) { 548 $minute = '0' . $minute; 549 } 550 if ($second < 10) { 551 $second = '0' . $second; 552 } 553 return $hour . ':' . $minute . ':' . $second; 644 554 } 645 555 646 556 private function responseDecoder($response) 647 557 { 648 if (is_array($response) && !empty($response['body'])) 649 { 558 if (is_array($response) && !empty($response['body'])) { 650 559 return $response; 651 560 } … … 657 566 public function iysadd($phone, $email, $date, $brandcode, $recipient_type, $type_array) //İYS'ye adres ekleme 658 567 { 659 if ($phone!='' || $email!='' ){568 if ($phone != '' || $email != '') { 660 569 $jsonarray = array( 661 570 "header" => array("username" => $this->usercode, "password" => $this->password, "brandCode" => $brandcode, "appkey" => $this->appkey), 662 571 "body" => array( 663 "data" => [ 664 ]665 ));666 foreach ($type_array as $typearray) {667 if ($typearray =='EPOSTA' && $email!=''){668 $address = $email;669 array_push($jsonarray['body']['data'], array(670 "type" => $typearray,671 "source" => "HS_WEB",672 "recipient" => $address,673 "status" => "ONAY",674 "consentDate" => $date,675 "recipientType" => $recipient_type676 ));572 "data" => [] 573 ) 574 ); 575 foreach ($type_array as $typearray) { 576 if ($typearray == 'EPOSTA' && $email != '') { 577 $address = $email; 578 array_push($jsonarray['body']['data'], array( 579 "type" => $typearray, 580 "source" => "HS_WEB", 581 "recipient" => $address, 582 "status" => "ONAY", 583 "consentDate" => $date, 584 "recipientType" => $recipient_type 585 )); 677 586 } 678 if($typearray!='EPOSTA' && $phone!=''){ 679 $address = $phone; 680 array_push($jsonarray['body']['data'], array( 681 "type" => $typearray, 682 "source" => "HS_WEB", 683 "recipient" => $address, 684 "status" => "ONAY", 685 "consentDate" => $date, 686 "recipientType" => $recipient_type 687 )); 688 587 if ($typearray != 'EPOSTA' && $phone != '') { 588 $address = $phone; 589 array_push($jsonarray['body']['data'], array( 590 "type" => $typearray, 591 "source" => "HS_WEB", 592 "recipient" => $address, 593 "status" => "ONAY", 594 "consentDate" => $date, 595 "recipientType" => $recipient_type 596 )); 689 597 } 690 691 598 } 692 599 … … 700 607 return $response; 701 608 } 702 703 } 704 705 public function netasistan_yenitoken($appkey,$userkey){609 } 610 611 public function netasistan_yenitoken($appkey, $userkey) 612 { 706 613 $url = "http://www.netasistan.com/napi/v1/auth"; 707 614 $response = wp_remote_post($url, array( 708 'headers' => array('Content-Type' => 'application/json; charset=utf-8', 709 'app-key' => $appkey, 710 'user-key' => $userkey 615 'headers' => array( 616 'Content-Type' => 'application/json; charset=utf-8', 617 'app-key' => $appkey, 618 'user-key' => $userkey 711 619 ), 712 620 'sslverify' => FALSE, … … 718 626 } 719 627 720 public function netasistan_ticket($ticket_name, $ticket_lastname, $ticket_number, $ticket_email, $ticket_header, $ticket_content,$ticket_etiketler, $token){ 628 public function netasistan_ticket($ticket_name, $ticket_lastname, $ticket_number, $ticket_email, $ticket_header, $ticket_content, $ticket_etiketler, $token) 629 { 721 630 722 631 $jsonarray = array( … … 733 642 $url = "https://www.netasistan.com/napi/v1/ticket"; 734 643 $response = wp_remote_post($url, array( 735 'headers' => array('Content-Type' => 'application/json; charset=utf-8', 736 'username' => $this->usercode, 737 'Authorization' => 'Bearer '.$token, 738 ), 644 'headers' => array( 645 'Content-Type' => 'application/json; charset=utf-8', 646 'username' => $this->usercode, 647 'Authorization' => 'Bearer ' . $token, 648 ), 739 649 'sslverify' => FALSE, 740 650 'body' => json_encode($jsonarray), … … 743 653 744 654 return $response; 745 746 655 } 747 656 } 748 -
netgsm/trunk/index.php
r3185627 r3191034 6 6 Author: Netgsm 7 7 Author URI: www.netgsm.com.tr 8 Version: 2.9.3 28 Version: 2.9.33 9 9 10 10 */ … … 125 125 126 126 127 128 register_setting('netgsmoptions', 'netgsm_rehber_control');129 register_setting('netgsmoptions', 'netgsm_rehber_groupname');130 127 131 128 register_setting('netgsmoptions', 'netgsm_orderstatus_change_customer_control'); … … 540 537 541 538 542 jQuery('#contactsMove').click(function () { 543 var groupName = jQuery('#contactsBulk').val(); 544 if(groupName == ''){ 545 swal({ 546 title: "BAŞARISIZ!", 547 html: 'Aktarım için grup ismi girilmelidir.', 548 type: 'error', 549 }); 550 return false; 551 } 552 showLoadingMessage('Kayıtlar aktarılıyor...'); 553 var data = { 554 'action': 'netgsm_addtoGroup', 555 'copy' :1, 556 'groupName':groupName 557 }; 558 jQuery.post(ajaxurl, data, function (response) { 559 var response = JSON.parse(response); 560 if (response['result']=='success') { 561 swal({ 562 title: "BAŞARILI!", 563 html: response['resultmsg'], 564 type: response["result"], 565 }); 566 } 567 else 568 { 569 swal({ 570 title: "HATA!", 571 text: response['resultmsg'], 572 type: response["result"], 573 }); 574 } 575 hideLoadingMessage(); 576 }); 577 578 }) 539 579 540 580 541 … … 582 543 } 583 544 584 add_action( 'wp_ajax_netgsm_addtoGroup', 'netgsm_addtoGroup' ); 585 function netgsm_addtoGroup() 586 { 587 $users = get_users(); 588 589 $phone_meta = 'billing_phone'; 590 if (esc_html(get_option("netgsm_contact_meta_key") != '')){ 591 $phone_meta = esc_html(get_option("netgsm_contact_meta_key")); 592 } 593 594 $contacts = []; $tmp = []; 595 foreach ($users as $result) { 596 $tmp['telephone'] = sanitize_text_field(get_user_meta($result->ID, $phone_meta, true)); 597 if ($tmp['telephone'] == ''){ 598 continue; 599 } 600 601 $tmp['firstname'] = sanitize_text_field($result->first_name); 602 $tmp['lastname'] = sanitize_text_field($result->last_name); 603 604 array_push($contacts, $tmp); 605 } 606 607 $netgsm = new Netgsmsms(sanitize_text_field(get_option("netgsm_user")), sanitize_text_field(get_option("netgsm_pass")), sanitize_text_field(get_option('netgsm_input_smstitle')), sanitize_text_field(get_option("netgsm_trChar"))); 608 609 $groupName = 'Wordpress'; 610 611 // Check if 'groupName' is set in POST request 612 if (isset($_POST['groupName'])) { 613 // Sanitize the input to remove harmful characters 614 $groupName = sanitize_text_field($_POST['groupName']); 615 } 616 617 618 // İşlem gerçekleştir 619 $moving = $netgsm->setContact($contacts, $groupName); 620 621 // JSON çıktısı verirken HTML etiketlerinden kaçının 622 $response = [ 623 'result' => 'success', 624 'resultmsg' => sprintf( 625 'Toplam <b>%d</b> kullanıcı <b>%s</b> grubuna aktarıldı.', 626 count($contacts), 627 esc_html($groupName) 628 ) 629 ]; 630 631 echo json_encode($response); 632 wp_die(); 633 } 545 634 546 635 547 add_action( 'wp_ajax_netgsm_getNetsantral_Report', 'netgsm_getNetsantral_Report' ); … … 1655 1567 } 1656 1568 1657 function netgsm_add_contact($customer_id) 1658 { 1659 $grupcontrol = esc_html(get_option('netgsm_rehber_control')); 1660 $groupname = esc_html(get_option('netgsm_rehber_groupname')); 1661 $userinfo = get_userdata($customer_id); 1662 if(isset($grupcontrol) && !empty($grupcontrol) && $grupcontrol==1) { 1663 $netgsm = new Netgsmsms(sanitize_text_field(get_option("netgsm_user")), sanitize_text_field(get_option("netgsm_pass"))); 1664 if($userinfo->first_name=="") 1665 $firstname = "nickname"; 1666 else 1667 $firstname = $userinfo->first_name; 1668 1669 if($userinfo->last_name=="") 1670 $lastname = $userinfo->nickname; 1671 else 1672 $lastname = $userinfo->last_name; 1673 $replace = new ReplaceFunction(); 1674 $netgsm->addContact($firstname, $lastname, $replace->netgsm_spaceTrim($userinfo->billing_phone), $groupname); 1675 } 1676 } 1569 1677 1570 1678 1571 function netgsm_order_status_changed_sendSMS($order_id, $text, $this_status_transition_to) … … 1976 1869 } 1977 1870 1978 $contact_control = esc_html(get_option('netgsm_cf7_contact_control')); 1979 if (isset($contact_control) && !empty($contact_control) && $contact_control == 1) { 1980 $groupname = sanitize_text_field(get_option('netgsm_cf7_list_contact_' . $form_id)); 1981 if ($groupname != '') { 1982 $netgsm = new Netgsmsms(get_option("netgsm_user"), get_option("netgsm_pass")); 1983 $firstname_key = sanitize_text_field(get_option('netgsm_cf7_list_contact_firstname_' . $form_id)); 1984 $lastname_key = sanitize_text_field(get_option('netgsm_cf7_list_contact_lastname_' . $form_id)); 1985 $other_keys = sanitize_text_field(get_option('netgsm_cf7_list_contact_other_' . $form_id)); 1986 $firstname = $posted_data[$firstname_key]; 1987 $lastname = $posted_data[$lastname_key]; 1988 $phone_number = $posted_data['telephone']; 1989 1990 $others = explode(';', $other_keys); 1991 1992 $tags = []; 1993 foreach ($others as $other) { 1994 $item = explode(':', $other); 1995 $replace = new ReplaceFunction(); 1996 $val = $replace->netgsm_cf7_replace_all_var($posted_data, $item[1]); 1997 $key = str_replace(['[',']'], "", $item[0]); 1998 $tags[$key] = $val; 1999 } 2000 2001 $netgsm->addContact($firstname, $lastname, $phone_number, $groupname, $tags); 2002 } 2003 } 1871 2004 1872 2005 1873 } -
netgsm/trunk/pages/index.php
r3185627 r3191034 985 985 <p id="netgsm_tags_text7" style="display: none;"> 986 986 </div> 987 <div class="col-sm-9" id="netgsm_field7" style="<?php if ((get_option('netgsm_rehber_control')) != 1) { ?>display:none; <?php } ?>"> 988 <div class="row"> 989 <div class="col-sm-12"> 990 <div class="input-group"> 991 <div class="input-group-addon"> 992 <i class="fa fa-user-plus" style="color: #17A2B8;"></i> 993 </div> 994 <input name="netgsm_rehber_groupname" class="form-control" placeholder="Eklemek istediğiniz grup ismini giriniz." value="<?= esc_html(get_option("netgsm_rehber_groupname")) ?>"> 995 </div> 996 </div> 997 </div> 998 </div> 987 999 988 </div> 1000 989 </div> -
netgsm/trunk/readme.txt
r3185627 r3191034 5 5 Requires at least: 3.0 6 6 Tested up to: 6.7 7 Stable tag: 2.9.3 27 Stable tag: 2.9.33 8 8 Requires PHP: 8.0.1 9 9 License: GPLv2 or later … … 89 89 90 90 == Changelog == 91 = 2.9.33 = 92 * Hata düzeltmesi yapıldı. 91 93 = 2.9.32 = 92 94 * Hata düzeltmesi yapıldı.
Note: See TracChangeset
for help on using the changeset viewer.