![]() |
| |||||||
| Mods and contribution Discussion This forum is only for discussion of modding phpLD. For specific mod releases, please see the appropriate forum. |
![]() |
| | Thread Tools | Display Modes |
| | #1 |
| Supporter Moderator Join Date: Dec 2005 Location: Cluj-Napoca/Sighisoara (Romania) Posts: 4,468 | There was a request for a three-way-linking mod. Submitters will no more link to your directory, instead they will have to link to a third site. (Reciprocal) This mod is for phpLD2, because the new phpLD 3.0.3 has this feature out-of-box. Edit "admin/init.php" and find following code (lines 323-335): Code: array('ID' => 'VISUAL_CONFIRM',
'NAME' => _L('Visual confirmation'),
'DESCRIPTION' => _L('Display antispam visual confirmation code on link submit page.'),
'CONFIG_GROUP' => '3',
'TYPE' => 'LOG',
'REQUIRED' => '1'),
array('ID' => 'REQUIRE_RECIPROCAL',
'NAME' => _L('Require reciprocal link'),
'DESCRIPTION' => _L('Require reciprocal link on link submit page.'),
'CONFIG_GROUP' => '3',
'TYPE' => 'LOG',
'REQUIRED' => '1'), Code: array('ID' => 'ENABLE_THREE_WAY',
'NAME' => _L('Enable three-way-linking'),
'DESCRIPTION' => _L('Submitters will have to link to a third site instead of this one.'),
'CONFIG_GROUP' => '3',
'TYPE' => 'LOG',
'REQUIRED' => '0'),
array('ID' => 'THREE_WAY_LINK_URL',
'NAME' => _L('Three-way-link URL'),
'DESCRIPTION' => _L('The URL of the site where submitters have to link.'),
'CONFIG_GROUP' => '3',
'TYPE' => 'STR',
'REQUIRED' => '0'),
array('ID' => 'THREE_WAY_LINK_TITLE',
'NAME' => _L('Three-way-link Title'),
'DESCRIPTION' => _L('The title of the site where submitters have to link.'),
'CONFIG_GROUP' => '3',
'TYPE' => 'STR',
'REQUIRED' => '0'), Code: # Pager Mod
array('ID' => 'PAGER_LPP', 'VALUE' => '20'),
# ID Mod
array('ID' => 'ENABLE_ID', 'VALUE' => '1'),
# Links open in blank window
array('ID' => 'ENABLE_BLANK', 'VALUE' => '0'), Code: # Three way linking
array('ID' => 'ENABLE_THREE_WAY', 'VALUE' => '0'),
array('ID' => 'THREE_WAY_LINK_URL', 'VALUE' => 'http://www.third-site.com/'),
array('ID' => 'THREE_WAY_LINK_TITLE', 'VALUE' => 'Third-Site'), Code: function read_config($db) {
global $tables, $tpl;
$sql = "SELECT * FROM {$tables['config']['name']}";
$db->SetFetchMode(ADODB_FETCH_ASSOC);
$rs = $db->Execute($sql);
while (!$rs->EOF) {
define($rs->Fields('ID'), $rs->Fields('VALUE'));
$rs->MoveNext();
}
} Code: function read_config($db) {
global $tables, $tpl;
$sql = "SELECT * FROM {$tables['config']['name']}";
$db->SetFetchMode(ADODB_FETCH_ASSOC);
$rs = $db->Execute($sql);
while (!$rs->EOF) {
define($rs->Fields('ID'), $rs->Fields('VALUE'));
$rs->MoveNext();
}
set_default_recpr();
}
function set_default_recpr() {
$default_recpr_link_url = (ENABLE_THREE_WAY == 1 ? THREE_WAY_LINK_URL : SITE_URL);
$default_recpr_link_title = (ENABLE_THREE_WAY == 1 ? THREE_WAY_LINK_TITLE : SITE_NAME);
define('DEFAULT_RECPR_URL', $default_recpr_link_url);
define('DEFAULT_RECPR_TITLE', $default_recpr_link_title);
} Code: function validate_recpr_link($value, $empty, & $params, & $form) {
global $tpl;
if ($empty && empty ($value))
return 1;
$ret = check_recpr_link($form);
if ($ret == -1) {
$tpl->assign('RECPR_ERROR', _L("The URL could not be validated. Either the page does not exist or the server could not be contacted."));
return 0;
}
if ($ret == 0) {
$tmp = _L("A link to #SITE_URL# could not be found at the specified URL.");
$tmp = str_replace('#SITE_URL#', SITE_URL, $tmp);
$tpl->assign('RECPR_ERROR', $tmp);
return 0;
}
return 1;
}
function check_recpr_link($data) {
if (!trim($data['RECPR_URL']))
return -1;
$ret = get_url($data['RECPR_URL'], URL_CONTENT);
if (!$ret['status']) {
return -1;
}
if (empty ($data['RECPR_ID'])) { //Old validation method (until RC3)
return (preg_match("`<a.*href=(\"|')?".SITE_URL."/?(\"|')?.*>`Ui", $ret['content']) && !preg_match("`<a.*href=(\"|')?".SITE_URL."/?(\"|')?.*rel\s*=\s*(\"|')nofollow(\"|').*>`Ui", $ret['content'])) == 0 ? 0 : 1;
} else { //New validation method
$valid = 0;
$rid = sprintf('R%X', $data['RECPR_ID']);
if (preg_match("`<a(.*href=(\"|')".SITE_URL."/?(\"|').*)>(.*)</a>`Ui", $ret['content'], $m)) {
error_log(sprint_r($m));
if (preg_match("`id=(\"|')".$rid."(\"|')`i", $m[1]) && !preg_match("`rel\s*=\s*(\"|')?\s*nofollow\s*(\"|')?`i", $m[1])) {
$valid = 1;
}
}
return $valid;
}
} Code: function validate_recpr_link($value, $empty, & $params, & $form) {
global $tpl;
if ($empty && empty ($value))
return 1;
$ret = check_recpr_link($form);
if ($ret == -1) {
$tpl->assign('RECPR_ERROR', _L("The URL could not be validated. Either the page does not exist or the server could not be contacted."));
return 0;
}
if ($ret == 0) {
$tmp = _L("A link to #SITE_URL# could not be found at the specified URL.");
$tmp = str_replace('#SITE_URL#', DEFAULT_RECPR_URL, $tmp);
$tpl->assign('RECPR_ERROR', $tmp);
return 0;
}
return 1;
}
function check_recpr_link($data) {
if (!trim($data['RECPR_URL']))
return -1;
$ret = get_url($data['RECPR_URL'], URL_CONTENT);
if (!$ret['status']) {
return -1;
}
if (empty ($data['RECPR_ID'])) { //Old validation method (until RC3)
return (preg_match("`<a.*href=(\"|')?".DEFAULT_RECPR_URL."/?(\"|')?.*>`Ui", $ret['content']) && !preg_match("`<a.*href=(\"|')?".DEFAULT_RECPR_URL."/?(\"|')?.*rel\s*=\s*(\"|')nofollow(\"|').*>`Ui", $ret['content'])) == 0 ? 0 : 1;
} else { //New validation method
$valid = 0;
$rid = sprintf('R%X', $data['RECPR_ID']);
if (preg_match("`<a(.*href=(\"|')".DEFAULT_RECPR_URL."/?(\"|').*)>(.*)</a>`Ui", $ret['content'], $m)) {
error_log(sprint_r($m));
if (preg_match("`id=(\"|')".$rid."(\"|')`i", $m[1]) && !preg_match("`rel\s*=\s*(\"|')?\s*nofollow\s*(\"|')?`i", $m[1])) {
$valid = 1;
}
}
return $valid;
}
} Code: <textarea name="RECPR_TEXT" rows="2" readonly="readonly" cols="37" class="text"><a href="{$smarty.const.DEFAULT_RECPR_URL}"{if $smarty.const.ENABLE_ID} id="R{$recpr_id|string_format:"%X"}"{/if}>{$smarty.const.DEFAULT_RECPR_TITLE}</a></textarea> Code: <textarea name="RECPR_TEXT" rows="2" readonly="true" cols="37" class="text"><a href="{$smarty.const.DEFAULT_RECPR_URL}"{if $smarty.const.ENABLE_ID} id="R{$recpr_id|string_format:"%X"}"{/if}>{$smarty.const.DEFAULT_RECPR_TITLE}</a></textarea> This is the needed SQL query: Code: INSERT INTO `PLD_CONFIG` (`ID`, `VALUE`) VALUES ('ENABLE_THREE_WAY', '0');
INSERT INTO `PLD_CONFIG` (`ID`, `VALUE`) VALUES ('THREE_WAY_LINK_URL', 'http://www.third-site.com/');
INSERT INTO `PLD_CONFIG` (`ID`, `VALUE`) VALUES ('THREE_WAY_LINK_TITLE', 'Third-Site'); That's all, you can enable now this feature and change settings in your admin panel by going: System >> Edit Settings >> Link Submit Good Luck! Boby Later Edit: I have also uploaded an archive with the files and needed changes and put also a sql file with the query. You can download it from attachment. __________________ wanna say thank you?
|
| |
| | #2 |
| Supporter Join Date: Dec 2005 Location: Asheville, NC Posts: 112 | Your welcome everyone ![]() Thanks for your work Boby |
| |
| | #3 |
| Supporter | insidedesign thank you ![]() you too boby |
| |
| | #4 |
| Supporter Join Date: Mar 2006 Location: Spain Posts: 75 | Hi. I want to make the backlink, no to a third party site, i want to make it to the same category that somebody submit your site. It´s possible? and the best, what´s the code .. :P Thx a lot. |
| |
| | #5 |
| Join Date: Jul 2005 Posts: 77 | Hi boby is it possible to rewrite this mod, that its possible to add more Linking URLs instead of only 1? i would like to have the option to offer the customer more Reciprocal URLs of my project. I am for sure willing to pay. please tell me your price! tx for help! |
| |
| | #6 |
| Join Date: Apr 2007 Posts: 16 | It doesnt work, the recirpocal isnt updated in the submit.php script. The db have the rigth information. Is there an easy way to ad different reciprocals to different submits? Last edited by David; 08-18-2009 at 12:03 AM. Reason: Spelling |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Change reciprocal html link to test on linking parter's site | kcook | Support (Version 2) | 0 | 05-19-2006 12:57 AM |
| Buttons for Linking to phpLD | vegabond | Design | 4 | 03-20-2006 10:07 PM |
| Buttons for Linking to phpLD here | ing | Design | 1 | 03-19-2006 02:19 AM |
| Linking from one page to the link submit page of a category | 5websearch | Design | 9 | 12-04-2005 07:53 AM |