1. sayfa
Yardımcı olabilecek varmı? "ı - ğ - ş" harfleri için replace`i yerleştirebilecke olan yokmu yawf? |
TR karakterler hiç mi görünmüyor yoksa bozuk bir formatta mı görünüyor? Eğer kullandığın mysql sürümü karakter kodlamasını destekliyorsa yapman gereken, MySQL Türkçe Karakter Problemi yazısında anlattım. Büyük ihtimalle bu nedenle karakter problemi yaşıyor olabilirsin. |
echo '<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-9">'; yukardaki kodu sitene ekle bakalım düzelicekmi. |
Sitedeki yazıya googLe`da karşılaştım.. Okudum denedim yapmaya çalıştım olmadı.. Hatta feedback`den sana mail gönderdim ama yanıtlamadın daha :) |
Maalesef olmadı.. Benim yapmak istediğim yukarıda verdiğim parse.class.php`ye ı ğ ş harflerini i g s olarak replace edecek kodların yerleştirilmeis bir türlü beceremedim de ondan buraya başlık açtım.. |
İletişimden gelen soruları olabildiğince yanıtlamaya çalışıyorum. Muhtemelen yanıtlamışımdır ama size mail gelmediyse bilemeyeceğim. Eğer yorumlara eklediyseniz mesajınızı, hazır portallar vb. için yanıt vermiyorum. Ya da önceki yorumlarda sorunun yanıtını da verdiysem yanıtlamıyorum :) Sanırım bu tarz bir nedenden ötürü yanıtlamamış olabilirim :) |
Basit bir eregi_replace ornegi vereyim, umarim isini gorur.
Buradaki ornekte W harfi V harfine ve, Şu kelimesi Bu kelimesine ceviriliyor ... |
Örneğin için çok teşekkür ederim ama elimde türlü örnekler hayli fazla ama işte daha öncede deiğim gibi bu tür işlemleri yukarıdaki parse.class.php`ye entegre edecek bilgiye ne yazıkki sahip değilim.. Yukarıdaki parse.class.php dosyasına ı ğ ş harflerini i g s olarak değiştirmeyi öngeren sistemi yerleştirebilecek olan varmı acaba? |
Sorularıma cevap verirsen yardımcı olayim zamanım olmadığı için dosyayı inciliyemiyorum. Veritabanı ile çalışan bir dosya mı? |
Kodlar içinde Sql`ile ilgili herhangi bir ibare ben göremedim.. Ama sitemde ı ğ ş harfleri kullanıldığında ortaya bir hata çıkıyordu onu burada vermedim, hatada; parse.class.php ve html_decode_entity`den söz ediyordu.. Bu hatayı yorum kullanımında verdiği için addcomments dosyasının başına error_reporting(0); getirdim.. Konu baya dağıldı ama işte tam olarak bilemiyorum veritabanı ile çalışan bir dosyamı? Yorum gönderiminden sonra verdiği için sanırsam sql`le ilgili.. |
Bunu bul: $source = preg_replace( "#\[code\](.+?)\[/code\]#ies", "\$this->code_tag( '\\1' )", $source ); Altına bunları ekle: $source = eregi_replace("W", "V", $source); $source = eregi_replace("Şu", "Bu", $source); Kırmızı ile yazılan yerleri değiştireceksin işte ... Buda çalışmazsa, scripti rapide at linkini bana pm ile bildir. Öyle bi bakalım ... Kolay gelsin ... |
Herkese teşekkür ederim sorunumun yanıtnı buradan alamadım ama çözümünü buldum arkadaşlar teşekkürler.. |
bunu php dosyasinin icine koy kardes tamamen duzelir funpic'de bile olsa <?php header ("Content-Type: text/html; charset=iso-8859-9"); ?> |
1. sayfa
http://r apid s hare.com/files/1635722/parse.class.php.rar
<?php
if(!defined('DATALIFEENGINE'))
{
die("Hacking attempt!");
}
class ParseFilter {
var $tagsArray;
var $attrArray;
var $tagsMethod;
var $attrMethod;
var $xssAuto;
var $code_text = array ();
var $code_count = 0;
var $wysiwyg = false;
var $safe_mode = false;
var $tagBlacklist = array('applet', 'body', 'bgsound', 'base', 'basefont', 'frame', 'frameset', 'head', 'html', 'id', 'iframe', 'ilayer', 'layer', 'link', 'meta', 'name', 'script', 'style', 'title', 'xml');
var $attrBlacklist = array('action', 'background', 'codebase', 'dynsrc', 'lowsrc');
function ParseFilter($tagsArray = array(), $attrArray = array(), $tagsMethod = 0, $attrMethod = 0, $xssAuto = 1) {
for ($i = 0; $i < count($tagsArray); $i++) $tagsArray[$i] = strtolower($tagsArray[$i]);
for ($i = 0; $i < count($attrArray); $i++) $attrArray[$i] = strtolower($attrArray[$i]);
$this->tagsArray = (array) $tagsArray;
$this->attrArray = (array) $attrArray;
$this->tagsMethod = $tagsMethod;
$this->attrMethod = $attrMethod;
$this->xssAuto = $xssAuto;
}
function process($source) {
if (is_array($source)) {
foreach($source as $key => $value)
if (is_string($value)) $source[$key] = $this->remove($this->decode($value));
return $source;
} elseif (is_string($source)) {
$source = $this->remove($this->decode($source));
if($this->code_count) {
foreach ($this->code_text as $key_find => $key_replace) {
$find[] = $key_find;
$replace[] = $key_replace;
}
$source = str_replace($find, $replace, $source);
}
$this->code_count = 0;
$this->code_text = array();
return $source;
} else return $source;
}
function remove($source) {
$loopCounter=0;
while($source != $this->filterTags($source)) {
$source = $this->filterTags($source);
$loopCounter++;
}
return $source;
}
function filterTags($source) {
$preTag = NULL;
$postTag = $source;
$tagOpen_start = strpos($source, '<');
while($tagOpen_start !== FALSE) {
$preTag .= substr($postTag, 0, $tagOpen_start);
$postTag = substr($postTag, $tagOpen_start);
$fromTagOpen = substr($postTag, 1);
$tagOpen_end = strpos($fromTagOpen, '>');
if ($tagOpen_end === false) break;
$tagOpen_nested = strpos($fromTagOpen, '<');
if (($tagOpen_nested !== false) && ($tagOpen_nested < $tagOpen_end)) {
$preTag .= substr($postTag, 0, ($tagOpen_nested+1));
$postTag = substr($postTag, ($tagOpen_nested+1));
$tagOpen_start = strpos($postTag, '<');
continue;
}
$tagOpen_nested = (strpos($fromTagOpen, '<') + $tagOpen_start + 1);
$currentTag = substr($fromTagOpen, 0, $tagOpen_end);
$tagLength = strlen($currentTag);
if (!$tagOpen_end) {
$preTag .= $postTag;
$tagOpen_start = strpos($postTag, '<');
}
$tagLeft = $currentTag;
$attrSet = array();
$currentSpace = strpos($tagLeft, ' ');
if (substr($currentTag, 0, 1) == "/") {
$isCloseTag = TRUE;
list($tagName) = explode(' ', $currentTag);
$tagName = substr($tagName, 1);
} else {
$isCloseTag = FALSE;
list($tagName) = explode(' ', $currentTag);
}
if ((!preg_match("/^[a-z][a-z0-9]*$/i",$tagName)) || (!$tagName) || ((in_array(strtolower($tagName), $this->tagBlacklist)) && ($this->xssAuto))) {
$postTag = substr($postTag, ($tagLength + 2));
$tagOpen_start = strpos($postTag, '<');
continue;
}
while ($currentSpace !== FALSE) {
$fromSpace = substr($tagLeft, ($currentSpace+1));
$nextSpace = strpos($fromSpace, ' ');
$openQuotes = strpos($fromSpace, '"');
$closeQuotes = strpos(substr($fromSpace, ($openQuotes+1)), '"') + $openQuotes + 1;
if (strpos($fromSpace, '=') !== FALSE) {
if (($openQuotes !== FALSE) && (strpos(substr($fromSpace, ($openQuotes+1)), '"') !== FALSE))
$attr = substr($fromSpace, 0, ($closeQuotes+1));
else $attr = substr($fromSpace, 0, $nextSpace);
} else $attr = substr($fromSpace, 0, $nextSpace);
if (!$attr) $attr = $fromSpace;
$attrSet[] = $attr;
$tagLeft = substr($fromSpace, strlen($attr));
$currentSpace = strpos($tagLeft, ' ');
}
$tagFound = in_array(strtolower($tagName), $this->tagsArray);
if ((!$tagFound && $this->tagsMethod) || ($tagFound && !$this->tagsMethod)) {
if (!$isCloseTag) {
$attrSet = $this->filterAttr($attrSet);
$preTag .= '<' . $tagName;
for ($i = 0; $i < count($attrSet); $i++)
$preTag .= ' ' . $attrSet[$i];
if (strpos($fromTagOpen, "</" . $tagName)) $preTag .= '>';
else $preTag .= ' />';
} else $preTag .= '</' . $tagName . '>';
}
$postTag = substr($postTag, ($tagLength + 2));
$tagOpen_start = strpos($postTag, '<');
}
$preTag .= $postTag;
return $preTag;
}
function filterAttr($attrSet) {
$newSet = array();
for ($i = 0; $i < count($attrSet); $i++) {
if (!$attrSet[$i]) continue;
$attrSet[$i] = trim($attrSet[$i]);
$exp = strpos($attrSet[$i], '=');
if ($exp === false) $attrSubSet = Array($attrSet[$i]); else {
$attrSubSet = Array();
$attrSubSet[] = substr($attrSet[$i], 0, $exp);
$attrSubSet[] = substr($attrSet[$i], $exp + 1);}
$attrSubSet[1] = stripslashes($attrSubSet[1]);
list($attrSubSet[0]) = explode(' ', $attrSubSet[0]);
if ((!eregi("^[a-z]*$",$attrSubSet[0])) || (($this->xssAuto) && ((in_array(strtolower($attrSubSet[0]), $this->attrBlacklist)) || (substr($attrSubSet[0], 0, 2) == 'on'))))
continue;
if ($attrSubSet[1]) {
$attrSubSet[1] = str_replace('&#', '', $attrSubSet[1]);
$attrSubSet[1] = preg_replace('/\s+/', ' ', $attrSubSet[1]);
$attrSubSet[1] = str_replace('"', '', $attrSubSet[1]);
if ((substr($attrSubSet[1], 0, 1) == "'") && (substr($attrSubSet[1], (strlen($attrSubSet[1]) - 1), 1) == "'"))
$attrSubSet[1] = substr($attrSubSet[1], 1, (strlen($attrSubSet[1]) - 2));
}
if ( ((strpos(strtolower($attrSubSet[1]), 'expression') !== false) && (strtolower($attrSubSet[0]) == 'style')) ||
(strpos(strtolower($attrSubSet[1]), 'javascript:') !== false) ||
(strpos(strtolower($attrSubSet[1]), 'behaviour:') !== false) ||
(strpos(strtolower($attrSubSet[1]), 'vbscript:') !== false) ||
(strpos(strtolower($attrSubSet[1]), 'mocha:') !== false) ||
(strpos(strtolower($attrSubSet[1]), 'data:') !== false AND strtolower($attrSubSet[0]) == "href") ||
(strpos(strtolower($attrSubSet[1]), 'livescript:') !== false)
) continue;
$attrFound = in_array(strtolower($attrSubSet[0]), $this->attrArray);
if ((!$attrFound && $this->attrMethod) || ($attrFound && !$this->attrMethod)) {
if ($attrSubSet[1]) $newSet[] = $attrSubSet[0] . '="' . $attrSubSet[1] . '"';
elseif ($attrSubSet[1] == "0") $newSet[] = $attrSubSet[0] . '="0"';
else $newSet[] = $attrSubSet[0] . '="' . $attrSubSet[0] . '"';
}
};
return $newSet;
}
function decode($source) {
$source = preg_replace( "#\[code\](.+?)\[/code\]#ies", "\$this->code_tag( '\\1' )", $source );
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);
$source = strtr($source, $trans_tbl);
$source = preg_replace('/
< Bu mesaj bu kişi tarafından değiştirildi Urasbeyler -- 3 Kasım 2006; 14:01:53 >