############################################################## 
## MOD Title: ParserMod
## MOD Author: Lektor  
## MOD Description: This mod will add a feature for getting bccode from html pages of some sites, which helps to copy the releases from other places.
##					
## MOD Version: 0.6.1
## 
## Installation Level: easy
## Installation Time: 5 Minutes
## Files To Edit: 4
##                ajax.php,
##                posting.php,
##                library/language/ru/main.php,
##                styles/templates/default/posting.tpl
## Included Files: 10
##                library/ajax/parser.php
##		  library/includes/functions_parser.php
##                styles/templates/default/images/p/lostfilm.ico
##                styles/templates/default/images/p/nnm-club.ico
##                styles/templates/default/images/p/rutor.ico
##                styles/templates/default/images/p/rutracker.ico
##                admin/admin_pars_cfg.php
##                styles/templates/admin/admin_pars_cfg.tpl
##                data/cookies/.htaccess
##                data/cookies/rutracker.txt
##
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License, version 3.0 (GPLv3)
############################################################## 
## For security purposes, please check: http://www.torrentpier.me
## for the latest version of this MOD. 
############################################################## 
## Author Notes: 
##		  - just use it
##		  - https://www.youtube.com/watch?v=jAGn-fgHa54
##		  - http://i63.fastpic.ru/big/2015/0115/9a/df39ae5cc2086958566da09871ac5f9a.png
## 
############################################################## 
## MOD History: 
##   2015-01-15 - Version 0.5.0 
##      	- First Release
##
##   2015-01-17 - Version 0.6.1 
##      	- fix minor bugs
##      	- Add a possibility to copy the torrents from the rutracker
##      	- add module's settings to admin panel
##
## 
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 
##
#
#-----[ COPY ]------------------------------------------
#
copy library/ajax/parser.php to library/ajax/parser.php
copy library/includes/functions_parser.php to library/includes/functions_parser.php
copy styles/templates/default/images/p/lostfilm.ico to styles/templates/default/images/p/lostfilm.ico
copy styles/templates/default/images/p/nnm-club.ico to styles/templates/default/images/p/nnm-club.ico
copy styles/templates/default/images/p/rutor.ico to styles/templates/default/images/p/rutor.ico
copy styles/templates/default/images/p/rutracker.ico to styles/templates/default/images/p/rutracker.ico
copy admin/admin_pars_cfg.php to admin/admin_pars_cfg.php
copy styles/templates/admin/admin_pars_cfg.tpl to styles/templates/admin/admin_pars_cfg.tpl
copy data/cookies/.htaccess to data/cookies/.htaccess
copy data/cookies/rutracker.txt to data/cookies/rutracker.txt

#
#-----[ SQL ]------------------------------------------
#
INSERT INTO `bb_config` (`config_name`, `config_value`) VALUES
('parsmod_disable', '0'),
('parsmod_rutracker_login', ''),
('parsmod_rutracker_password', '');

#
#-----[ OPEN ]------------------------------------------
#
ajax.php

#
#-----[ FIND ]------------------------------------------
#
		require(CLASS_DIR .'sitemap.php');
		break;

#
#-----[ AFTER, ADD ]------------------------------------------
#
	case 'pars':
		require(INC_DIR . 'functions_parser.php');
		break;

#
#-----[ FIND ]------------------------------------------
#
		'manage_group'      => array('user'),

#
#-----[ AFTER, ADD ]------------------------------------------
#
		'pars'    	    => array('user'),

#
#-----[ FIND ]------------------------------------------
#
		require(AJAX_DIR . 'edit_group_profile.php');
	}

#
#-----[ AFTER, ADD ]------------------------------------------
#
	function pars()
	{
		require(AJAX_DIR . 'parser.php');
	}
		

# 
#-----[ OPEN ]------------------------------------------ 
#
posting.php

# 
#-----[ FIND ]------------------------------------------ 
#
if ($mode == 'newtopic' || $post_data['first_post'])
{
	$template->assign_var('POSTING_SUBJECT');
}

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
if (!$bb_cfg['parsmod_disable'] && ($mode == 'newtopic' || $post_data['first_post']))
{
	$template->assign_var('PARSMOD_ON');
}

#
#-----[ OPEN ]------------------------------------------
#
library/language/ru/main.php

#
#-----[ FIND ]---------------------------------
#
$lang['CAPTCHA_WRONG'] = '   ,    ';

#
#-----[ AFTER, ADD ]---------------------------------
#
//PARS
$lang['PARS_NEW_RELEASE'] = '   ';
$lang['PARS_ALLOWED_SOURCES'] = ' ';
$lang['PARS_RUTRACKER_SOURCES'] = 'Rutracker';
$lang['PARS_IN_NEXT_VERSION'] = '  ';
$lang['PARS_SOURCE'] = '';
$lang['PARS_PASTE_SOURCE_URL'] = '     ...';
$lang['PARS_NO_URL'] = '   ';
$lang['PARS_NOT_ALLOWED_SOURCES'] = '     ';
$lang['PARS_NO_WORK'] = '   .';
$lang['PARS_CONFIG'] = ' ParsMod';
$lang['PARS_CONFIG_DESC'] = '       ,    /    ,      .';
$lang['PARS_GENERAL_SETTINGS'] = '  ';
$lang['PARS_DISABLE_MOD'] = ' ';
$lang['PARS_DISABLE_MOD_DESC'] = '    .';
$lang['PARS_RUTRACKER'] = '  Rutracker';
$lang['PARS_LOGIN'] = '';
$lang['PARS_PASS'] = '';
$lang['CLICK_RETURN_PARS_CFG'] = '%s    ParsMod%s';

#
#-----[ OPEN ]---------------------------------
#
styles/templates/default/posting.tpl

#
#-----[ FIND ]---------------------------------
#
<tr>
	<th colspan="2" class="thHead"><b>{POSTING_TYPE_TITLE}</b></th>

#
#-----[ BEFORE, ADD ]---------------------------------
#
<!-- IF PARSMOD_ON -->
<tbody class="pad_4">
<tr>
	<th colspan="2" class="thHead"><b>{L_PARS_NEW_RELEASE}</b></th>
</tr>
<tr>
	<td>
		<div title="{L_PARS_ALLOWED_SOURCES}" style="float: right;vertical-align:top;">
			<img src="./styles/templates/default/images/p/rutracker.ico" alt="Rutracker" title="{L_PARS_RUTRACKER_SOURCES}">
			<img src="./styles/templates/default/images/p/lostfilm.ico" alt="Lostfilm" title="{L_PARS_IN_NEXT_VERSION}">
			<img src="./styles/templates/default/images/p/nnm-club.ico" alt="nnm-club" title="{L_PARS_IN_NEXT_VERSION}">
			<img src="./styles/templates/default/images/p/rutor.ico" alt="Rutor" title="{L_PARS_IN_NEXT_VERSION}"><br>
		</div>
		<b>{L_PARS_SOURCE}</b> <br>
	</td>
	<td>
		<input id="release_url" type="url" size=60 placeholder="{l_PARS_PASTE_SOURCE_URL}"> <input type="button" value="{L_SUBMIT}" name="Send" id="pars"> <br><div id="hida"></div>

	</td>
</tr>
<script type="text/javascript">
$('#pars').click(function(){
	ajax.exec({action: 'pars', pars_url: $('#release_url').val()});
	ajax.callback.pars = function(data) {
		
		$( "input[name='subject']" ).val(data.title);
		$('textarea#message').val(data.bbcode)
		ajax.exec({ action: 'posts', type: 'view_message', message: $('textarea#message').val()});
		$( "#hida" ).html(data.hid);

	};
});
</script>
<!-- ENDIF -->

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
#
# EoM