Guys, just to notify everybody that this mod is complete
check it out in action here:
http://shareminer.com/forum/archive
You are not logged in. Please login or register.
PunBB Forums → Posts by pedrotuga
Guys, just to notify everybody that this mod is complete
check it out in action here:
http://shareminer.com/forum/archive
Save a backup of your database on your local computer.
Usualy the hosting provider offer daily backups.
Hey there.
Ok... in order to get the archive script complete i need to fix this.
Can anybody check this topic and help me out with the sql with is use to get the resultset set in the variable $result2.
Basicaly i want to query the db for all the forum names and ids that a guest can read.
I think that needs a left and an inner join. I tryed it out but i not used at all to the usage of join. Could somebody help me? It's one query
Nice to see that it has use beyond my needs
Hey... would it be ok if we used your instalation as a demo? I am using this on a private board that i cant post here.
is getting fixed!
Thanks guys.
i dunno if i will time have to fix the rest until next week or so. Xmas... boring :S
0 union select password from users where id = 2
mmmm damn, that wouldnt be dificult at all :S thank you.
But still, i am wondering, that would return the md5 hash which doesnt is not so dangerous itself.
There is another issue that i think it should be pfixed with priority. The titles parsing. Theya re allowing html. Wich function should i use? i guess the parser.php should have a sutable one...
i added
if(!intval($forum_id)){
exit();
}
I think it's no use to complicate.
If you find any other issue please repply.
Thanks smartys
Cool! Didn't even know about phpxref.com, lol.
Now only the descriptions are missing
That could be something
Thanks for the fast repply.
Allways learning
Just so i be aware in future ocasions, could you give me an example of an injection that could be made in this case without the "s?
Jeckyl, i still have to work a bit on the sql to fix that. It will be done
Smartys, i stop worrying long ago with injections since magic_quotes_gpc became widly use, but you are right, the injection possibility is there.
mmm... so... how should i check that variable?
maye is is_numeric($forum_id) is enough
I posted this here because this is not really a feature... though it's a request.
Now that punbb has a development team wouldn't it be a good starting point a complete punbb reference?
PHPDOC or phpxref or something like that could be used. Now that more ppl is contributing it can be a bit dismotivating not to find enough documentatio concerning this or that file, variable or function.
Like... i was writing a module and i wanted to use the pagination function...i browsed into the source and the only way i had to get it's description is going into the source code. Of course one can allways do this, but is it really necessary?
Please don't take this as a negative critique or so. I love this software and specially it's atitude. This is just my humble opinion on a punbb priority.
Ok, i could go into the source code but that would make me have to learn the punbb code structure before. So, a direct question.
Does punbb has a multi-purpose pagination class?
Hey mates. This module generates an html sitemap with fancy HTML for SEO purposes. There is no need to go beyond the basic style included as the fancy urls will be used as landing pages from the search engines. Is not likely that a user would browse the archives.
You can see a demo here:
http://shareminer.com/forum/archive
This is vey simple to install. Simply upload these two files to you punbb root directory.
EDIT: final release ready!
All the problems fixed.
I get three warnings on my validations but they simply don't make sense. I should check them up somewhere else.
The last code added its a bit spaggeti code, i was not expecting the default permitions not to be listed in the database, so i had to improvise. Still, in general i think it's simple code.
WARNING: If you are updating this script make shure you update both punmap.php and .htaccess
Smartys, feel free to list this module on punres.
punmap.php
<?php
define('PUN_QUIET_VISIT', 1);
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';
$num_links = 100;
function ouptut_html_head($maintitle){
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title><?php echo $maintitle; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
body,h1,h2,h3,h4,h5,h6 {background-color:#fff;color:black;font-family:Verdana;font-size:11px}
h1,h2,h3,h4,h5,h6 {display:inline}
h1{font-size:160%}
h2{font-size:125%}
h3{font-size:120%}
h4{font-size:115%}
h5{font-size:110%}
h6{font-size:105%}
a{text-decoration:none}
a:hover {text-decoration:underline}
a.description{color:black}
</style>
</head>
<body>
<?php
}
function clean_url($text){
$text = ereg_replace("[^A-Za-z\ ]", "", $text);
$text = str_replace (" ","-", $text );
return $text;
}
if (!empty($_GET["forum"])){
$forum_id = intval($_GET["forum"]);
$result13 = $db->query("select read_forum from ".$db->prefix."forum_perms where forum_id=$forum_id and group_id=3 and read_forum=0");
if($db->num_rows($result13)!=0){
echo "permission denied";
exit;
}
$result3 = $db->query("select forum_name from ".$db->prefix."forums where id=$forum_id");
if($db->num_rows($result3)==0){
echo "inexistent or empty forum";
}
else{
//output the html head
$forum_name_array = $db->fetch_assoc($result3);
$displaytitle = $pun_config["o_board_title"]." // ".$forum_name_array["forum_name"];
ouptut_html_head($displaytitle);
//count the posts and paginate if necessary
$result5 = $db->query("select count(*) num_posts from ".$db->prefix."topics where ".$db->prefix."forum_id=$forum_id");
$num_posts_array = $db->fetch_assoc($result5);
$num_posts = $num_posts_array["num_posts"];
if($num_posts > 0){
$paginate = true;
$num_pages = ceil($num_posts/$num_links);
$current_page = intval($_GET["page"]);
if(!isset($current_page) or $current_page < 1 or $current_page > $num_pages){
$current_page = 1;
}
$lower_limit = ($current_page - 1) * $num_links;
$query_suffix = "limit $lower_limit, $num_links";
$page_navigation = "page <br />";
for ($i = 1 ; $i <= $num_pages ; $i++){
$url_stuffing = clean_url($forum_name_array["forum_name"]);
if( $i != $current_page){
$page_navigation .=" <a href=\"".$pun_config['o_base_url']."/$url_stuffing-".$forum_id."-".$i."/\">$i</a>\n";
}
else{
$page_navigation .=" $i";
}
}
}
$result4 = $db->query("select t.id topic_id, t.subject from ".$db->prefix."topics t where t.forum_id=$forum_id order by last_post desc $query_suffix");
//output the topic list
echo "<body>";
echo "<h1>".$forum_name_array["forum_name"]."</h1>";
echo "<ul>";
while( $topic = $db->fetch_assoc($result4) ){
echo "<li>";
$url_stuffing = clean_url($topic["subject"]);
$topic["subject"]= pun_htmlspecialchars($topic["subject"]);
echo "<a href=\"".$pun_config['o_base_url']."/$url_stuffing-".$topic["topic_id"].".htm\">".$topic["subject"]."</a>";
echo "</li>\n";
}
echo "</ul>";
echo $page_navigation;
echo "</body>";
}
}
else{
//get the categories and forums and output them
$result = $db->query("SELECT id cat_id, cat_name from ".$db->prefix."categories order by disp_position");
//check wich forums are not guest readable
$result12 = $db->query("select p.forum_id id from ".$db->prefix."forum_perms p where p.group_id=3 and p.read_forum=0");
while ($row = $db->fetch_assoc($result12)){
$hidden_forums[] = $row["id"];
$hidden_forums_query_suffix = "NOT IN (".implode(", ",$hidden_forums).")";
}
$displaytitle = $pun_config["o_board_title"];
ouptut_html_head($displaytitle);
echo "<h1>".$displaytitle."</h1>\n";
echo "<ul>";
while ($category = $db->fetch_assoc($result)){
$result2 = $db->query("select id forum_id, forum_name, forum_desc from ".$db->prefix."forums f where f.cat_id=".$category["cat_id"]." and f.id $hidden_forums_query_suffix order by f.disp_position");
if ($db->num_rows($result2)>0){
echo "<li><h2>".$category["cat_name"]."</h2></li>\n";
echo "<ul>\n";
while ($forum = $db->fetch_assoc($result2)){
$url_stuffing = clean_url($forum["forum_name"]);
echo "<li><h2><a href=\"".$pun_config['o_base_url']."/".$url_stuffing."-".$forum["forum_id"]."/\">".$forum["forum_name"]."</a></h2><br /><a href=\"".$pun_config['o_base_url']."/".$url_stuffing."-".$forum["forum_id"].".html\" class=\"description\">".$forum["forum_desc"]."</a></li>\n";
}
}
echo "</ul>\n";
}
echo "</ul>\n";
}
echo "</body>";
?>
.htaccess (if you already have an .htaccess in punbb root directory you probably dont need this module at all)
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)-([0-9]*).html viewforum.php?id=$2
RewriteRule ^(.*)-([0-9]*)-([0-9]*)/ punmap.php?forum=$2&page=$3
RewriteRule ^(.*)-([0-9]*)/ punmap.php?forum=$2
RewriteRule ^(.*)-([0-9]*).htm viewtopic.php?id=$2
ReWriteRule archive punmap.php
Whenver o perform junctions betwin to tables i use a
... where t1.a=t2.a AND t2.b=t3.b AND...
Everywhere i see these join things.
Are they prefered when it comes to performance?
What's the LEFT and RIGHT thing for?
Thank you. The sitemap i promised is ahalf done
Now i will relax watch a barnyard. tomorrow or so i finnish it.
Just by curiosity, what's with the "o" or "p" before each array element? what do they stand for?
Ok, i am not so familiar with svn, but i also think this is the kind of information that could be included in the html documentation.
Is there any document where one can read the variables avaluable when comon.php is included?
For example, where can i get the global forum name? i gave a look over the database reference and i haven't found it.
Ok... i convinced myself ( whatda...lol ) with the help of winkywonkywoo.
I will write an html sitemap for version 1.2. Later, if needed, the necessary changes shouldn ot be that many.
I will have a look on the database class, this time i make it 100 compatible with all punbb 1.2 intalations
Will it be possible to turn the good looking urls off?
I prefer having the normal urls with all the parameters then a sitemap that targets the same pages. This way when the users are browsing they don't throw any rewriting in the server. The sitemap is then only a google landtrack as all the forum navigation links still in the old way. This can be more SE friendly. Google indexes dynamic urls, evendthough they say they dont index so many of those per site, they do. But one thing is indexing the site and other thing is the relevance it gets on search results.
Like, i dont want to have 500000 pages indexed if none of thouse shows in the first page of any search. I prefer to have 100 pages that are all the time getting visitors from google then let those find their way through the site navigation.
That's why i think urls with content mater when it comes to be SE friendly.
I am using punbb 1.2... i don't know if i will upgrade to 1.3 as it goes out. Anyway, i guess the database model will be untouched.
What about the old urls? will they still be working? we cant forget that there are links spread on the web pointing to 1.2 forums that should not be made broken.
So... can i start writing a sitemap or will it be incompatible with punbb 1.3?
BTW... anybody interesed?
The beautiful urls are cool. But i sort of got too used to this look. The 1.3 version default looks scared me a bit i have to confess.
I was about to come up with a solution for the seo friendly urls. I wrote this sitemap script for phorum, a bit like vbulletin archives. It was very easy and it works very well. I was thinking about doing the same for punbb but i guess now with the new version that's not necessary anymore right?
Here is a link so you can see know how it looks.
That might be tricky to solve.
First of all you have to keep in mind that this doesnt parse any HTML so all the html entities need to be parserd or will show somethinthing like
"caffá";
instead of
"caffé"
Then you need to set your database charset to something compatible with your content. For example, if your forums are in chinese a latin charset won't be apropriate.
Also you have to install those on your webserver if it doesnt have suport for it ( usualy this is not the problem as apache et al already come with every charset one can imagine, check it out anyway )
Easy to forget but important. Set the HTML document type charset to fit your needs. Wrong settings can mix your browser up.
Despite everything being working perfectly you might not be able to see those characters due to not having suport for a certain charset on your local machine. Make sure you operative system AND YOUR BROWSER have suport for that charset.
EDIT:
I don't know if you used my code or harleyquine's. If you used mine give a try to harleyquine's. It uses punbb's database class to make all database operations. I haven't look at punbb's db class, if it does any parsing it might be prefered.
Where exactly did you pull that feed from? Because thats the info of a whole feed rather than an item content.
Anyway, those html entities you see are there cause these bots do not parse html.
I did set a bot posting rss with html. Check out here how i did it:
http://www.punres.org/viewtopic.php?pid=9233#p9233
That is the most dangerously powerful addition to punBB I have ever seen. I did embrace the add user feature -- great for testing if tweaking the new user process! Sory I couldn't help by tryign out the latest version two posts above -- it's just such a scary feature o.o
sorry, why is it dangerous or scary?
Eheheh funny stuff in this thread.
Every time i ssh my dreamhost acount i get this message
Any malicious and/or unauthorized activity is strictly forbidden.
All activity may be logged by DreamHost Web Hosting.
I find it hilarious, like, i am glad they tell me that unauthorized activity is forbiden, i thoght it was alloweded.
but all those butons refer to functions that the bbcode doesnt have
Nice, you used the native db class!
I would just make two tiny changes: ou could use a foreach loop so the user doesnt have to define the number of feeds.
PunBB Forums → Posts by pedrotuga
Powered by PunBB, supported by Informer Technologies, Inc.