0) continue;
if($deco_url == str_replace(" ","",$deco_url) ) {
$return_strs = $return_strs.$deco_url."\\";
}
$i = $l;
} else break;
}
return explode("\\",substr($return_strs,1,strlen($return_strs) ));
}
// ### history bak ÆÄÀÏ Ã£¾Æ³¿ ################################
function wkfunc_backup_file_find_from_filename($filename_parameter, $n_of_returns_parameter){
$temporal_return = "";
$temporal_max_time = 0;
$dir=opendir("./");
while($file = readdir($dir)) {
if( strpos(" ".$file,$filename_parameter)==1 && strpos($file,".bak")>3 )
{
$I = strpos($file,".txt")+4;
$E = strpos($file,".bak");
$temporal_time = intval(substr($file,$I,$E-$I));
$time_str = date("M j, Y, g:i a", $temporal_time ) ;
$temporal_return = $temporal_return." * [LINK:".$file."] ".$time_str."\n";
if($temporal_time>$temporal_max_time) $temporal_max_time = $temporal_time;
}
}
closedir($dir);
if($n_of_returns_parameter==1) return $filename_parameter.$temporal_max_time.".bak";
else return $temporal_return;
}
// ### Á¦¸ñÀ¸·Î ±× Á¦¸ñÀ» °¡Áø µ¥ÀÌÅÍ ÆÄÀϸíÀ» ã¾Æ µ¹·ÁÁÖ´Â ÇÔ¼ö ####################################################
function wkfunc_file_find_from_title($title_parameter)
{
$file_number_counter = 0;
$file_name_return = "__NONEXISTANCE__";
$temporal_file_pointer = 0;
$temporal_title = "";
$temporal_max = 0;
if(strpos($title_parameter,".txt")>0 && strpos($title_parameter,"kct")>0){
$temporal_file_pointer = fopen( $title_parameter, "r" );
$temporal_title = fgets($temporal_file_pointer);
fclose( $temporal_file_pointer );
return $temporal_title;
}
if(file_exists("wkctlist.xml")!=false){
$fp = fopen("wkctlist.xml", "r");
$tmp_xml_contents = fread( $fp, filesize( "wkctlist.xml" ) );
fclose( $fp );
$titles = explode( "", $tmp_xml_contents );
$filenames = explode( "", $tmp_xml_contents );
for($l=0;$l")+7;
$title = substr($titles[$l], $I);
$I = strpos($filenames[$l],"")+6;
$filename = substr($filenames[$l], $I);
if(strcmp($title,$title_parameter)==0) {
$filename = str_replace(".xml","",$filename);
if(file_exists($filename)==true) return $filename;
}
}
}
$dir=opendir("./");
while($file = readdir($dir)) {
if( strpos($file,"kct")==1 && strpos($file,".xml") <1 && (strpos($file,".txt") != false || strpos($file,".TXT") != false) && strcmp(str_replace(".bak","",$file),$file)==0 && strcmp(str_replace(".BAK","",$file),$file)==0 )
{
$file_number_counter++;
$temporal_file_pointer = fopen( $file, "r" );
$temporal_title = fgets($temporal_file_pointer);
fclose( $temporal_file_pointer );
$temporal_title = str_replace( "\r", "" , $temporal_title );
$temporal_title = str_replace( "\n", "" , $temporal_title );
$st = strpos( $file, "kct");
$ed = strpos( $file, ".txt");
$temporal_page_number = intval( substr( $file, $st+3, $ed-$st-3) );
if( $temporal_max < $temporal_page_number ) $temporal_max = $temporal_page_number;
if(strcmp($temporal_title,$title_parameter)==0 ) { $file_name_return = $file; closedir($dir); return $file_name_return;}
}
}
closedir($dir);
$temporal_max ++;
if(intval($file_number_counter) < $temporal_max) $file_number_counter = $temporal_max;
return $file_name_return.$file_number_counter; // ±×·± Á¦¸ñÀ» °®´Â ÆäÀÌÁö°¡ ¾øÀ» °æ¿ì, "__NONEXISTANCE__Àüü°Ë»öÇÑÆÄÀÏ°¹¼ö" ¸¦ ¸®ÅÏÇÑ´Ù.
}
// ### ÁÖ¾îÁø ½Ã°£À» °¡Áö°í, ±× ½Ã°£ ÀÌÈÄ·Î ÃֽŠ¾÷µ¥ÀÌÆ® ÆÄÀÏÀÇ ÆÄÀϸíÀ» ã¾Æ µ¹·ÁÁÖ´Â ÇÔ¼ö #########################
function wkfunc_newest_file_find($time_parameter)
{
$file_number_counter = 0;
$file_name_return = "__NONEXISTANCE__";
$temporal_file_pointer = 0;
$temporal_title = "";
$temporal_time_str = "";
$temporal_time = "";
$temporal_start = 0;
$temporal_end = 0;
$temporal_maximizer = 0;
$temporal_return_value = "";
if(file_exists("wkctlist.xml")!=false){
$fp = fopen("wkctlist.xml", "r");
$tmp_xml_contents = fread( $fp, filesize( "wkctlist.xml" ) );
fclose( $fp );
$times = explode( "", $tmp_xml_contents );
$titles = explode( "", $tmp_xml_contents );
for($l=0;$l")+6;
$temporal_time_str = substr($times[$l], $I);
$I = strpos($titles[$l],"")+7;
$title = substr($titles[$l], $I);
$temporal_start = strpos( $temporal_time_str, ": ")+2;
$temporal_end = strpos( $temporal_time_str," /");
$temporal_time = substr( $temporal_time_str , $temporal_start , $temporal_end - $temporal_start) + 0;
if( $temporal_time > $temporal_maximizer && ($temporal_time < $time_parameter || $time_parameter==0 ) )
{
$temporal_maximizer=$temporal_time;
$temporal_return_value=$temporal_time.":".urldecode($title)."#CQSW?=".$temporal_time_str;
}
}
return $temporal_return_value;
}
$dir=opendir("./");
while($file = readdir($dir)) {
if( strpos($file,"kct")==1 && strpos($file,".xml") <1 && (strpos($file,".txt") != false || strpos($file,".TXT") != false) && strcmp(str_replace(".bak","",$file),$file)==0)
{
$file_number_counter++;
$temporal_file_pointer = fopen( $file, "r" );
$temporal_title = fgets($temporal_file_pointer);
$temporal_time_str = fgets($temporal_file_pointer);
$temporal_line1 = fgets($temporal_file_pointer);
$temporal_line2 = fgets($temporal_file_pointer);
fclose( $temporal_file_pointer );
$temporal_title = str_replace( "\r", "" , $temporal_title );
$temporal_title = str_replace( "\n", "" , $temporal_title );
$temporal_start = strpos( $temporal_time_str, ": ")+2;
$temporal_end = strpos( $temporal_time_str," /");
$temporal_time = substr( $temporal_time_str , $temporal_start , $temporal_end - $temporal_start) + 0;
if( $temporal_time > $temporal_maximizer && ($temporal_time < $time_parameter || $time_parameter==0 ) )
{
if(strcmp($file,"wklog.txt")==0) continue;
$temporal_maximizer=$temporal_time;
$temporal_return_value=$temporal_time.":".$temporal_title."#CQSW?=".$temporal_time_str;
$GLOBALS["global_string_temp"] = $temporal_line1."\n".$temporal_line2;
$GLOBALS["global_string_temp"] = str_replace("<", "<", $GLOBALS["global_string_temp"]);
$GLOBALS["global_string_temp"] = str_replace(">", ">", $GLOBALS["global_string_temp"]);}
}
}
closedir($dir);
return $temporal_return_value;
}
// ### ÁÖ¾îÁø ¹®ÀÚ¿À» °¡Áö°í, ±× ¹®ÀÚ¿º¸´Ù »çÀü¼øÀ¸·Î ¹Ù·Î µÚÂÊ¿¡ ÀÖ´Â Á¦¸ñÀ» °¡Áø ÆÄÀϸíÀ» ã¾Æ µ¹·ÁÁÖ´Â ÇÔ¼ö #####
function wkfunc_first_title_file_find($title_parameter)
{
$file_number_counter = 0;
$file_name_return = "__NONEXISTANCE__";
$temporal_file_pointer = 0;
$temporal_title = "";
$temporal_maximizer = "ÆRÆRÆR";
$temporal_return_value = "";
$title_parameter = str_replace( "\r", "" , $title_parameter );
$title_parameter = str_replace( "\n", "" , $title_parameter );
$dir=opendir("./");
while($file = readdir($dir)) {
if( strpos($file,".xml") <1 && strpos($file,"kct")==1 && (strpos($file,".txt") != false || strpos($file,".TXT") != false)&& strpos($temporal_title,".bak")==false && strcmp(str_replace(".bak","",$file),$file)==0 )
{
$file_number_counter++;
$temporal_file_pointer = fopen( $file, "r" );
$temporal_title = fgets($temporal_file_pointer);
$temporal_time_str = fgets($temporal_file_pointer);
fclose( $temporal_file_pointer );
$temporal_title = str_replace( "\r", "" , $temporal_title );
$temporal_title = str_replace( "\n", "" , $temporal_title );
if(strlen($temporal_title)<2) continue;
if(strpos($temporal_title,"?xml ")==1) continue;
//echo($file_number_counter.":".$file.":".$temporal_title.":".strpos($temporal_title,"?xml ")."\n");
if(
(strcmp($temporal_title, $temporal_maximizer)<0 || strcmp($temporal_maximizer,"ÆRÆRÆR")==0 ) &&
(strcmp($temporal_title,$title_parameter)>0 || strlen($title_parameter)<1 )
)
{$temporal_maximizer=$temporal_title;
$temporal_return_value=$temporal_title;}
}
}
closedir($dir);
return $temporal_return_value;
}
// ### Á¦¸ñ¼øÀ¸·Î Á¤·ÄµÈ Á¦¸ñ ¸ñ·ÏÀ» ¸¸µé¾î µ¹·ÁÁÖ´Â ÇÔ¼ö ############################################################
function wkfunc_make_title_sorted_list(){
$file_number_counter = 0;
$file_name_return = "__NONEXISTANCE__";
$temporal_file_pointer = 0;
$temporal_title = "";
$temporal_return_value = "";
$title_sorted_list = "";
$title_parameter = str_replace( "\r", "" , $title_parameter );
$title_parameter = str_replace( "\n", "" , $title_parameter );
$dir=opendir("./");
while($file = readdir($dir)) {
if(strpos($file,".xml") <1 && strpos($file,"kct")==1 && (strpos($file,".txt") != false || strpos($file,".TXT") != false)&& strpos($temporal_title,".bak")==false && strcmp(str_replace(".bak","",$file),$file)==0 && strpos($file,".xml")<1 )
{
$file_number_counter++;
$temporal_file_pointer = fopen( $file, "r" );
$temporal_title = fgets($temporal_file_pointer);
$temporal_time_str = fgets($temporal_file_pointer);
fclose( $temporal_file_pointer );
$temporal_title = str_replace( "\n","",$temporal_title);
$temporal_title = str_replace( "\r","",$temporal_title);
if(strcmp($temporal_title,"»èÁ¦")==0) continue;
$temporal_time_str = str_replace( "\n","",$temporal_time_str);
$temporal_time_str = str_replace( "\r","",$temporal_time_str);
$temporal_time_str = substr($temporal_time_str, strpos($temporal_time_str," 20",strpos($temporal_time_str,"UNIX") ) );
if(strlen($temporal_title)>1 && strlen($temporal_time_str)>1){
$needle_point = wkfunc_find_sorted_position_from_list($temporal_title,$title_sorted_list);
$title_sorted_list = substr($title_sorted_list, 0, $needle_point )." * [ ".$temporal_title." ] ".$temporal_time_str." \n".substr($title_sorted_list, $needle_point);
}
}
}
closedir($dir);
return $title_sorted_list;
}
// ### stack ¹®ÀÚ¿¿¡¼ needle ¹®ÀÚ¿ÀÌ »çÀü¼øÀ¸·Î ¹è¿ÇÏ¸é ¾îµð¿¡ ³¢¿©¾ß ÇÏ´ÂÁö ¹®ÀÚ¿ À妽º¸¦ ã¾ÆÁÖ´Â ÇÔ¼ö #######
function wkfunc_find_sorted_position_from_list($needle, $stack){
$I = 0;
$i = 0;
$ret = 0;
for($i=0;$i<5000;$i++){
if( strpos( $stack, "* [", $I)<1 ) break;
$I = strpos( $stack, "* [", $I)+5;
$E = strpos( $stack, "]", $I);
$E2= strpos( $stack, "\n",$E)+1;
$temp_title = substr($stack, $I, $E-$I);
$temp_title = str_replace(" ","",$temp_title);
if(strcmp($temp_title,$needle)<0) $ret=$E2;
$I = $E;
}
return $ret;
}
// ### ÇÔ¼ö ±¸ÇöºÎ ³¡ ################################################################################################
// ### ½ÇÁ¦ ½ÇÇàºÎºÐ #################################################################################################
$fp=0;
$i=0;
$j=0;
$k=0;
$l=0;
$page_to_read="";
$page_to_edit="";
$filename_to_edit="";
$filename_to_read="";
$wk_design="";
$wk_title="";
$wk_date="";
$wk_contents="";
$wk_password="";
$wk_contents_ori="";
$wk_first_page_title="";
$main_temp="";
$main_temp2="";
$wk_head="";
$wk_tail="";
$wk_output="";
$position_of_contents=0;
$position_of_blit=0;
$position_of_headline=0;
$deco_headline_start="";
$deco_headline_end="";
$deco_blit_start="";
$deco_url="";
// ### ¾Æ¹« µ¥ÀÌÅÍ ÆÄÀÏÀÌ ¾øÀ¸¸é µðÀÚÀÎ ÆÄÀϺÎÅÍ ÀÚµ¿»ý¼º ÇÑ´Ù. ######################################################
if(file_exists("wk_design.htm")==false){
$fp = fopen( "wk_design.htm", "wb" );
$temp_data = "";
$temp_data = $temp_data."";
$temp_data = $temp_data."À§Å°Å°À§Á¦¸ñ\n";
$temp_data = $temp_data."À§Å°Å°À§Á¦¸ñ
\n";
$temp_data = $temp_data."Last modified at ¸¶Áö¸·º¯°æÀϽÃ
\n";
$temp_data = $temp_data."\n";
$temp_data = $temp_data."\n";
$temp_data = $temp_data."ÆäÀÌÁö³»¿ë
Çìµå¶óÀμÒÁ¦¸ñ
³ª¿ºí¸´ ";
$temp_data = $temp_data."\n";
$temp_data = $temp_data." |
\n";
$temp_data = $temp_data."Edit\n";
$temp_data = $temp_data."Update\n";
$temp_data = $temp_data."List\n";
$temp_data = $temp_data."XML\n";
fwrite( $fp, $temp_data );
fclose( $fp );}
if(file_exists("wkct0.txt")==false){
$fp = fopen( "wkct0.txt", "wb" );
$temp_data = "";
$temp_data = $temp_data."Start\n";
$temp_data = $temp_data."UNIX clock : 426426 / Common clock 0426.04.26, 4:26 pm\n";
$temp_data = $temp_data."Wecome to WikiKiwi.\n";
$temp_data = $temp_data."If you want to know anything about Wikikiwi, then please visit [http://no-smok.net/nsmk/WikiKiwi] .";
$temp_data = $temp_data."";
fwrite( $fp, $temp_data );
fclose( $fp );}
// ### µðÀÚÀÎ ÆÄÀÏÀ» ÀÐ¾î µéÀδÙ. ####################################################################################
$fp = fopen( "wk_design.htm", "r" );
$wk_design = fread( $fp, filesize( "wk_design.htm" ) );
fclose( $fp );
if(strpos($HTTP_GET_VARS["option"],"tatic")==1){ // static ¿É¼ÇÀÌ ÀÖÀ» °æ¿ì, ´Ù¸¥ µðÀÚÀÎ ÆÄÀÏÀ» Àд´Ù.
if(file_exists("wk_design_static.htm")!=false){
$fp = fopen( "wk_design_static.htm", "r" );
$wk_design = fread( $fp, filesize( "wk_design_static.htm" ) );
fclose( $fp );
}}
// ### µðÀÚÀÎ ÆÄÀÏÀ» Çؼ®ÇÑ´Ù. #######################################################################################
// ´ë¹® ÆäÀÌÁö(¸ÞÀÎ ÆäÀÌÁö)ÀÇ Á¦¸ñÀ» ÀÐ¾î µÐ´Ù.
$fp = fopen( "wkct0.txt", "r" );
$wk_first_page_title = fgets($fp);
fclose( $fp );
// Áö±Ý ÀÐÀ» ÆäÀÌÁöÀÇ Á¦¸ñÀ» ÀÐ¾î µÐ´Ù.
if( strlen($page_to_read) < 1) {
$page_to_read = $HTTP_GET_VARS["pagetoread"];
// ÀÎÅÍÀ§Å°¸¦ À§ÇÑ Ä¡È¯ ó¸®
$m_Meatball[0] = "Nsmk";
$m_Prefix [0] = "http://no-smok.net/nsmk/";
$m_Meatball[1] = "Doosan";
$m_Prefix [1] = "http://kr.encycl.yahoo.com/enc/info.html?key=";
$m_Meatball[2] = "Freefell";
$m_Prefix [2] = "http://freefeel.org/wiki/";
$m_Meatball[3] = "KoWikiPedia";
$m_Prefix [3] = "http://wiki.kldp.org/wiki.php?action=goto&oe=utf-8&url=http://ko.wikipedia.org/wiki/";
// ÀÎÅÍÀ§Å° ÆäÀÌÁö¸¦ ¿ä±¸Çϸç ÆäÀÌÁö¸¦ ¿äûÇÒ °æ¿ì ÀÚµ¿À¸·Î ¸®´ÙÀÌ·º¼ÇÇϸç Á¾·á
for($ii=0;$ii<4;$ii++){
if( strpos(" ".$page_to_read, $m_Meatball[$ii].":" )==1 ) {
$m_addr = substr($page_to_read, strlen($m_Meatball[$ii])+1, 180 );
echo('');
exit(1);
}
}
}
if( strlen($page_to_read) < 1 || strcmp($page_to_read,"FIRSTPAGE")==0) $wk_title = $wk_first_page_title;
else if( strcmp($page_to_read,"TITLELIST")==0) $wk_title = "Á¦¸ñ ¼ø¼ ¸ñ·Ï";
else if( strcmp($page_to_read,"UPDATELIST")==0) $wk_title = "ÃÖ±Ù ¾÷µ¥ÀÌÆ® ÆäÀÌÁö";
else if( strcmp($page_to_read,"SRESULT")==0) {$wk_title = "°Ë»ö °á°ú";}
else if( strcmp($page_to_read,"SEARCH")==0) {$wk_title = "°Ë»ö";}
else if( strcmp($page_to_read,"UPLOADED")==0) {$wk_title = "ÆÄÀÏ ¾÷·Îµå ¿Ï·á";}
else if( strcmp($page_to_read,"UPLOAD")==0) {$wk_title = "ÆÄÀÏ ¾÷·Îµå";}
else $wk_title = $page_to_read;
if(strpos($page_to_read,"kct")>0 && strpos($page_to_read,".txt")>0 ) {
$page_to_read = wkfunc_file_find_from_title($page_to_read);
$wk_title = $page_to_read;
}
// µðÀÚÀÎ ÆÄÀÏ¿¡ ´ëÇÑ ´Ü¼ø °¡°ø
$wk_design = str_replace("¸ÞÀÎÆäÀÌÁöÁ¦¸ñ",$wk_first_page_title, $wk_design);
$wk_design = str_replace("óÀ½ÆäÀÌÁöÁ¦¸ñ",$wk_first_page_title, $wk_design);
$wk_design = str_replace("À§Å°Å°À§Á¦¸ñ",str_replace("_"," ",$wk_title), $wk_design);
$wk_design = str_replace("ÆäÀÌÁö°íÄ¡±â¸µÅ©","index.php?pagetoedit=".$wk_title."&option=oekaki",$wk_design);
$wk_design = str_replace("¿ª¸µÅ©ÆäÀÌÁö¸µÅ©","index.php?pagetoread=SRESULT&sphrase=[ ".$wk_title." ]",$wk_design);
$wk_design = str_replace("ÆäÀÌÁö°íÄ¡±â","index.php?pagetoedit=".$wk_title."&option=oekaki",$wk_design);
$wk_design = str_replace("ÅؽºÆ®°íÄ¡±â¸µÅ©","index.php?pagetoedit=".$wk_title,$wk_design);
$wk_design = str_replace("Æ®·¢¹éº¸³»±â¸µÅ©","index.php?pagetoread=".$wk_title."&option=trackback",$wk_design);
$wk_design = str_replace("´Þ¶óÁøÁ¡º¸±â¸µÅ©","index.php?pagetoread=".$wk_title."&option=diff",$wk_design);
$wk_design = str_replace("¿¾³¯ÆǺ¸±â¸µÅ©","index.php?pagetoread=".$wk_title."&option=history",$wk_design);
$wk_design = str_replace("Á¤ÀûHTML»ý¼º¸µÅ©","index.php?pagetoread=".$wk_title."&option=static",$wk_design);
$wk_design = str_replace("óÀ½ÆäÀÌÁö¸µÅ©","index.php?pagetoread=FIRSTPAGE",$wk_design);
$wk_design = str_replace("¸ñ·ÏÆäÀÌÁö¸µÅ©","index.php?pagetoread=TITLELIST",$wk_design);
$wk_design = str_replace("¾÷µ¥ÀÌÆ®ÆäÀÌÁö¸µÅ©","index.php?pagetoread=UPDATELIST",$wk_design);
$wk_design = str_replace("ÆÄÀϾ÷·Îµå¸µÅ©","index.php?pagetoread=UPLOAD",$wk_design);
$wk_design = str_replace("°Ë»öÆäÀÌÁö¸µÅ©","index.php?pagetoread=SEARCH",$wk_design);
$wk_design = str_replace("µµ¿ò¸»ÆäÀÌÁö¸µÅ©","index.php?pagetoread=À§Å°Å°À§%20µµ¿ò¸»",$wk_design);
$wk_design = str_replace("»õ·Î¿îÆäÀÌÁö¸µÅ©","index.php?pagetoedit=Á¦¸ñÀÔ·Â&option=oekaki", $wk_design);
$wk_design = str_replace("À§Å°Å°À§RSS¸µÅ©","index.xml",$wk_design);
// ### µðÀÚÀÎ ÆÄÀÏ¿¡ ±â·ÏµÈ ¿ä¼ÒÀÇ parsing ###########################################################################
$position_of_contents = strpos($wk_design,"ÆäÀÌÁö³»¿ë");
$position_of_headline = strpos($wk_design,"Çìµå¶óÀμÒÁ¦¸ñ");
$position_of_blit = strpos($wk_design,"³ª¿ºí¸´");
// Get the style of each design element
// find the position of '
' just in front of blit : $j
$j=0; // $j is the postion of the '
' meaning starting of blit
for($i=0;$i<$position_of_blit;$i++){
$k = strpos($wk_design,"
",$i);
if($k<$position_of_blit) $j=$k;
}
// find the postion of '
' just after contents : $k
$k = strpos($wk_design,"
",$position_of_contents);
$deco_blit_start = substr( $wk_design, $j+4, $position_of_blit - $j - 4 );
$deco_headline_start = substr( $wk_design, $k+4, $position_of_headline - $k -4);
$deco_headline_end = substr( $wk_design, $position_of_headline + 14, $j - $position_of_headline - 14 );
// Eliminate design elements from design file
$wk_head = substr( $wk_design, 0, $position_of_contents);
$wk_tail = substr( $wk_design, $position_of_blit+8);
// ### ÆäÀÌÁö ¼öÁ¤ ¿äûÀÏ °æ¿ì #######################################################################################
$page_to_edit = $HTTP_GET_VARS["pagetoedit"];
$j = $HTTP_GET_VARS["edittype"];
if( strcmp($page_to_edit,"FIRSTPAGE") == 0 ) { // ù ÆäÀÌÁöÀÏ °æ¿ì º¼ °Íµµ ¾øÀÌ wkct0.txt ÆÄÀÏ¿¡ ´ëÇÑ ÆíÁýÀÓÀº È®½ÇÇÏ´Ù.
$filename_to_edit = "wkct0.txt";
$createnew = 0;
} else
if( strlen($page_to_edit) >= 1 ) {
$filename_to_edit = wkfunc_file_find_from_title($page_to_edit);
$createnew = 0;
if(strpos($HTTP_GET_VARS["pagetoedit"],"llYourBaseAreBelongToUs.Php")>0) { // Direct executive php editing: hidden function, disable default.
$createnew = -1;
$filename_to_edit="allyourbasearebelongtous.php";
// if you want to use live executive editting, then remove the 1 line below.
exit(1);
} else
if(strpos($filename_to_edit,"_NONEXI")>0) {$createnew=1; $filename_to_edit="wkct".substr($filename_to_edit,16).".txt";} // °íÄ¡°íÀÚÇÏ´Â Á¦¸ñÀÇ ÆäÀÌÁö°¡ ¾ø´Â °æ¿ì, »õ·Î¿î À̸§À¸·Î ÆÄÀÏ »ý¼º
// ### ¼öÁ¤À» À§ÇØ ¿ø·¡ÀÇ ³»¿ëÀ» Àд´Ù. #############################################################################
if($createnew<=0){
$fp = fopen( $filename_to_edit, "r" );
if($createnew==0) $wk_title =fgets($fp); else $wk_title = " ";
if($createnew==0) $wk_date =fgets($fp); else $wk_date = " ";
$wk_contents = fread( $fp, filesize( $filename_to_edit ) - strlen($wk_title) - strlen($wk_date));
if($createnew==-1)$wk_contents=str_replace("<","<",$wk_contents);
fclose( $fp );
} else {
$wk_title = $HTTP_GET_VARS["pagetiedit"];
$wk_date = date("s");
$wk_contents = "";
}
$wk_contents = str_replace("\r","",$wk_contents);
// ¼öÁ¤ Á¦ÇÑ ¾ÏÈ£(ȤÀº ´ä±Û¸¸ Çã¿ë)°¡ °É·Á ÀÖ´Â °æ¿ìÀÇ Ã³¸®
$i = substr($wk_contents,0,5);
if((strcmp($i,"¾ÏÈ£ ")==0 || strcmp($i,"¾Õ±Û ")==0 || strcmp($i,"´ä±Û ")==0) && strcmp($j,"reply") != 0)
{
$i = strpos($wk_contents,"\n");
$wk_password = substr($wk_contents,5,$i-5);
if( strcmp($HTTP_GET_VARS["pwd"],$wk_password)!=0) { // ¾ÏÈ£¸¦ Á¦°ø ¹ÞÁö ¸øÇ߰ųª, ¾ÏÈ£°¡ ´Ù¸¥ °æ¿ì, ¾ÏÈ£¸¦ ¹°¾îº¸´Â âÀ» ¶ç¿ò
echo "\n";
exit();
} // ¾ÏÈ£°¡ Á¦°øµÇ¾úÀ¸¸ç, ÀÏÄ¡ÇÏ´Â °æ¿ì ÀϹÝÀûÀÎ ¼öÁ¤ ÀÛ¾÷À¸·Î À̾îÁü.
}
echo $wk_head;
echo "\n";
echo "À̸ðƼÄÜ :) B) ;) :D X-( :o :( --; ^^ ^__^ {!} {V} {ok} {x} {i}
\n";
echo "\n";
// ### ¿À¿¡Ä«Å°¸¦ À§ÇÑ ÀÚ¹Ù½ºÅ©¸³Æ®¸¦ µ¡ºÙÀδÙ. ######################################################################
// ### ÀüÇô »ç¿ëÇÏÁö ¾Ê°Å³ª ´ëüÇÒ °æ¿ì ÀÌ°÷À» ÆíÁý. #################################################################
if(strpos($HTTP_GET_VARS["option"],"ekaki")==1 && strpos($wk_design,"!--NOOEKAKI--")<=0 )
echo '
';
// ### ¿À¿¡Ä«Å° °ü·Ã ºÎºÐ ó¸® ¿Ï·á ##################################################################################
echo $wk_tail;
exit();
}
// ### ÆäÀÌÁö ¼öÁ¤¿¡ °üÇÑ ³»¿ë ó¸® ¿Ï·á #############################################################################
// ### ÆäÀÌÁö ³»¿ëÀ» ½ÇÁ¦·Î ÆÄÀÏ¿¡ ¾²´Â ºÎºÐ #########################################################################
// ### ÆäÀÌÁö ÆíÁýÀ» ÇÑ ÈÄ submit °á°ú·Î ¿äûÇÏ°Ô µÇ´Â ÆäÀÌÁö´Â ¹Ù·Î ÀÌ ºÎºÐÀÌ µÈ´Ù. #################################
// ### Æ®·¢¹éµµ ÀÌ°÷¿¡¼ ó¸®ÇÔ. #####################################################################################
$page_to_read = "";
$page_to_edit = "";
$page_to_edit = $HTTP_POST_VARS["pagetowrite"];
if(strlen($page_to_edit)<1 && strlen($HTTP_POST_VARS["blog_name"])<2) $page_to_edit = $HTTP_GET_VARS["pagetowrite"];
// ### Æ®·¢¹éó¸® ###################################################################################################
if(strlen($page_to_edit)<1) { // blog_nameÀÌ ¼³Á¤µÈ, POST°¡ ¾Æ´Ñ get¹æ½ÄÀ¸·Î¸¸ ÆÄÀÏÀ̸§À» Á¤ÇÏ´Â ¿äûÀº Æ®·¢¹éó¸®ÀÓ
$page_to_edit = $HTTP_GET_VARS["pagetowrite"];
if(strpos($HTTP_POST_VARS["url"],"://")>0){
$HTTP_POST_VARS["pagetowrite"] = $HTTP_GET_VARS["pagetowrite"];
$HTTP_POST_VARS["edittype"] = "reply";
$tb_title = $HTTP_POST_VARS["title"];
$fp = fopen( $HTTP_POST_VARS["pagetowrite"], "r" );
$wiki_title=fgets($fp);
fclose($fp);
$wiki_title = str_replace("\r","",$wiki_title);
$wiki_title = str_replace("\n","",$wiki_title);
$HTTP_POST_VARS["title"] = $wiki_title;
$HTTP_POST_VARS["name"] = $HTTP_POST_VARS["blog_name"];
$HTTP_POST_VARS["excerpt"]=str_replace("'","",$HTTP_POST_VARS["excerpt"]);
$HTTP_POST_VARS["excerpt"]=str_replace("`","",$HTTP_POST_VARS["excerpt"]);
$HTTP_POST_VARS["excerpt"]=str_replace("=","",$HTTP_POST_VARS["excerpt"]);
$HTTP_POST_VARS["excerpt"]=str_replace("[","",$HTTP_POST_VARS["excerpt"]);
$HTTP_POST_VARS["exceprt"]=str_replace("]","",$HTTP_POST_VARS["excerpt"]);
$HTTP_POST_VARS["contents"] = " ''' ".$tb_title." [".$HTTP_POST_VARS["url"]."] ''' ".$HTTP_POST_VARS["excerpt"];
} // Æ®·¢¹éÀº ÀÏÁ¾ÀÇ ´ä±Û·Î 󸮵ȴÙ. Áï, Æ®·¢¹éÀ» º¸³»±â À§ÇØ ³¯¾Æ¿Â ³»¿ëµéÀº ´ä±ÛÀ» À§ÇØ Àü´ÞµÈ Á¤º¸ÀÎ °Í ó·³ º¯È¯µÇ°í, ÀÏ¹Ý ´ä±Û󸮷ΠÀ̾îÁö°Ô µÈ´Ù.
}
// ### ÀÏ¹Ý ÆÄÀÏ ¾²±â ó¸® ###########################################################################################
if( strlen($page_to_edit) >= 1 ) {
$reply_edit_type = $HTTP_POST_VARS["edittype"];
if(strlen($reply_edit_type)<1) $reply_edit_type = $HTTP_GET_VARS["edittype"];
if(strcmp($reply_edit_type,"reply")==0) // ¸¸¾à ´ä±ÛÀ̶ó¸é,
{
$fp = fopen( $page_to_edit, "r" );
$wk_title = fgets($fp);
$wk_date = fgets($fp);
$wk_contents_ori = fread( $fp, filesize( $page_to_edit ) - strlen($wk_title) - strlen($wk_date));
$wk_contents_ori = str_replace("\r","",$wk_contents_ori);
fclose( $fp );
// ¾ÏÈ£¸¦ ±âÀÔÇÑ´Ù.
$i = substr($wk_contents_ori,0,5);
if( strcmp($i,"¾ÏÈ£ ")==0 || strcmp($i,"¾Õ±Û ")==0 || strcmp($i,"´ä±Û ")==0 ) {
$k = strpos($wk_contents_ori,"\n");
$j = substr($wk_contents_ori,0,$k); // $j is the first line of the file
$i = substr($wk_contents_ori,0,5); // $i is the type of protection
$wk_contents_ori = substr($wk_contents_ori,$k+1); // $wk_contents_ori is pure contents
}
}
$temp_url_title = $HTTP_POST_VARS["title"]; if(strlen($temp_url_title)<1) $temp_url_title = $HTTP_GET_VARS["title"];
$temp_url_contt = $HTTP_POST_VARS["contents"]; if(strlen($temp_url_contt)<1) $temp_url_contt = $HTTP_GET_VARS["contents"];
if(strlen($temp_url_title)<1) $wk_title = $HTTP_POST_VARS["itstitle"]; else $wk_title = "".$temp_url_title;
$wk_contents = "".$temp_url_contt;
if( strlen($HTTP_POST_VARS["autolinkgen"]) > 0 ){ // Autolinkgeneration
$wk_date ="";
$main_temp2 = "";
$i = 0;
for($l=0;$l<300;$l++){
$main_temp = wkfunc_first_title_file_find($main_temp2);
if(strcmp($main_temp,$main_temp2)==0 || strlen($main_temp)<2 ) break;
if(strcmp($main_temp,"»èÁ¦")!=0 && strcmp($main_temp,$wk_title)!=0) {
$wk_contents = str_replace( " [ ".$main_temp." ] ", $main_temp, $wk_contents);
$wk_contents = str_replace( $main_temp, " [ ".$main_temp." ] ",$wk_contents);
}
else $l--;
$main_temp2 = $main_temp;
}
}
// Magic quote anti-bug
$wk_contents = str_replace("\\'","'",$wk_contents);
$wk_contents = str_replace("\\\"","\"",$wk_contents);
$wk_contents = str_replace("\\\\","\\",$wk_contents);
// Backup
if(file_exists($page_to_edit)!=false){
copy($page_to_edit, $page_to_edit.date("U").".bak");
}
// Automatic trackback processing
$tb_url = "";
if( strpos( " ".$wk_contents, "[TB:" ) > 0 ) {
$ii = strpos( $wk_contents, "[TB:" ) + 4;
$ie = strpos( $wk_contents, "]", $ii);
$tb_url = substr( $wk_contents, $ii, $ie-$ii );
$wk_contents = str_replace( "[TB:".$tb_url."]", "[".$tb_url."]", $wk_contents );
// Tatertools trackback
if( strpos( $tb_url, "/tt/rserver.php?mode=tb&sl=") > 1 ) {
$tb_src =str_replace( "/tt/rserver.php?mode=tb&sl=", "/tt/index.php?pl=", $tb_url);
$wk_contents=str_replace( "[".$tb_url."]", "[".$tb_src."]", $wk_contents);
} else
// Tatertools trackback 2
if( strpos( $tb_url, "/tt/rserver.php?mode=tb&sl=") > 1 ) {
$tb_src =str_replace( "/blog/rserver.php?mode=tb&sl=", "/blog/index.php?pl=", $tb_url);
$wk_contents=str_replace( "[".$tb_url."]", "[".$real_src."]", $wk_contents);
} else
// Tatertools
if( strpos( $tb_url, "/tt/index.php?pl=") > 1 )
$tb_url=str_replace( "/tt/index.php?pl=", "/tt/rserver.php?mode=tb&sl=", $tb_url); else
// Tatertools 2
if( strpos( $tb_url, "/blog/index.php?pl=") > 1 )
$tb_url=str_replace( "/blog/index.php?pl=","/blog/rserver.php?mode=tb&sl=", $tb_url); else
// egloos trackback
if( strpos( $tb_url, "egloos.com/tb/") > 1 )
{
$tb_src = str_replace( "egloos.com/tb/", "egloos.com/", $tb_url);
$wk_contents = str_replace( "[".$tb_url."]", "[".$tb_src."]", $wk_contents );
} else
// egloos
if( strpos( $tb_url, "egloos.com/") > 1 )
$tb_url=str_replace( "egloos.com/", "egloos.com/tb/", $tb_url); else
// WikiKiwi trackback
if( strpos( $tb_url, "index.php?pagetowrite=") > 1 ) {
$tb_src=str_replace( "index.php?pagetowrite=", "index.php?pagetoread=", $tb_url);
$wk_contents = str_replace( "[".$tb_url."]", "[".$tb_src."]", $wk_contents );
} else
// WordPress trackback
if( strpos( $tb_url, "/tb/tb.php?n=") > 1 ) {
$tb_src=str_replace( "/tb/tb.php?n=", "/wp/archives/", $tb_url);
$wk_contents = str_replace( "[".$tb_url."]", "[".$tb_src."]", $wk_contents );
} else
// WordPress trackback type2
if( strpos( $tb_url, "/wp/wp-trackback.php/") > 1 ) {
$tb_src=str_replace( "/wp/wp-trackback.php/", "/wp/index.php?p=", $tb_url);
$wk_contents = str_replace( "[".$tb_url."]", "[".$tb_src."]", $wk_contents );
} else
// blogin trackback
if( strpos( $tb_url, "www.blogin.com/blog/tb/?id=") > 1 ) {
$tb_src=str_replace( "www.blogin.com/tb/?id=", "www.blogin.com/blog/main.php?datX=", $tb_url);
$wk_contents = str_replace( "[".$tb_url."]", "[".$tb_src."]", $wk_contents );
} else
// blogin
if( strpos( $tb_url, "www.blogin.com/blog/main.php?datX=") > 1 )
$tb_url=str_replace( "www.blogin.com/blog/main.php?datX=", "www.blogin.com/tb/?id=", $tb_url); else
$tb_url="";
}
// Actual wrting
$xmlfilename = $page_to_edit.".xml";
if(file_exists($page_to_edit)!=false){
chmod( $page_to_edit, 0777 );
chmod( $xmlfilename, 0777 );
$fp = fopen( $page_to_edit, "r");
$old_title = fgets($fp);
$old_timestamp = fgets($fp);
fclose($fp);
$old_file_size = filesize( $page_to_edit );
$new_file_size = strlen($wk_title)+strlen($old_timestamp)+strlen($wk_contents);
}
if(strlen($wk_title)<1) $wk_title = "".$old_title;
$wk_title = str_replace("\n","",$wk_title);
if(strpos($wk_title,"%u")>=1) { $wk_title=(ereg_replace('%u([[:alnum:]]{4})', '\1;',"".$wk_title)); }
$old_timestamp = str_replace("\n","",$old_timestamp);
if(strlen($wk_contents)>2) { // hacking ¹× Ä¡¸íÀû ¿¡·¯ ¹æÁö¸¦ À§ÇØ
$fpxml = fopen( $xmlfilename, "wb");
$fp = fopen( $page_to_edit, "wb");
$xmltags = "\n-10) // if it's minor change
$writing_time_stamp = $old_timestamp."\n";
if(strlen( $writing_time_stamp )< 2) $writing_time_stamp = "UNIX clock : ".date("U")." / Common clock ".date("Y.m.d, g:i a")."\n" ;
fwrite( $fp, $writing_time_stamp );
if( strcmp($reply_edit_type,"reply")==0 ) {
// ´ä±Û ´Þ±â³ª Ãß°¡À̸é
if(strcmp($i,"¾Õ±Û ")==0)
{
$j=$j."\n";
fwrite( $fp, $j, strlen($j) );
$wk_contents=$wk_contents."\n - '' ".$HTTP_POST_VARS["name"]." ".date("Y.m.d, g:i a")." '' ";
$wk_contents=$wk_contents."\n----\n";
fwrite( $fp, $wk_contents, strlen($wk_contents) );
fwrite( $fp, $wk_contents_ori, strlen($wk_contents_ori) );
fwrite( $fpxml, $wk_contents, strlen($wk_contents) );
fwrite( $fpxml, $wk_contents_ori, strlen($wk_contents_ori) );
}
else
//if(strcmp($i,"´ä±Û ")==0)
{
$j=$j;
if(strcmp($i,"´ä±Û")==0) {
fwrite( $fp, $j, strlen($j) );
if(strlpos("\n")<2) fwrite($fp,"\n");
}
if(strlen($HTTP_POST_VARS["name"])>1)
$wk_contents = "\n----\n".$wk_contents." - '' ".$HTTP_POST_VARS["name"]." ".date("Y.m.d, g:i a")." '' ";
fwrite( $fp, $wk_contents_ori, strlen($wk_contents_ori) );
fwrite( $fpxml, $wk_contents_ori, strlen($wk_contents_ori) );
if(strpos($wk_contents,"%u")>=1) { $wk_contents=(ereg_replace('%u([[:alnum:]]{4})', '\1;',"".$wk_contents)); }
fwrite( $fp, $wk_contents, strlen($wk_contents) );
fwrite( $fpxml, $wk_contents, strlen($wk_contents) );
}
}
else {
fwrite( $fp, $wk_contents, strlen($wk_contents) );
fwrite($fpxml,$wk_contents, strlen($wk_contents) );
}
$xmltags = "\n ]]>";
fwrite($fpxml,$xmltags,strlen($xmltags) );
fclose($fp);
fclose($fpxml);
// XML link table writing
$tmp_links = "";
if(file_exists("wkctlinks.xml")!=false){
$fp = fopen( "wkctlinks.xml", "r" );
fgets($fp);
$tmp_links = fgets($fp);
fclose($fp);
}
$tmp_links = str_replace("\r","",$tmp_links);
$tmp_links = str_replace("\n","",$tmp_links);
$links = wkfunc_find_links_from_text($wk_contents);
$tmp_title = str_replace("\r","",$wk_title);
$tmp_title = str_replace("\n","",$tmp_title);
while(1==1){ // erasing exitsed link logs
$tmp_needle = "a>".$tmp_title.",";
$tmp_p = strpos($tmp_links, $tmp_needle);
if($tmp_p<1) break;
$tmp_pe=strpos($tmp_links, "", $tmp_p)+3;
$tmp_needle = "<".substr($tmp_links,$tmp_p,$tmp_pe-$tmp_p).">";
$tmp_links = str_replace($tmp_needle,"",$tmp_links);
}
for($l=0;$l".$tmp_title.",".$links[$l]."";
$tmp_links=$tmp_links.$tmp_pair;
}
$fp = fopen("wkctlinks.xml","wb");
fwrite($fp, "\n");
fwrite($fp, $tmp_links);
fwrite($fp, "\n\n");
fclose($fp);
//
// XML list setup
//
// ### Ajax static backup ÆäÀÌÁö¸¦ À§ÇÑ XML ÆÄÀϸ®½ºÆ®ÀÇ ÀÛ¼º ########################################################
$xmllist = "";
if(file_exists("wkctlist.xml")!=false){
$fp = fopen( "wkctlist.xml", "rb" );
$xmllist = fread( $fp, filesize( "wkctlist.xml" ) );
fclose( $fp );
$xmllist = str_replace( "\r\n", "\n", $xmllist);
$xmllist = str_replace( "\n", "", $xmllist );
$xmllist = str_replace( "", "", $xmllist );
}
$wk_title_url = urlencode($wk_title);
if( strpos( $xmllist, $xmlfilename ) >1 ) {
$deletion_i = strpos( $xmllist, "".$wk_title."" );
$deletion_e = strpos( $xmllist, "", $deletion_i+1 ) + 7;
if($deletion_i>2 && $deletion_e>$deletion_i) $deletionary =substr( $xmllist, $deletion_i, $deletion_e-$deletion_i );
if($deletion_i>2 && $deletion_e>$deletion_i) $xmllist = str_replace($deletionary,"",$xmllist);
$deletion_i = strpos( $xmllist, "".$wk_title_url."" );
$deletion_e = strpos( $xmllist, "", $deletion_i+1 ) + 7;
if($deletion_i>2 && $deletion_e>$deletion_i) $deletionary =substr( $xmllist, $deletion_i, $deletion_e-$deletion_i );
if($deletion_i>2 && $deletion_e>$deletion_i) $xmllist = str_replace($deletionary,"",$xmllist);
}
$xmllist = $xmllist."".$wk_title."".$xmlfilename."";
$xmllist = $xmllist."".$wk_title_url."".$xmlfilename."";
$fpxml = fopen( "wkctlist.xml", "wb");
$xmltags = "\n".$xmllist."";
fwrite($fpxml,$xmltags,strlen($xmltags) );
fclose($fpxml);
// ### RSS feed¸¦ ¸¸µç´Ù. ############################################################################################
// RSS Feeding
// for blog RSS
$main_temp = wkfunc_newest_file_find(0);
$time_i = strpos($main_temp, "UNIX" );
$time_j = strpos($main_temp, " : ", $time_i)+3;
$time_k = strpos($main_temp, " ", $time_j);
$css_newest_time_stamp = 0 + (substr($main_temp, $time_j, $time_k-$time_j));
$css_newest_time = date("D, d M Y H:i:s O", $css_newest_time_stamp);
$css_URL_title_URI = $_SERVER['REQUEST_URI'];
$css_URL_title_hostname = $GLOBALS['HTTP_HOST'];
$css_URL_title = $css_URL_title_hostname . substr($css_URL_title_URI, 0, strpos($css_URL_title_URI,"index.php"));
$wk_date ="";
$wk_contents = "\n";
$wk_contents = $wk_contents."".$wk_first_page_title."\n";
$wk_contents = $wk_contents."http://".$css_URL_title."\n";
$wk_contents = $wk_contents."RSS generated from WikiKiwi\n";
$wk_contents = $wk_contents."ko\n";
$wk_contents = $wk_contents."$css_newest_time\n";
$main_temp2 = "";
$i = 0;
for($l=0;$l<5;$l++){
$main_temp = wkfunc_newest_file_find($i);
if(strcmp($main_temp,$main_temp2)==0 || strlen($main_temp)<2 ) break;
$j = strpos($main_temp,":");
$k = strpos($main_temp,"#CQSW?=");
$time_i = strpos($main_temp, "UNIX");
$time_j = strpos($main_temp, " : ", $time_i)+3;
$time_k = strpos($main_temp, " ", $time_j);
$css_time_stamp = 0 + (substr($main_temp, $time_j, $time_k-$time_j));
$css_time = date("D, d M Y H:i:s O", $css_time_stamp);
if(strcmp($main_temp,"»èÁ¦")!=0)
{
$wk_contents = $wk_contents."- ";
$wk_contents = $wk_contents."".substr($main_temp,$j+1,$k-$j-1)."\n";
$wk_contents = $wk_contents."http://".$css_URL_title."index.php?pagetoread=".substr($main_temp,$j+1, $k-$j-1)."\n";
$tmp_filename_to_edit = wkfunc_file_find_from_title( substr($main_temp,$j+1, $k-$j-1) );
$fp = fopen( $tmp_filename_to_edit, "r" );
$tmp_wk_title = fgets($fp);
$tmp_wk_date = fgets($fp);
$tmp_wk_contents = fread( $fp, filesize( $tmp_filename_to_edit ) - strlen($tmp_wk_title) - strlen($tmp_wk_date));
fclose( $fp );
$tmp_wk_contents = str_replace("<", "<", $tmp_wk_contents);
$tmp_wk_contents = str_replace(">", ">", $tmp_wk_contents);
$tmp_wk_contents = str_replace("\n","
", $tmp_wk_contents);
$jj = strlen($tmp_wk_contents);
for($ii=0;$ii<$jj;$ii++){
$kk=strpos($tmp_wk_contents,"[http://",$ii);
if($kk != false)
{
$ll=strpos($tmp_wk_contents,"]",$kk);
$deco_url = substr($tmp_wk_contents,$kk+1,$ll-$kk-1);
if(strpos($deco_url,".jpg")!=false) $tmp_wk_contents = str_replace("[".$deco_url."]","",$tmp_wk_contents); else
if(strpos($deco_url,".gif")!=false) $tmp_wk_contents = str_replace("[".$deco_url."]","",$tmp_wk_contents); else
if(strpos($deco_url,".png")!=false) $tmp_wk_contents = str_replace("[".$deco_url."]","",$tmp_wk_contents);
$ii = $kk+4;
} else if($ii>0) break;
}
$wk_contents = $wk_contents."\n\n\n";
$wk_contents = $wk_contents."none\n";
$wk_contents = $wk_contents."WikiKiwi\n";
$wk_contents = $wk_contents."".$css_time." \n";
}
else $l--;
$i = 0+substr($main_temp,0,$j);
$main_temp2 = $main_temp;
}
$wk_contents = $wk_contents."\n";
$fp = fopen( "index.xml", "wb");
fwrite( $fp, $wk_contents);
fclose($fp);
}
// ### RSS ¸¸µé±â ¿Ï·á ###############################################################################################
// ### ÀÛ¾÷ ¿Ï·áÈÄ Å¬¶óÀ̾ðÆ®¿¡ Ç¥½ÃÇÒ ¸Þ¼¼Áöµé ######################################################################
$tb_url = urlencode( $tb_url );
$page_to_read = $wk_title;
if(strpos($HTTP_POST_VARS["url"],"://")>0 || strcmp($HTTP_GET_VARS["xml"],"yes")==0) { // track backÀ» º¸³»°Å³ª xml·Î ´äÇØ ¿À¶ó´Â ¿äûÀÌ ÀÖ¾ú´Ù¸é, ±×´ë·Î.
echo('0');
} else
{
if(strlen($tb_url)>3)
echo("");
else
if(strlen($HTTP_POST_VARS["homeurl"])<2) // À̵µ Àúµµ ¾Æ´Ñ °æ¿ì homeurlÀ̶ó´Â º¯¼ö·Î ³Ñ¾î¿Â ÁÖ¼Ò È¤Àº, ¾²±â ¿Ï·áÇÑ ¹®Á¦ÀÇ ÆäÀÌÁö·Î ¸®´ÙÀÌ·º¼Ç
echo("");
else
echo("");
}
exit();
}
// ### ½ÇÁ¦ ÆÄÀÏ¿¡ ¾²±â °ü·Ã ºÎºÐ ¿Ï·á ###############################################################################
// ### ÆäÀÌÁö ·»´õ¸µ ºÎºÐ ############################################################################################
$nondeco_wk2= "";
// If there is NOT any command then "read page 0"
if( strlen($page_to_read) < 1) $page_to_read = $HTTP_GET_VARS["pagetoread"];
if( strlen($page_to_read) < 1) $page_to_read = $HTTP_POST_VARS["pagetoread"];
// If it's not function page
if( strlen($page_to_read) < 1 || strcmp($page_to_read,"FIRSTPAGE")==0) { $filename_to_read="wkct0.txt"; }
else if( strcmp($page_to_read,"TITLELIST")==0) {$wk_title = "Á¦¸ñ ¼ø¼ ¸ñ·Ï";}
else if( strcmp($page_to_read,"SRESULT")==0) {$wk_title = "°Ë»ö °á°ú";}
else if( strcmp($page_to_read,"SEARCH")==0) {$wk_title = "°Ë»ö";}
else if( strcmp($page_to_read,"UPDATELIST")==0) {$wk_title = "ÃÖ±Ù ¾÷µ¥ÀÌÆ® ÆäÀÌÁö";}
else if( strcmp($page_to_read,"UPLOADED")==0) {$wk_title = "ÆÄÀÏ ¾÷·Îµå ¿Ï·á";}
else if( strcmp($page_to_read,"UPLOAD")==0) {$wk_title = "ÆÄÀÏ ¾÷·Îµå";}
else // If not
{
$filename_to_read = wkfunc_file_find_from_title($page_to_read);
if(strpos($page_to_read,"kct")>0 && strpos($page_to_read,".txt")>0 ) {
$filename_to_read = "".$page_to_read;
$page_to_read = wkfunc_file_find_from_title($page_to_read);
$wk_title = $page_to_read;
}
if(strpos($filename_to_read,"_NONEXISTANCE__")!=false)
{ // no existance then create new file
echo "\n";
echo $wk_head;
echo "";
echo $wk_tail;
exit();
}
}
// Read page contents
// If it's special function page
// Titlelist
if(strcmp($wk_title,"Á¦¸ñ ¼ø¼ ¸ñ·Ï")==0) {
$wk_date ="";
$wk_contents = "\n";
$main_temp2 = "";
$i = 0;
/*
for($l=0;$l<1500;$l++){
$main_temp = wkfunc_first_title_file_find($main_temp2);
if(strcmp($main_temp,$main_temp2)==0 || strlen($main_temp)<1 ) {break;}
if(strcmp($main_temp,"»èÁ¦")!=0 ) {
$wk_contents = $wk_contents." * [ ".$main_temp." ] \n";
}
else $l--;
$main_temp2 = $main_temp;
}
*/
$wk_contents = $wk_contents.wkfunc_make_title_sorted_list();
}
else if(strcmp($wk_title,"°Ë»ö °á°ú")==0) {
$wk_date ="";
$wk_contents = "\n";
$main_temp2 = "";
$main_title_temp = "";
$main_contents_temp = "";
$diff_temp = 0;
$i = 0;
$sphrase = $HTTP_GET_VARS["sphrase"];
$wk_contents = $wk_contents."°Ë»ö¾î: `` ".$sphrase." ''\n\n";
// Title Search
for($l=0;$l<1500;$l++){
$main_temp = wkfunc_first_title_file_find($main_temp2);
if(strcmp($main_temp,$main_temp2)==0 || strlen($main_temp)<1 ) break;
if(strcmp($main_temp,"»èÁ¦")!=0){
if ( strlen( $main_temp ) != strlen(str_replace($sphrase, "",$main_temp) ) )
{ $wk_contents = $wk_contents." * [ ".$main_temp." ] \n";}
} else $l--;
$main_temp2 = $main_temp;
}
// Contents Search
$wk_date ="";
$wk_contents = $wk_contents."\n";
$main_temp2 = "";
$main_title_temp = "";
$main_contents_temp = "";
$diff_temp = 0;
$i = 0;
for($l=0;$l<1500;$l++){
$main_temp = wkfunc_first_title_file_find($main_temp2);
if(strcmp($main_temp,$main_temp2)==0 || strlen($main_temp)<1 ) break;
if(strcmp($main_temp,"»èÁ¦")!=0)
{
$filename_to_search = wkfunc_file_find_from_title($main_temp);
$fp = fopen( $filename_to_search, "r" );
$srcwk_title = fgets($fp);
$srcwk_date = fgets($fp);
$srcwk_contents = fread( $fp, filesize( $filename_to_search ) - strlen($srcwk_title) - strlen($srcwk_date));
fclose( $fp );
$srcwk_contents = " ".str_replace("\r","",$srcwk_contents);
$srcwk_contents = str_replace("\n","",$srcwk_contents);
$src_pos = strpos($srcwk_contents,$sphrase);
if( $src_pos ) {
$wk_contents = $wk_contents." * [ ".$main_temp." ] \n at ".$src_pos."byte. \n\n";
}
} else $l--;
$main_temp2 = $main_temp;
}
}
else if(strcmp($wk_title,"°Ë»ö")==0) {
$wk_contents = $wk_contents.'';
}
else if(strcmp($wk_title,"ÆÄÀÏ ¾÷·Îµå")==0) {
$wk_contents = $wk_contents.'';
}
else if(strcmp($wk_title,"ÆÄÀÏ ¾÷·Îµå ¿Ï·á")==0) {
$uploaddir = './';
$uploadfile = $uploaddir. $_FILES['userfile']['name'];
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
$wk_contents = $wk_contents."ÆÄÀÏÀÌ Á¸ÀçÇÏ°í, ¼º°øÀûÀ¸·Î ¾÷·Îµå µÇ¾ú½À´Ï´Ù.";
$wk_contents = $wk_contents."Ãß°¡ µð¹ö±ë Á¤º¸ÀÔ´Ï´Ù:\n";
echo("");
} else {
$wk_contents = $wk_contents."ÆÄÀÏ ¾÷·Îµå °ø°ÝÀÇ °¡´É¼ºÀÌ ÀÖ½À´Ï´Ù! µð¹ö±ë Á¤º¸ÀÔ´Ï´Ù:\n";
echo("");
}
$wk_contents = $wk_contents."
\n * ÀÌÀü ÆäÀÌÁö·Î";
}
// Update List
else if(strcmp($wk_title,"ÃÖ±Ù ¾÷µ¥ÀÌÆ® ÆäÀÌÁö")==0) {
$wk_date ="";
$wk_contents = "\n";
$main_temp2 = "";
$i = 0;
for($l=0;$l<20;$l++){
$main_temp = wkfunc_newest_file_find($i);
if(strcmp($main_temp,$main_temp2)==0 || strlen($main_temp)<2 ) break;
$j = strpos($main_temp,":");
$k = strpos($main_temp,"#CQSW?=");
if(strpos(" ".$main_temp,":»èÁ¦")<=0)
$wk_contents = $wk_contents." [LINK:moindiff.gif] [ ".substr($main_temp,$j+1,$k-$j-1)." ] ".substr($main_temp,strpos($main_temp," 20", strpos($main_temp,"UNIX") ) );
else $l--;
$i = 0+substr($main_temp,0,$j);
$main_temp2 = $main_temp;
}
}
// If it's not
else if( strcmp( $HTTP_GET_VARS["option"], "history" )==0 ) { // history view
$fp = fopen( $filename_to_read, "r" );
$wk_title = fgets($fp);
$wk_date = fgets($fp);
fclose( $fp );
$wk_contents = "\n".wkfunc_backup_file_find_from_filename($filename_to_read,0);
}
else if( strcmp( $HTTP_GET_VARS["option"], "diff" )==0 ) { // diff
$fp = fopen( $filename_to_read, "r" );
$wk_title = fgets($fp);
$wk_date = fgets($fp);
$wk_contents1 = fread( $fp, filesize( $filename_to_read ) - strlen($wk_title) - strlen($wk_date));
$wk_contents1 = str_replace("\r","",$wk_contents1);
fclose( $fp );
$backup_fn = $HTTP_GET_VARS["backupfn"];
if(strlen($backup_fn)<1) $backup_fn = wkfunc_backup_file_find_from_filename($filename_to_read,1);
if(strpos($backup_fn,".txt0.bak")>0) $backup_fn = $filename_to_read;
$fp = fopen($backup_fn , "r" );
fgets($fp);
fgets($fp);
$wk_contents2 = fread( $fp, filesize( $backup_fn ) - strlen($wk_title) - strlen($wk_date));
$wk_contents2 = str_replace("\r","",$wk_contents2);
fclose( $fp );
$lines2 = explode("\n",$wk_contents2);
$wk_contents2 = str_replace(" ","",$wk_contents2);
$wk_contents2 = str_replace("\r","",$wk_contents2);
$wk_contents2 = str_replace("\n","",$wk_contents2);
$lines = explode("\n",$wk_contents1);
$nondeco_wk2 = "¼öÁ¤ ¹× Ãß°¡µÈ ºÎºÐ Ç¥½Ã
";
for($l=0;$l0 )
$nondeco_wk2= $nondeco_wk2."".$lines[$l]."
\n";
else
$nondeco_wk2= $nondeco_wk2."".$lines[$l]."
\n";
}
$wk_contents1 = str_replace(" ","",$wk_contents1);
$wk_contents1 = str_replace("\r","",$wk_contents1);
$wk_contents1 = str_replace("\n","",$wk_contents1);
$nondeco_wk2 = $nondeco_wk2."
¼öÁ¤ ÀÌÀü ¹öÀüÀÇ º¯°æ ºÎºÐ
";
for($l=0;$l0 )
;
else
$nondeco_wk2= $nondeco_wk2."".$lines2[$l]."
\n";
}
//$wk_contents1."
".$wk_contents2;
$wk_contents = " -==NonDeco2==- ";
}
else {
$fp = fopen( $filename_to_read, "r" );
$wk_title = fgets($fp);
$wk_date = fgets($fp);
$wk_contents = fread( $fp, filesize( $filename_to_read ) - strlen($wk_title) - strlen($wk_date));
$wk_contents = str_replace("\r","",$wk_contents);
fclose( $fp );
}
// Password processing
$i = substr($wk_contents,0,5);
if( strcmp($i,"¾ÏÈ£ ")==0 || strcmp($i,"¾Õ±Û ")==0 || strcmp($i,"´ä±Û ")==0 ) {
$i = strpos($wk_contents,"\n");
$wk_contents = substr($wk_contents,$i+1);
}
// Contents Designize
// inclusion
if( strpos($wk_contents,"[IncludeUpdate") != false )
{
$ii = strpos($wk_contents,"[IncludeUpdate");
$ii += 15;
$ij = strpos($wk_contents,"]", $ii);
$include_timestamp= substr($wk_design, $ii, $ij-$ii);
$main_temp = wkfunc_newest_file_find($include_timestamp);
$ij = strpos($main_temp,":");
$ik = strpos($main_temp,"#CQSW?=");
$include_title = substr($main_temp,$ij+1,$ik-$ij-1);
$include_time = substr($main_temp,$ik+7);
$include_timestamp = 0+substr($main_temp,0,$ij);
if(strcmp( str_replace("\n","",str_replace("\r","",$include_title)),str_replace("\n","",str_replace("\r","",$wk_title)) )==0) {
// If the newest one is itself, then pass it, too.
$main_temp = wkfunc_newest_file_find($include_timestamp);
$ij = strpos($main_temp,":");
$ik = strpos($main_temp,"#CQSW?=");
$include_title = substr($main_temp,$ij+1,$ik-$ij-1);
$include_time = substr($main_temp,$ik+7);
$include_timestamp = 0+substr($main_temp,0,$ij);
}
if(strpos($include_title,"ikiSandBox")==1 || strpos($include,"±â¸Þ¸ð¿Í Å×½ºÆ®")>0) {
// If it is WikiSandBox, then pass it.
$main_temp = wkfunc_newest_file_find($include_timestamp);
$ij = strpos($main_temp,":");
$ik = strpos($main_temp,"#CQSW?=");
$include_title = substr($main_temp,$ij+1,$ik-$ij-1);
$include_time = substr($main_temp,$ik+7);
$include_timestamp = 0+substr($main_temp,0,$ij);
}
$inc_filename_to_read = wkfunc_file_find_from_title($include_title);
$fp = fopen( $inc_filename_to_read, "r" );
$inc_wk_title = fgets($fp);
$inc_wk_title = str_replace("\r","",$inc_wk_title);
$inc_wk_title = str_replace("\n","",$inc_wk_title);
$inc_wk_date = fgets($fp);
$inc_wk_firstline = " ".fgets($fp);
if(strpos($inc_wk_firstline,"¾Õ±Û ")==1 || strpos($inc_wk_firstline,"´ä±Û ")==1)
$inc_wk_firstline=""; else $inc_wk_firstline = $inc_wk_firstline."\n";
$inc_wk_contents = $inc_wk_firstline . fread( $fp, filesize( $inc_filename_to_read ) - strlen($inc_wk_title) - strlen($inc_wk_date));
$inc_wk_contents = str_replace("\r","",$inc_wk_contents);
fclose( $fp );
$inc_wk_contents = str_replace("[IncludeUpdate]","",$inc_wk_contents);
$inclusion = "\n=== [ ".$inc_wk_title." ] ===\n".$inc_wk_contents;
$wk_contents = str_replace("[[IncludeUpdate".$time."]]",$inclusion, $wk_contents);
$wk_title = $inc_wk_title;
$filename_to_read = $inc_filename_to_read;
$wk_date = $inc_wk_date;
}
// non-decoratable processing
$k=strpos($wk_contents,"\n{{{\n");
$nondeco = "";
if($k != false)
{
$l=strpos($wk_contents,"\n}}}\n");
$nondeco = substr($wk_contents,$k+5, $l-$k-5);
$wk_contents = substr($wk_contents,0,$k)."--==NONDECO==--".substr($wk_contents,$l+5);
}
// Processing contents
if(strcmp($wk_title,"ÆÄÀÏ ¾÷·Îµå")!=0 && strcmp($wk_title,"ÆÄÀÏ ¾÷·Îµå ¿Ï·á")!=0 && strcmp($wk_title,"°Ë»ö")!=0) {
$wk_contents = str_replace("<","<",$wk_contents);
$wk_contents = str_replace(">",">",$wk_contents);
$wk_contents = str_replace("\n","
\n",$wk_contents);
}
if(strpos($HTTP_GET_VARS["option"], "rackback")==1){ // processing trackback
$css_URL_title_URI = $_SERVER['REQUEST_URI'];
$css_URL_title_hostname = $GLOBALS['HTTP_HOST'];
$css_URL_title = $css_URL_title_hostname . substr($css_URL_title_URI, 0, strpos(
$css_URL_title_URI,"index.php"));
echo $wk_head;
echo '';
echo '';
echo $wk_tail;
exit(0);
}
// merging
// back link parsing
$converting_back_links = "";
$tmp_title = str_replace("\r","",$wk_title);
$tmp_title = str_replace("\n","",$tmp_title);
if(file_exists("wkctlinks.xml")!=false && strpos($wk_design,"¿ª¸µÅ©µéÇ¥½Ã")>0){
$fp = fopen( "wkctlinks.xml", "r" );
fgets($fp);
$tmp_links = fgets($fp);
fclose($fp);
$l=0;
$links = explode("/a>",$tmp_links);
for($l=0;$l")+3) ;
$tmp_link = substr($tmp_link,0,strpos($tmp_link,",") );
if(strpos($converting_back_links,"[".$tmp_link."]")>0) continue;
$converting_back_links = $converting_back_links." [".$tmp_link."] ";
}
}
$wk_design = $wk_head.$wk_contents.$wk_tail;
// New line processing
// Special Date processing
$wk_design = str_replace("¸¶Áö¸·º¯°æÀϽÃ",$wk_date, $wk_design);
// Backlink processing
$wk_design = str_replace("¿ª¸µÅ©µéÇ¥½Ã",$converting_back_links,$wk_design);
// Very Special Thing - costomizable
$wk_design = str_replace("''''''"," ",$wk_design);
// For no-smok style
$wk_design = str_replace("\n==== ",$deco_headline_start." ", $wk_design);
$wk_design = str_replace(" ====
",$deco_headline_end." ", $wk_design);
$wk_design = str_replace("\n=== ",$deco_headline_start." ", $wk_design);
$wk_design = str_replace(" ===
",$deco_headline_end, $wk_design);
$wk_design = str_replace("\n== ",$deco_headline_start." ", $wk_design);
$wk_design = str_replace(" ==
",$deco_headline_end, $wk_design);
$wk_design = str_replace(" {{|","[[[---Y
", $wk_design);
$wk_design = str_replace("\n{{|","[[[---Y
", $wk_design);
$wk_design = str_replace("|}}
","Y---]]]
", $wk_design);
$wk_design = str_replace("|}} ","Y---]]]
", $wk_design);
// Original Wikikiwi
$wk_design = str_replace("\n * ",$deco_blit_start." ",$wk_design);
$wk_design = str_replace("\n * ",$deco_blit_start." ",$wk_design);
$wk_design = str_replace("[[[ ",$deco_headline_start." ", $wk_design);
$wk_design = str_replace(" ]]]"," ".$deco_headline_end, $wk_design);
$wk_design = str_replace("[[[---Y
","",$wk_design);
$wk_design = str_replace("Y---]]] "," |
",$wk_design);
$wk_design = str_replace("[[[---G
","",$wk_design);
$wk_design = str_replace("G---]]] "," |
",$wk_design);
$wk_design = str_replace("[[[---B
","",$wk_design);
$wk_design = str_replace("B---]]] "," |
",$wk_design);
$wk_design = str_replace("[[[---F
","",$wk_design);
$wk_design = str_replace("F---]]] "," |
",$wk_design);
$wk_design = str_replace("[[[---
","",$wk_design);
$wk_design = str_replace("---]]] "," |
",$wk_design);
// Macro
// replay link macro
$wk_design = str_replace("µ¡±Û´Þ±â¸µÅ©","index.php?pagetoedit=".$wk_title."&edittype=reply",$wk_design);
// last updated link macro
if( strpos($wk_design,"[LastLink]") != false )
{
$ii = strpos($wk_date,":")+1;
$ie = strpos($wk_date," /");
$include_timestamp=substr($wk_date, $ii, $ie-$ii);
$main_temp = wkfunc_newest_file_find($include_timestamp);
$ij = strpos($main_temp,":");
$ik = strpos($main_temp,"#CQSW?=");
$include_title = substr($main_temp,$ij+1,$ik-$ij-1);
$include_timestamp = 0+substr($main_temp,0,$ij);
$inclusion = "".$include_title."";
$wk_design = str_replace("[[LastLink]]", $inclusion, $wk_design);
}
$css_URL_title_URI = $_SERVER['REQUEST_URI'];
$css_URL_title_hostname = $GLOBALS['HTTP_HOST'];
$css_URL_title = $css_URL_title_hostname . substr($css_URL_title_URI, 0, strpos($css_URL_title_URI,"index.php"));
$wk_design = str_replace("Æ®·¢¹éÁÖ¼ÒÇ¥½Ã", "http://".$css_URL_title."index.php?pagetowrite=".$filename_to_read, $wk_design);
if( strpos($wk_design,"[TableOfContents]") != false )
{
$j = strlen($wk_design);
$c = 1;
$tt = "";
for($i=0;$i<$j;$i++){
$st=strpos($wk_design,$deco_headline_start,$i);
$ed=strpos($wk_design,$deco_headline_end,$i);
if($st != false)
{
$st += strlen( $deco_headline_start );
$tt = $tt ." ". $deco_blit_start . $c .". ". substr( $wk_design , $st , $ed - $st ) . "";
$i = $ed + 1;
$c ++;
}
else
break;
}
$wk_design = str_replace("[[TableOfContents]]",$tt, $wk_design);
}
if( strpos($wk_design, "[[RSS:") >0 ) { // RSS SisterWiki macro processing -----
$RSSSisterWiki = '
';
}
// RSS Sister Wiki Processing end -----------------------
// font decoration
// for no-smok style italic - bold decoration
if( strpos($wk_design,"''") != false && !(strpos($wk_design,"``") != false) )
{
$j = strlen($wk_design);
$l = 1;
for($i=0;$i<$j;$i++){
$k=strpos($wk_design,"''''",$i);
if($k != false)
{
if ( $l == 1 ) {
$forward = substr($wk_design,0,$k);
$backward = substr($wk_design,$k+4);
$wk_design = $forward . " " . $backward;
}
if ( $l == -1 ) {
$forward = substr($wk_design,0,$k);
$backward = substr($wk_design,$k+4);
$wk_design = $forward . " " . $backward;
}
$l = $l * (-1);
$i = $k+4;
}
else
break;
}
$j = strlen($wk_design);
$l = 1;
for($i=0;$i<$j;$i++){
$k=strpos($wk_design,"'''",$i);
if($k != false)
{
if ( $l == 1 ) {
$forward = substr($wk_design,0,$k);
$backward = substr($wk_design,$k+3);
$wk_design = $forward . " " . $backward;
}
if ( $l == -1 ) {
$forward = substr($wk_design,0,$k);
$backward = substr($wk_design,$k+3);
$wk_design = $forward . " " . $backward;
}
$l = $l * (-1);
$i = $k+3;
}
else
break;
}
$j = strlen($wk_design);
$l = 1;
for($i=0;$i<$j;$i++){
$k=strpos($wk_design,"''",$i);
if($k != false)
{
if ( $l == 1 ) {
$forward = substr($wk_design,0,$k);
$backward = substr($wk_design,$k+2);
$wk_design = $forward . " " . $backward;
}
if ( $l == -1 ) {
$forward = substr($wk_design,0,$k);
$backward = substr($wk_design,$k+2);
$wk_design = $forward . " " . $backward;
}
$l = $l * (-1);
$i = $k+2;
}
else
break;
}
}
$wk_design = str_replace("==> OTL <==", "", $wk_design);
$wk_design = str_replace("==> ¾ýÁ¤´Ì <==", "", $wk_design);
$wk_design = str_replace("==> ", " ", $wk_design);
$wk_design = str_replace(" <==", " ", $wk_design);
$wk_design = str_replace(" ````"," ", $wk_design);
$wk_design = str_replace("'''' "," ", $wk_design);
$wk_design = str_replace(" ```"," ",$wk_design);
$wk_design = str_replace("''' "," ",$wk_design);
$wk_design = str_replace(" ``"," ",$wk_design);
$wk_design = str_replace("'' "," ",$wk_design);
$wk_design = str_replace(" \"CR","",$wk_design);
$wk_design = str_replace("RC\"","",$wk_design);
$wk_design = str_replace(" \"CB","",$wk_design);
$wk_design = str_replace("BC\"","",$wk_design);
$wk_design = str_replace(" \"CG","",$wk_design);
$wk_design = str_replace("GC\"","",$wk_design);
$wk_design = str_replace(" \"CY","",$wk_design);
$wk_design = str_replace("YC\"","",$wk_design);
$wk_design = str_replace(" \"CP","",$wk_design);
$wk_design = str_replace("PC\"","",$wk_design);
$wk_design = str_replace(" \"CF","",$wk_design);
$wk_design = str_replace("FC\"","",$wk_design);
$wk_design = str_replace("\n````"," ", $wk_design);
$wk_design = str_replace("''''<","<", $wk_design);
$wk_design = str_replace("\n```"," ",$wk_design);
$wk_design = str_replace("'''<","<",$wk_design);
$wk_design = str_replace("\n``"," ",$wk_design);
$wk_design = str_replace("''<","<",$wk_design);
$wk_design = str_replace("\n\"CR","",$wk_design);
$wk_design = str_replace("\n\"CB","",$wk_design);
$wk_design = str_replace("\n\"CG","",$wk_design);
$wk_design = str_replace("\n\"CY","",$wk_design);
$wk_design = str_replace("\n\"CP","",$wk_design);
$wk_design = str_replace("\n\"CF","",$wk_design);
$wk_design = str_replace("[[ "," ",$wk_design);
$wk_design = str_replace(" ]]"," ",$wk_design);
// smiley decoration
$wk_design = str_replace(" :)"," ",$wk_design);
$wk_design = str_replace(" B)"," ",$wk_design);
$wk_design = str_replace(" :))"," ",$wk_design);
$wk_design = str_replace(" ;)"," ",$wk_design);
$wk_design = str_replace(" :D"," ",$wk_design);
$wk_design = str_replace(" <:("," ",$wk_design);
$wk_design = str_replace(" X-("," ",$wk_design);
$wk_design = str_replace(" :o"," ",$wk_design);
$wk_design = str_replace(" :("," ",$wk_design);
$wk_design = str_replace("{!} "," ",$wk_design);
$wk_design = str_replace(" {!}"," ",$wk_design);
$wk_design = str_replace("(!) "," ",$wk_design);
$wk_design = str_replace(" (!)"," ",$wk_design);
$wk_design = str_replace(" :-/"," ",$wk_design);
$wk_design = str_replace(" >:>"," ",$wk_design);
$wk_design = str_replace(" :\\"," ",$wk_design);
$wk_design = str_replace(" --;"," ",$wk_design);
$wk_design = str_replace(" - -;"," ",$wk_design);
$wk_design = str_replace(" ^^"," ",$wk_design);
$wk_design = str_replace(" ^ ^"," ",$wk_design);
$wk_design = str_replace(" ^__^"," ",$wk_design);
$wk_design = str_replace("{V}"," ",$wk_design);
$wk_design = str_replace("{ok}"," ",$wk_design);
$wk_design = str_replace("{±×·¯Ãé}"," ",$wk_design);
$wk_design = str_replace("{x}"," ",$wk_design);
$wk_design = str_replace("{i}"," ",$wk_design);
$wk_design = str_replace("\n----
","
",$wk_design);
//TRICKY
$wk_design = str_replace("!?--TRICK--?!","", $wk_design);
// Hyper Link decoration
$wk_design = str_replace(" [¾Õ±Û´Þ±â]"," ´ä±Û´Þ±â",$wk_design);
$wk_design = str_replace(" [´ä±Û´Þ±â]"," ´ä±Û´Þ±â",$wk_design);
$wk_design = str_replace("\n[¾Õ±Û´Þ±â]","´ä±Û´Þ±â",$wk_design);
$wk_design = str_replace("\n[´ä±Û´Þ±â]","´ä±Û´Þ±â",$wk_design);
$j = strlen($wk_design); // .google tag processing
for($i=0;$i<$j;$i++){
$k=strpos($wk_design,"[",$i);
if($k != false)
{
$l = strpos($wk_design,"]",$k);
$deco_url = substr($wk_design,$k+1,$l-$k-1);
$deco_url = str_replace("http://","", $deco_url);
$deco_url = str_replace("LINK:","", $deco_url);
$src_prc = str_replace(" in yahoo", "", $deco_url);
$src_prc = str_replace(" in nkino", "", $src_prc);
if(strpos($deco_url," in nkino")!=false) {
$src_prc = ("http://search.nkino.com/nkino30/result.asp?keyword=".str_replace(" ","+",$src_prc));
$fp=fopen($src_prc,"r");
$src_prc = "http://img.yahoo.co.kr/globalnav/ma.gif";
for($loop=0;$loop<3000;$loop++){
$line = fgets($fp);
if(strpos($line,"http://content.nkino.com/movie/")!=false){ //"http://.co.kr/imgs")!=false){
$img_i = strpos($line, "http://content.nkino.com/movie/"); //"http://img.srch.yahoo.co.s");
$img_i = $img_i;
$img_e = strpos($line, " width", $img_i); //border");
$src_prc = substr($line, $img_i, $img_e-$img_i);
break;
}
if(strpos($line, "