• 15-04-2007, 19:05:12
    #1
    Üyeliği durduruldu
    anadizin/index.php

    ara:

    		'mergetopics' => array('SplitTopics.php', 'MergeTopics'),
    sonrasina ekle:

    		'mergeposts' => array('SplitTopics.php', 'MergePosts'),
    sourcedir/Display.php

    if ($start > $topicinfo['numReplies'] / 2 && $modSettings['defaultMaxMessages'] != -1)
    	{
    		$ascending = !$ascending;
    		$limit = $topicinfo['numReplies'] < $start + $limit ? $topicinfo['numReplies'] - $start + 1 : $limit;
    		$start = $topicinfo['numReplies'] < $start + $limit ? 0 : $topicinfo['numReplies'] - $start - $limit + 1;
    		$firstIndex = $limit - 1;
    	}

    degistir:

    if ($start > $topicinfo['numReplies'] / 2 && $modSettings['defaultMaxMessages'] != -1)
    	{
    		$ascending = !$ascending;
    		$limit = $topicinfo['numReplies'] < $start + $limit ? $topicinfo['numReplies'] - $start + 1 : $limit;
    		$start = $topicinfo['numReplies'] < $start + $limit ? 0 : $topicinfo['numReplies'] - $start - $limit + 1;
    		$firstIndex = $limit - 1;
    	}
    
    	//Find out is there a post before who is double ;)
    	$context['last_user_id'] = 0;
    	$context['last_msn_id'] = 0;
    
    	if ($_REQUEST['start'] != 0 && $modSettings['defaultMaxMessages'] != -1) {
    		$postbefore = $_REQUEST['start'] - 1;
    		$request = db_query("
    			SELECT ID_MEMBER, ID_MSG, body
    			FROM {$db_prefix}messages
    			WHERE ID_TOPIC = $topic
    			ORDER BY ID_MSG
    			LIMIT $postbefore, 1", __FILE__, __LINE__);
    		while ($row = mysql_fetch_assoc($request)) {
    			if (!empty($row['ID_MEMBER']))
    				$context['last_user_id'] = $row['ID_MEMBER'];
    			if (!empty($row['ID_MSG']))
    				$context['last_msn_id']  = $row['ID_MSG'];
    			if (!empty($row['body']))
    				$context['last_post_lenth'] = strlen(un_htmlspecialchars($row['body']));
    			else 
    				$context['last_post_lenth'] = 0;
    		}
    	}
    	else 
    		$context['last_post_lenth'] = 0;
    ara:

    // Run BBC interpreter on the message.
    	$message['body'] = parse_bbc($message['body'], $message['smileysEnabled'], $message['ID_MSG']);

    degistir:

    //Hehe the limit is not reached XD
    	$Merge_MaxLimitLenth = TRUE;
    	//Hmmm i should not ingnore the Post Limit if i Merge a post :X (Even Admins can't Merge it <<)
    	if(empty($modSettings['MergePost_IgnorePostLenth']) && $modSettings['max_messageLength'] > 0) {
    		//Calculating the lenth...
    		if(!isset($context['correct_post_lenth']))
    			$context['correct_post_lenth'] = strlen((empty($modSettings['MergePost_NoHR']) ? (empty($modSettings['MergePost_OldTimeAdd']) ? '[br]'.$txt['search_date_posted'].': '.timeformat($message['modifiedTime'], FALSE).'' : '').'[hr]' : '[br]'));
    		
    		$context['current_post_lenth'] = strlen(un_htmlspecialchars($message['body']));  
    		if(!isset($context['last_post_lenth'])) {
    			$context['last_post_lenth'] = 0;
    			$Merge_MaxLimitLenth = FALSE;
    		}
    		else
    			$Merge_MaxLimitLenth = ($context['current_post_lenth'] + $context['last_post_lenth'] + $context['correct_post_lenth']) < $modSettings['max_messageLength'];
    	}
    	else 
    		$context['current_post_lenth'] = 0;
    
    	// Run BBC interpreter on the message.
    	$message['body'] = parse_bbc($message['body'], $message['smileysEnabled'], $message['ID_MSG']);
    ara:

    		'can_see_ip' => allowedTo('moderate_forum') || ($message['ID_MEMBER'] == $ID_MEMBER && !empty($ID_MEMBER)),
    degistir:

    'can_see_ip' => allowedTo('moderate_forum') || ($message['ID_MEMBER'] == $ID_MEMBER && !empty($ID_MEMBER)),
    		//Doubelpost or Not? TRUE = Doublepost i wish for no error XD
    		'doublepost' => array (
    			'postok' => ((!empty($context['last_user_id']) && !empty($message['ID_MEMBER'])) && $Merge_MaxLimitLenth && $context['last_user_id'] == $message['ID_MEMBER']) && (allowedTo('modify_any') || (allowedTo('modify_own') && $message['ID_MEMBER'] == $ID_MEMBER)),
    			'lastpostid' => $context['last_msn_id']
    		),
    ara:

    if (empty($options['view_newest_first']))
    		$counter++;
    	else
    		$counter--;
    
    	return $output;
    oncesine ekle:

    $context['last_user_id'] = $message['ID_MEMBER'];
    	$context['last_msn_id'] = $message['ID_MSG'];
    	$context['last_post_lenth'] = $context['current_post_lenth'];
    sources/SplitTopics.php


    {
    	global $txt, $context;
    
    	// Make sure the template knows everything...
    	$context['target_board'] = $_GET['targetboard'];
    	$context['target_topic'] = $_GET['to'];
    
    	$context['page_title'] = $txt['smf252'];
    	$context['sub_template'] = 'merge_done';
    }
    degistir:

    {
    	global $txt, $context;
    
    	// Make sure the template knows everything...
    	$context['target_board'] = $_GET['targetboard'];
    	$context['target_topic'] = $_GET['to'];
    
    	$context['page_title'] = $txt['smf252'];
    	$context['sub_template'] = 'merge_done';
    }
    
    function MergePosts($error_report = TRUE) {
    
    	global $db_prefix, $modSettings, $user_info, $txt, $settings, $ID_MEMBER;
    	
    	if(!is_bool($error_report))
    		$error_report = TRUE;
    
    	if (empty($_REQUEST['msnid']) || !is_numeric($_REQUEST['msnid']) || $_REQUEST['msnid'] < 1) {
    		if($error_report)
    			fatal_error($txt['merge_error_noid'], false);
    		else
    			return;
    	}
    	if (empty($_REQUEST['pid']) || !is_numeric($_REQUEST['pid']) || $_REQUEST['pid'] < 1) {
    		if($error_report)
    			fatal_error($txt['merge_error_noid'], false);
    		else
    			return;
    	}
    	if (empty($_REQUEST['topic']) || !is_numeric($_REQUEST['topic']) || $_REQUEST['topic'] < 1) {
    		if($error_report)
    			fatal_error($txt['merge_error_noid'], false);
    		else
    			return;
    	}
    	//Let's check the Existens of the posts ;) and check if the user realy allowed to do the merge :)
    
    	//$start_msnid = $_REQUEST['msnid'] - 1;
    	//Load the messages ;)
    	$topic = $_REQUEST['topic'];
    	//It's a little confusing the reverce order :(
    	$msnid = $_REQUEST['msnid'] < $_REQUEST['pid'] ? $_REQUEST['msnid'] : $_REQUEST['pid'];
    	
    	$qc = FALSE;
    	if($_REQUEST['msnid'] == $_REQUEST['pid']) 
    		$qc = TRUE;
    
    	$request = db_query("
    		SELECT m.ID_MSG, m.ID_MEMBER, m.body, b.countPosts, m.ID_BOARD, t.ID_FIRST_MSG, m.subject, m.posterTime
    		FROM {$db_prefix}messages AS m, {$db_prefix}boards AS b, {$db_prefix}topics AS t
    		WHERE m.ID_TOPIC = $topic
    			AND ID_MSG ".($qc ? '<=' : '>=')." $msnid
    			AND b.ID_BOARD = m.ID_BOARD
    			AND t.ID_TOPIC = m.ID_TOPIC
    		ORDER BY ID_MSG".($qc ? ' DESC' : '')." 
    		LIMIT 2", __FILE__, __LINE__);
    
    	while ($row = mysql_fetch_assoc($request))
    		$msn[] = array (
    			'ID_MEMBER' => $row['ID_MEMBER'],
    			'subject' => $row['subject'],
    			'body' => $row['body'],
    			'ID_MSG' => $row['ID_MSG'],
    			'countPosts' => $row['countPosts'],
    			'ID_BOARD' => $row['ID_BOARD'],
    			'ID_FIRST_MSG' => $row['ID_FIRST_MSG'],
    			'timestamp' => $row['posterTime'],			
    			'Time' => timeformat($row['posterTime'], FALSE),
    			);
    	mysql_free_result($request);
    
    	//Reverse the order :)
    	if($qc) {
    		$msn = array(
    			'0' => $msn['1'],
    			'1' => $msn['0'],
    		);
    
    		//Automatic Mergetime :)
    		if(!empty($modSettings['MergePost_AutomaticTime']) && $modSettings['MergePost_AutomaticTime'] > 0 && $msn['1']['timestamp']-$msn['0']['timestamp'] > $modSettings['MergePost_AutomaticTime'])
    			return;
    	}
    
    	if (!empty($msn['0']['ID_MEMBER']) && !empty($msn['1']['ID_MEMBER']) && $msn['0']['ID_BOARD'] == $msn['1']['ID_BOARD']) {
    		if ($msn['0']['ID_MEMBER'] == $msn['1']['ID_MEMBER'] && (allowedTo('modify_any') || (allowedTo('modify_own') && $msn['0']['ID_MEMBER'] == $ID_MEMBER))) {
    
    			//First Merge the bodytext and split them with a <hr>
    			$newbody = $msn['0']['body'].(empty($modSettings['MergePost_NoHR']) ? (empty($modSettings['MergePost_OldTimeAdd']) ? '[br]'.$txt['search_date_posted'].': '.$msn['0']['Time'].'' : '').'[hr]' : '[br]').$msn['1']['body'];
    
    			//Some collection of ids ;)
    			$memberid = $msn['0']['ID_MEMBER'];
    			$postcount = $msn['0']['countPosts'];
    			$oldpostid = $msn['0']['ID_MSG'];
    			$newpostid = $msn['1']['ID_MSG'];
    			$idboard = $msn['0']['ID_BOARD'];
    			$newpostlenth = (empty($modSettings['MergePost_IgnorePostLenth']) && $modSettings['max_messageLength'] > 0) ? strlen(un_htmlspecialchars($newbody)) : 0;
    			$oldsubject = '';
    			$replacefirstid = '';
    
    			//First check the lenth of the post :), if the limit is reached don't merge it! Also the Automatic Merge will not work!
    			if(empty($modSetting['MergePost_IgnorePostLenth']) && $modSettings['max_messageLength'] < $newpostlenth) {
    				if($error_report)
    					fatal_error($txt['merge_error_lenth'], false);
    				else
    					return;
    			}
    
    			//Let's check if you want to remove first msn of the thread... (there are crazy people <<)
    			if ($oldpostid == $msn['0']['ID_FIRST_MSG']) {
    				$replacefirstid = ', ID_FIRST_MSG = '.$newpostid;
    				// I Think the thread should be have the old name.
    				$oldsubject = ", subject = '".$msn['0']['subject']."'";
    			}
    
    			//Uhh the old post can have attachments
    			//if sql find some attachments he should replace them with the newid
    			db_query("
    				UPDATE {$db_prefix}attachments
    				SET ID_MSG = $newpostid
    				WHERE ID_MSG = $oldpostid", __FILE__, __LINE__);
    
    			//Correct some statstuff
    			db_query("
    				UPDATE {$db_prefix}topics
    				SET numReplies = numReplies - 1 $replacefirstid
    				WHERE ID_TOPIC = $topic
    				LIMIT 1", __FILE__, __LINE__);
    
    			db_query("
    				UPDATE {$db_prefix}boards
    				SET numPosts = numPosts - 1
    				WHERE ID_BOARD = $idboard
    				LIMIT 1", __FILE__, __LINE__);
    
    			// If the poster was registered and the board this message was on incremented
    			// the member's posts when it was posted, decrease his or her post count.
    			if (!empty($memberid) && empty($postcount))
    				updateMemberData($memberid, array('posts' => '-'));
    
    			// Merge the post ;)
    			db_query("
    				UPDATE {$db_prefix}messages
    				SET body = '".mysql_escape_string($newbody)."' $oldsubject
    				WHERE ID_MSG = $newpostid
    				LIMIT 1", __FILE__, __LINE__);
    
    			// Remove the old message!
    			db_query("
    				DELETE FROM {$db_prefix}messages
    				WHERE ID_MSG = $oldpostid
    				LIMIT 1", __FILE__, __LINE__);
    
    			//Now go back to the topic ;) (Why not) XD
    			if($error_report)
    				redirectexit('topic='.$topic.'.msg'.$newpostid.'#msg'.$newpostid);
    			else
    				return;
    		}
    		else {
    			if($error_report)
    				fatal_error($txt['merge_error_dbpo'], false);
    			else
    				return;
    		}
    	}
    	else {
    		if($error_report)
    			fatal_error($txt['merge_error_notf'], false);
    		else
    			return;
    	}
    }

    sources/ModSettings.php

    'layout' => array(
    				'title' => $txt['mods_cat_layout'],
    				'href' => $scripturl . '?action=featuresettings;sa=layout;sesc=' . $context['session_id'],
    			),
    degistir:


    'layout' => array(
    				'title' => $txt['mods_cat_layout'],
    				'href' => $scripturl . '?action=featuresettings;sa=layout;sesc=' . $context['session_id'],
    			),
    			'MergePosts' => array(
    				'title' => $txt['MergePost_Headline'],
    				'href' => $scripturl . '?action=featuresettings;sa=MergePosts;sesc=' . $context['session_id'],
    			),

    ara:

    		'layout' => 'ModifyLayoutSettings',
    degistir:

    'layout' => 'ModifyLayoutSettings',
    		'MergePosts' => 'ModifyMergePostsSettings',
    ara:

    $context['post_url'] = $scripturl . '?action=featuresettings2;save;sa=karma';
    	$context['settings_title'] = $txt['smf293'];
    
    	prepareDBSettingContext($config_vars);
    }
    sonrasina ekle:

    function ModifyMergePostsSettings()
    {
    	global $txt, $scripturl, $context, $settings, $sc;
    
    	$config_vars = array(
    			// Automatic Merge Optione?
    			array('check', 'MergePost_Automatic'),
    			array('int', 'MergePost_AutomaticTime'),
    		'',
    			//Admin can made Doubleposts
    			array('check', 'MergePost_AdminDoublePost'),
    		'',
    			// Some Order option for the merging :X?
    			array('check', 'MergePost_OldTimeAdd'),
    			array('check', 'MergePost_NoHR'),
    		'',
    			array('check', 'MergePost_IgnorePostLenth'),
    	);
    
    	// Saving?
    	if (isset($_GET['save']))
    	{
    		saveDBSettings($config_vars);
    		redirectexit('action=featuresettings;sa=MergePosts');
    	}
    
    	$context['post_url'] = $scripturl . '?action=featuresettings2;save;sa=MergePosts';
    	$context['settings_title'] = $txt['MergePost_Headline'];
    
    	prepareDBSettingContext($config_vars);
    }
    sources/Subs-Post.php

    ara:

    db_query("
    			UPDATE {$db_prefix}topics
    			SET
    				ID_MEMBER_UPDATED = $posterOptions[id], ID_LAST_MSG = $msgOptions[id],
    				numReplies = numReplies + 1" . ($topicOptions['lock_mode'] === null ? '' : ",
    				locked = $topicOptions[lock_mode]") . ($topicOptions['sticky_mode'] === null ? '' : ",
    				isSticky = $topicOptions[sticky_mode]") . "
    			WHERE ID_TOPIC = $topicOptions[id]
    			LIMIT 1", __FILE__, __LINE__);
    
    		// One new post has been added today.
    		trackStats(array('posts' => '+'));
    sonrasına ekle :

    //Let's Merge a double post... yeah now it can check also very long posts, yeah yeah *dance dance*
    		if(!empty($modSettings['MergePost_Automatic']) && !($user_info['is_admin'] && empty($modSettings['MergePost_AdminDoublePost']))) {
    			global $sourcedir;
    			$_REQUEST['msnid'] = $msgOptions['id'];
    			$_REQUEST['pid'] = $msgOptions['id'];
    			$_REQUEST['topic'] = $topicOptions['id'];
    			include($sourcedir . "/SplitTopics.php");
    			MergePosts(FALSE); //No Errors and redirect :)
    		}
    Themes/colatesi_v3/Display.template.php

    	$split_button = create_button('split.gif', 'smf251');
    sonrasina ekle:

    	$MergePosts_button = create_button('modify.gif', 'merge_doublepost');
    ara:

    // Can the user modify the contents of this post?
    		if ($message['can_modify'])
    			echo '
    					<a href="', $scripturl, '?action=post;msg=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';sesc=', $context['session_id'], '">', $modify_button, '</a>';
    oncesine ekle:

    //Doublepost for Merge?
    		if ($message['can_modify'] && $message['doublepost']['postok'] && !empty($message['doublepost']['lastpostid']))
    			echo '
    									<a href="', $scripturl, '?action=mergeposts;pid=', $message['id'], ';msnid=', $message['doublepost']['lastpostid'], ';topic=', $context['current_topic'], '">', $MergePosts_button, '</a>';

    Themes/colatesi_v3/languages/index.turkish.php

    $txt['merge_check'] = 'Birleþtir?';
    $txt['merge_no_poll'] = 'Anket yok';
    sonrasina ekle:

    $txt['merge_doublepost'] = 'Flood Mesajlar';
    $txt['merge_error_dbpo'] = 'Bunu yapmanýza izin verilmedi!';
    $txt['merge_error_notf'] = 'Üzgünüm, birleþtirilecek mesaj bulunamadý.';
    $txt['merge_error_noid'] = 'Mesaj ID veya Konu bulunamadý!';
    $txt['search_date_posted'] = 'Mesajda';
    $txt['merge_error_lenth'] = 'Bu birleþtirilmiþ mesaj maksimum mesaj boyutuna eriþti!';
    Themes/colatesi_v3/languages/ModSettings.turkish.php

    ara:

    ?>
    oncesine ekle:

    // flood koruma turkcelestirme by rallyproco
    $txt['MergePost_Headline'] = 'Flood Mesaj Korumasý';
    $txt['MergePost_Automatic'] = 'Flood mesajlarý otomatik birleþtir';
    $txt['MergePost_AutomaticTime'] = 'Bu zaman aralýðýndaki mesajlarý birleþtir.<font size=1>(<b>0 = herzaman</b>)</font>';
    $txt['MergePost_AdminDoublePost'] = 'Adminin flood mesajlarýný birleþtir';
    $txt['MergePost_OldTimeAdd'] = 'Ara çizgiden önce eski mesaj zamanýný ekleme';
    $txt['MergePost_NoHR'] = 'Birleþtirilmiþ mesajlarda araçizgi ve zamaný yoksay';
    $txt['MergePost_IgnorePostLenth'] = 'Maximum mesaj boyutuna aldýrma';
    İndirin ! Themes/colatesi/images/turkish dosyasina aticaksiniz

    Kaynak : turksmf.com
  • 15-04-2007, 19:19:07
    #2
    Smf de zaten flood koruması var neden farklı bir yol izliyorsunuz.
  • 15-04-2007, 19:24:17
    #3
    Üyeliği durduruldu
    k2an adlı üyeden alıntı: mesajı görüntüle
    Smf de zaten flood koruması var neden farklı bir yol izliyorsunuz.
    bu kesin cözüm olduğu için...
  • 09-07-2007, 10:42:10
    #4
    Üyeliği durduruldu
    link ölmüş güncelenmesi lazım