/** * hataları gösterir * * @param array $error * hatalar * @param string $class * div in class ları * @return string hataların döneceği div basılacak olanı */ public static function display($error, $class = 'alert alert-danger') { if (is_array($error)) { $row = "<div class='{$class}'>"; foreach ($error as $error) { $row .= \Lib\Strings::strtoTrUcFirst($error) . '<br>'; } $row .= "</div>"; return $row; } else { if (isset($error)) { return "<div class='{$class}'>{$error}</div>"; } } }
/** * gonderilen değer ,eğer kelimede geçiyorsa onu kelime içinden çıkar * * @example $Expression='DOĞA-GÖKÇE-ÇAYKUR-DOĞA-DR.OETKER-MEHMET+EFENDİ'; * $kelime='DOĞA'; * string2unique($Expression, $kelime); * sonuc 'GÖKÇE-ÇAYKUR-DR.OETKER-MEHMET+EFENDİ'; * @param string $Expression * @param string $kelime * sonuna eklenecek olan kelime * @access public * @return array * */ public static function string2unique($Expression, $kelime) { $kelime = \Lib\Strings::cevir_artiya($kelime); $Expression = \Lib\Strings::cevir_artiya($Expression); // tekrar + işareti ver if (!empty($Expression)) { $s = explode('-', $Expression); if (in_array($kelime, $s)) { $deleted = array($kelime); $sonuc = array_diff($s, $deleted); // boşlukları sildir $yeni = array_unique($sonuc); // aynı olanları sil return implode("-", $yeni); } else { return $Expression . '-' . $kelime; } } else { return null; } }
/** * marka linkleri ile ilgili işlemlerin yapılacağı kısım * * @access view/urunler_view erişir * @param string $eklenecek_kelime * @return string */ public static function FilterLink($ozellik, $deger) { $eklenecek_kelime = \Lib\Strings::cevir_artiya($deger); $url = \Lib\Tools::currentPageURL(); $urlPathAdresi = parse_url($url, PHP_URL_PATH); $QueryName = parse_url($url, PHP_URL_QUERY); parse_str($QueryName, $query2arrayCiktisi); $dir = substr(DIR, 0, -1); // bu / işareti sil // query parametresi hiç yoksa if (!empty($QueryName)) { // eğer $_GET['marka'] değer i zaten varsa onu yedekle sonra sil if (array_key_exists($ozellik, $query2arrayCiktisi)) { // echo 'girer'; // eğer get[ozellik] boş değilse if (!empty($query2arrayCiktisi[$ozellik])) { // echo $ozellik . 'yazdı'; unset($query2arrayCiktisi['page']); // paigination değerini sil eğer silinmeseydi mesela // http://smvc.dev/kategoriler/gida_ve_icecek/sicak_icecekler?sort=artanFiyat&page=7&m=JACOPS-MEHMET+EFEND%C4%B0 bu linkde hata verir di çünkü page=7 yoktur 3 ürün var $mdegeri = $query2arrayCiktisi[$ozellik] . '-' . \Lib\Strings::cevir_artiya($eklenecek_kelime); $yeni = \Lib\Arrays::string2unique($query2arrayCiktisi[$ozellik], $eklenecek_kelime); $marka_stack = '&' . $ozellik . '=' . $yeni; unset($query2arrayCiktisi[$ozellik]); // diziden kaldır tekrar oluşan linkleme dongusüne girmesin $linkleme = ''; // m harici kalan query değerlerini de ekler diziye foreach ($query2arrayCiktisi as $key => $value) { $linkleme .= '&' . $key . '=' . $value; } $linkleme = substr($linkleme, 1); return self::LinkTemizle($dir . $urlPathAdresi . '?' . $linkleme . $marka_stack . ''); } else { $mdegeri = $query2arrayCiktisi[$ozellik] . '-' . $eklenecek_kelime; $mdegeri = substr($mdegeri, 1); // bastaki - temizle $yeni = \Lib\Strings::cevir_artiya($mdegeri); // eğer zaten kendisi var ise link içinde olmasın $marka_stack = '&' . $ozellik . '=' . $yeni; unset($query2arrayCiktisi[$ozellik]); // diziden kaldır tekrar donguye tekrar girmesin $linkleme = ''; // m harici kalan query değerlerini de ekler diziye foreach ($query2arrayCiktisi as $key => $value) { $linkleme .= '&' . $key . '=' . $value; } return self::LinkTemizle($dir . $urlPathAdresi . '?' . $linkleme . $marka_stack . ''); } } else { // m harici bir link var mı onları da al if (!empty($QueryName)) { $linkleme = ''; foreach ($query2arrayCiktisi as $key => $value) { $linkleme .= '&' . $key . '=' . $value; } } return self::LinkTemizle($dir . $urlPathAdresi . '?' . ($linkleme .= '&' . $ozellik . '=' . $eklenecek_kelime)); } } else { return self::LinkTemizle($dir . $urlPathAdresi . '?' . $ozellik . '=' . $eklenecek_kelime); } }
/** * şifremi unuttum * * @return mixed */ public function SifremiUnuttum() { if (\Lib\Session::get('loggedin')) { \Lib\Url::redirect('hesapim'); } // if (isset ( $_POST ['submit'] )) { if (Request::isPost()) { $email = $this->request->get('email'); if ($email == '') { $error[] = 'email alanı boş bırakılamaz'; } if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $error[] = 'lütfen geçerli bir email adresi yazınız '; } if (!$error) { $total = $this->_model->getEmail_Varmi($email); if ($total > 0) { $user = $this->_model->getKullaniciBilgileri($email); // print_r($user);die; $email_adresi = $user['email']; $ad_soyad = \Lib\Strings::adSoyadParcala($bilgiler['unvan']); $adi_soyadi = $ad_soyad['adi'] . ' ' . $ad_soyad['soyadi']; $user_id = $user['id']; $subject = 'İdeal.com.tr Şifre Yenileme'; $tokenkey = \Lib\Tools::token_key_olustur(); $toplam_token_adet = $this->_model->getBoyle_bir_token_varmi($tokenkey); // aynı isimde token key olabilir onu engellemek gerek if ($toplam_token_adet > 0) { $tokenkey = $tokenkey . 'st_n_ck_ey'; } $postdata = array('token_key' => $tokenkey); $where = array('id' => $user_id); $this->_model->update_tokenKey_user($postdata, $where); $message = '<a href="' . DIR . 'uyelik?action=uye_sifremiunuttum_degisiklik&token=' . $tokenkey . '">Şifre değiştirmek için tıklyayınız</a>'; $mail = new \Helpers\Mailler_Helper(); $sonuc = $mail->sendmail("*****@*****.**", $email_adresi, $adi_soyadi, $subject, $message); if (!$sonuc) { $hata = \Lib\Tools::message_ver('hata', $sonuc); \Lib\Session::set('message', $hata); // \Lib\Url::redirect('uyelik?action=sifremi_unuttum'); } else { $basarili = \Lib\Tools::message_ver('ok', 'Şifre değiştirme linki mail adresinize gönderilmiştir'); \Lib\Session::set('message', $basarili); // \Lib\Url::redirect('uyelik?action=uye_sifremiunuttum_degisiklik'); } } else { $err = 'Böyle bir e-mail adresi bulunamadi'; $hata = \Lib\Tools::message_ver('hata', $err); \Lib\Session::set('message', $hata); // \Lib\Url::redirect('uyelik?action=sifremi_unuttum'); } } } return $error; }
public static function YeniSiparisBildirimi($data, $mailYazisi) { $kullanici_bilgileri = \Lib\Session::get('kullanici_bilgileri'); $ad_soyad = \Lib\Strings::strtoTrUcFirst($kullanici_bilgileri['adi']) . ' ' . \Lib\Strings::strtoTrUcFirst($kullanici_bilgileri['soyadi']); // echo '<pre>'; extract($data); $file = self::TableStyle() . '<body bgcolor="#f6f6f6"> <strong> ' . $mailYazisi . ' </strong>' . $data['sepet'] . ' <table class="body-wrap"> <tbody> <tr class="price2"> <td class="right"><b>Toplam:</b></td> <td class="right"><a class="toplamfiyat" href="' . $data['sepet_fiyat_toplami'] . '"></a> <span class="toplamfiyatspan">' . $data['sepet_fiyat_toplami'] . ' TL</span> </td> </tr> </tbody> </table> <strong>Bilgileriniz </strong> <table class="body-wrap" border="1" cellspacing="0" cellpadding="0"> <tbody> <tr> <th>Sipariş No:</th> <td>' . $siparis_no . '</td> </tr> <tr> <th>Siparişi Oluşturan:</th> <td>' . $ad_soyad . '</td> </tr> <tr> <th>Telefon Numarası</th> <td>' . $telefon . '</td> </tr> <tr> <th>Email Adresi</th> <td>' . $email . '</td> </tr> <tr> <th>Oluşturma Zamanı:</th> <td>' . $olusturma_zamani . '</td> </tr> <tr> <th>Sipariş Durumu:</th> <td>' . $siparis_durumu . '</td> </tr> <tr> <th>Sipariş Tutarı</th> <td>' . $siparis_tutari . ' TL</td> </tr> <tr> <th>Ödeme Türü</th> <td>' . $odeme_tipi . '</td> </tr> <tr> <th>Mağaza</th> <td>' . $magaza_adi . '</td> </tr> </tbody> </table> </div> <strong>Teslimat Bilgileri </strong> <table class="body-wrap" border="1" cellspacing="0" cellpadding="0"> <tbody> <tr> <th>Teslimat Saati:</th> <td>' . $teslimat_saati . '</td> </tr> <tr> <th>Teslimat Tarihi:</th> <td>' . $teslimat_tarihi . '</td> </tr> <tr> <th>İsim Soyisim:</th> <td>' . $ad_soyad . '</td> </tr> <tr> <th>Adres:</th> <td>' . $alici_adres . ' </td> </tr> <tr> <th>Şehir ,İlçe, Semt/Mahalle</th> <td>' . $alici_il . ' , ' . $alici_ilce . ' , ' . $alici_semt . '</td> </tr> </tbody> </table> </div> <strong>Fatura Bilgileri </strong> <table class="body-wrap" border="1" cellspacing="0" cellpadding="0"> <tbody> <tr> <th>İsim Soyisim:</th> <td>' . $ad_soyad . '</td> </tr> <tr> <th>Adres:</th> <td>' . $fatura_adres . ' </td> </tr> <tr> <th>Şehir ,İlçe, Semt/Mahalle</th> <td>' . $fatura_il . ' , ' . $fatura_ilce . ' , ' . $fatura_semt . '</td> </tr> </tbody> </table> </div></body></html>'; $file = self::replaceSpace($file); return $file; }