Forums / Cotonti / Support / Direct Linking

duck101
#1 2009-07-01 00:56
Hey I was wondering if it is possible to "direct link" from the "list" to the page download/

in the core list.inc.php this is the url for the page "LIST_ROW_URL" => $pag['page_pageurl'], so I need to combine that with 'PAGE_FILE_URL' => sed_url('page', "id=".$pag['page_id']."&a=dl") in the page.inc.php, but put the code in the list.inc.php.

then because it links automatically to the download field url I need to be able to still edit it if I am the admin, so I put this in the list.inc.php
if ($usr['isadmin'])
{

	if($pag['page_state'] == 1)
	{
		$validation = "<a href=\"".sed_url('admin', "m=page&s=queue&a=validate&id=".$pag['page_id']."&amp;".sed_xg())."\">".$L['Validate']."</a>";
	}
	else
	{
		$validation = "<a href=\"".sed_url('admin', "m=page&s=queue&a=unvalidate&id=".$pag['page_id']."&amp;".sed_xg())."\">".$L['Putinvalidationqueue']."</a>";
	}
	$t-> assign(array(
			"PAGE_ADMIN_COUNT" => $pag['page_count'],
			"PAGE_ADMIN_UNVALIDATE" => $validation,
			"PAGE_ADMIN_EDIT" => "<a href=\"".sed_url('page', "m=edit&id=".$pag['page_id']."&r=list")."\">".$L['Edit']."</a>"
			));
}
so it doesn't work, I new that when I added it but I think I am missing the page identification code in from of the PAGE_ADMIN EDIT url

is this possible or should I not be messing around w/ the core. I realize it might be better to make a plugin but I am not very good at editing plugins
Trustmaster
#2 2009-07-03 16:53
What you need for download link is adding something like
"LIST_ROW_DOWNLOAD" => empty($pag['page_url']) ? '' : sed_url('page', 'id='.$pag['page_id'].'&a=dl'),
at about line 325.

As for the admin thing, it is already there, use the {LIST_ROW_ADMIN}.
May the Source be with you!
duck101
#3 2009-07-03 23:22
it didn't work :(

		"LIST_ROW_URL" => $pag['page_pageurl'],
		"LIST_ROW_MORE" => $pag['page_pageurl'],
		"LIST_ROW_ID" => $pag['page_id'],
		"LIST_ROW_CAT" => $pag['page_cat'],
		"LIST_ROW_KEY" => sed_cc($pag['page_key']),
		"LIST_ROW_TITLE" => sed_cc($pag['page_title']),
		"LIST_ROW_DESC" => $pag['page_desc'],
		"LIST_ROW_DESC_OR_TEXT" => sed_cutpost($pag['page_text'], 200, false),
		"LIST_ROW_AUTHOR" => sed_cc($pag['page_author']),
		"LIST_ROW_OWNER" => sed_build_user($pag['page_ownerid'], sed_cc($pag['user_name'])),
		"LIST_ROW_DATE" => @date($cfg['formatyearmonthday'], $pag['page_date'] + $usr['timezone'] * 3600),
		"LIST_ROW_FILEURL" => $pag['page_url'],
		"LIST_ROW_SIZE" => $pag['page_size'],
		"LIST_ROW_COUNT" => $pag['page_count'],
		"LIST_ROW_FILEICON" => $pag['page_fileicon'],
		"LIST_ROW_FILECOUNT" => $pag['page_filecount'],
		"LIST_ROW_JUMP" => sed_url('page', $page_urlp.'&a=dl'),
		"LIST_ROW_COMMENTS" => $pag['page_comments'],
		"LIST_ROW_RATINGS" => $list_ratings,
		"LIST_ROW_ADMIN" => $pag['admin'],
		"LIST_ROW_ODDEVEN" => sed_build_oddeven($jj)
                  "LIST_ROW_DOWNLOAD" => empty($pag['page_url']) ? '' : sed_url('page', 'id='.$pag['page_id'].'&a=dl'),
));

EDIT Never mind: It's because I didn't put a ,
Kilandor
#4 2009-07-03 23:25
"LIST_ROW_ODDEVEN" => sed_build_oddeven($jj),
"LIST_ROW_DOWNLOAD" => empty($pag['page_url']) ? '' : sed_url('page', 'id='.$pag['page_id'].'&a=dl'),
));

It should look like above, your missing a , at the end of the LIST_ROW_ODDEVEN line

Side note, this FILEURL tag should be changed to this behaviour anyways (i'll do that)
This post was edited by Kilandor (2009-07-03 23:26, 15 years ago)
duck101
#5 2009-07-03 23:32
yeah I figured that out thanks.

but go here and click on one of them and every other time it will take you to what I put in the download field and the other half you'll just go to the page....why is this?
This post was edited by duck101 (2009-07-05 14:10, 15 years ago)
Trustmaster
#6 2009-07-17 04:42
It's something with the REFERER check (anti-leech). A dirty fix would be commenting that check in page.inc.php:
/*if ($_SESSION['dl']!=$pag['page_id'])
	{
		header('Location: ' . SED_ABSOLUTE_URL . $pag['page_pageurl']);
		exit;
	}*/
May the Source be with you!
duck101
#7 2009-07-17 07:14
Alright I replaced
	if ($_SESSION['dl']!=$pag['page_id'])
	{
		header('Location: ' . SED_ABSOLUTE_URL . sed_url('page', 'id='.$pag['page_id']));
		exit;
	}

With the code you gave me, It works what can I say your the best. My only worry is what all will this effect. For Ex. does this only have effect when I use LIST_ROW_DOWNLOAD
"LIST_ROW_DOWNLOAD" => empty($pag['page_url']) ? '' : sed_url('page', 'id='.$pag['page_id'].
or any time I have a download in the download field will it always automatically download instead of going to the page first becuase I only want this to happen w/ list.flash.tpl and list.links.tpl
Trustmaster
#8 2009-07-17 12:19
That only disables anti-leech, nothing else is affected.
May the Source be with you!