With this plugin is it possible to cleanup forum in one pass ?

Regards

Tjalve wrote:

This one uses the cookie info:

<?php
/**
* Punn BB creates an RSS feed for New Posts since last visit
* half written half hacked by Chris Neal
*/

// set header
header("Content-Type: text/xml");
// call Punn BB constants
define('PUN_ROOT', './');
define('PUN_QUIET_VISIT', 1);
require PUN_ROOT.'include/common.php';

//set configuation options
$title = pun_htmlspecialchars($pun_config['o_board_title']);
$desc = $title." Rss Feed";
$baseURL = $pun_config['o_base_url'];

//find out if user has a cookie
if (isset($_COOKIE['fa_cookie']))
    list($cookie['user_id'], $cookie['password_hash']) = @unserialize($_COOKIE['fa_cookie']);
if ($cookie['user_id'] > 1)
{
    $result = $db->query('SELECT t.id FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.last_post>'.$pun_user['last_visit']) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
} else{
    $result = $db->query('SELECT t.id FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.last_post>'.(time() - 86400)) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
}
//run query functions
$num_hits = $db->num_rows($result);
if (!$num_hits){
echo '<?xml version="1.0" encoding="ISO-8859-1" ?>'."\n";
echo '    <rss version="2.0">'."\n";
echo '        <channel>'."\n";
echo '            <title>'.$title .'</title>'."\n";
echo '            <link>'.$baseURL.'</link>'."\n";
echo '            <description>'.$desc .' '.count($search_set).'</description>'."\n";
echo '            <language>en</language>'."\n";
echo '            <copyright>© '.$title .'</copyright>'."\n";
echo '            <lastBuildDate>'.date("r").'</lastBuildDate>'."\n";
echo '            <item>'."\n"; 
echo '            <title>No Recent Posts</title> '."\n";
echo '            <link>'.$baseURL.'/</link>'."\n";
echo '            <description>No new Posts</description> '."\n";
echo'            </item>'."\n";
echo'        </channel>'."\n";
echo'    </rss>';
} else {
$sort_by = 4;
$search_ids = array();
while ($row = $db->fetch_row($result))
    $search_ids[] = $row[0];
$db->free_result($result);
$show_as = 'topics';
// Final search results
$search_results = implode(',', $search_ids);
// Fill an array with our results and search properties
$temp['search_results'] = $search_results;
$temp['num_hits'] = $num_hits;
$temp['sort_by'] = $sort_by;
$temp['sort_dir'] = $sort_dir;
$temp['show_as'] = $show_as;
$temp = serialize($temp);
$search_id = mt_rand(1, 2147483647);
//set results 
$sort_by_sql = 't.last_post';
$sql = 'SELECT t.id AS tid, t.poster, t.subject, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.closed, t.forum_id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id WHERE t.id IN('.$search_results.') GROUP BY t.id, t.poster, t.subject, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.closed, t.forum_id'.$group_by_sql.' ORDER BY '.$sort_by_sql;
$result = $db->query($sql) or error('Unable to fetch search results', __FILE__, __LINE__, $db->error());
$search_set = array();
while ($row = $db->fetch_assoc($result))
    $search_set[] = $row;
$db->free_result($result);

// Write out feed
echo '<?xml version="1.0" encoding="ISO-8859-1" ?>'."\n";
echo '    <rss version="2.0">'."\n";
echo '        <channel>'."\n";
echo '            <title>'.$title .'</title>'."\n";
echo '            <link>'.$baseURL.'</link>'."\n";
echo '            <description>'.$desc .' '.count($search_set).'</description>'."\n";
echo '            <language>en</language>'."\n";
echo '            <copyright>© '.$title .'</copyright>'."\n";
echo '            <lastBuildDate>'.date("r").'</lastBuildDate>'."\n";
//loop through items
for ($i = 0; $i < count($search_set); ++$i) {
echo '            <item>'."\n"; 
echo '            <title> '.$search_set[$i]['subject'].' </title> '."\n";
                if ($search_set[$i]['question'] == "")
echo '            <link>'.$baseURL.'/viewtopic.php?id='.$search_set[$i]['tid'].'</link>'."\n";
                else
echo '            <link>'.$baseURL.'/viewpoll.php?id='.$search_set[$i]['tid'].'</link>'."\n";
echo '            <description>'.str_replace("\n", '<br />', pun_htmlspecialchars($search_set[$i]['message'])).'</description> '."\n";
echo'            </item>'."\n";
}

// end feed
echo'        </channel>'."\n";
echo'    </rss>';
}
?>

Thank's Tjalve it's what i was looking for wink
I would like to improve it but i didn't find how hmm
I was searching how to :
- Show a small description of post
- Choose the forum to be displayed ( not all )
- Order by recent post first

Any advice ?

Regards

Any advice ?

4

(2 replies, posted in PunBB 1.2 troubleshooting)

Try Comment Control, good mod !

MattF wrote:

In parser.php, where the url's are parsed, adding some check in there that creates the link dependent upon a forum uri/link uri check. For example, check the link uri against the $pun_config['o_base_url'] for a match, and create the link accordingly.

Totally agree with you, thank you, but how can i do that, i've just 4 or 5 links to check like this ( if link1-> event 1):

If Link 1

<a href="#" onmouseover="doTooltip(event,1)" onmouseout="hideTip()">Link 1</a>

If Link 2

<a href="#" onmouseover="doTooltip(event,2)" onmouseout="hideTip()">Link 2</a>

And so on...

Thank you Quaker, but it's not navigation menu links i'd like to change but links inside post

I would like to add link image tooltip only for pages that are in same forum's domain,not for the externals links.
No problem for doing this everywhere i can write links in html, but inside post i didn't find how.
I know the solution would be to write a new bbcode link in parser.php, but how can i do that ?
Here is the way to write the link :

<a href="#" onmouseover="doTooltip(event,0)" onmouseout="hideTip()">Link</a>

Any advice would be helpfull

Regards

8

(8 replies, posted in PunBB 1.2 troubleshooting)

Try his in .htaccess works for html files, perhaps you'll have to adjust for php also.

AddDefaultCharset UTF-8
AddCharset UTF-8 .xhtml 
AddType 'text/html; charset=UTF-8' html

Can anyone show me how to limit output to first x characters of post ( what to modify or make it configurable in AP_News_Generator.php ) ?

Regards

Thank you, i'll do that wink

fantasma wrote:

use it in header smile

???  hmm

Using bbclone for a long time, and it's great.
Look at post #2 from Pogenwurst, instead of having extra statistics in index.php, i would like to have it centered in in the last line of footer.
I've tried to make the same modifications in footer.php, but result gives nothing acceptable.
Any one for a solution ?

Regards

Good mod but i've done some modifications with url rewriting and the links are not displayed correctly ( error 404 )

What do i have to modify in punmap.php to have

1) The forum url displayed like that :

http://www.url_to_forum/categorie-forum_id-forum_name.html instead of
http://www.url_to_forum/forum_name-forum_id.html

2) The viewtopic url displayed like that :

http://www.url_to_forum/discussion-topic_id-topic_name.html instead of
http://www.url_to_forum/topic_name--topic_id.html

3) If there is an extended character in a forum or topic name ( like é,è...) the letter is not displayed at all ,giving also bad link

Any help would be appreciated

Regards

14

(7 replies, posted in PunBB 1.2 troubleshooting)

No doesn't work , same problem hmm

15

(7 replies, posted in PunBB 1.2 troubleshooting)

Thank you Smartys,but same results no confirmation or error message.

16

(7 replies, posted in PunBB 1.2 troubleshooting)

Think i've made a mistake i've put a } on line 69 , form is displayed correctly but not processed well.
I don't have the confirmation message or the error message, nothing is displayed ?
Could someone have a look to the code above and help me to fix it ?

Regards

17

(7 replies, posted in PunBB 1.2 troubleshooting)

Thanks , found where missing } was.

18

(7 replies, posted in PunBB 1.2 troubleshooting)

Tried to implement an anti-spam captcha code on modified contact form found here :
Contact Form 1.0.0

But i have an error :

Parse error: parse error, unexpected $ in /forum/contact.php on line 125

Here is my contact.php :

<?php
define('PUN_ROOT', './');
define('PUN_QUIET_VISIT', 1);
require PUN_ROOT.'include/common.php';
$page_title = pun_htmlspecialchars($pun_config['o_board_title']) . ' / Contact';        //Set the page title here
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';
require PUN_ROOT.'include/parser.php';
//echo "<PRE>"; print_r ($pun_config); echo "</PRE>";

if ($_POST[form_sent] == 1) {
//Process The Form
?>

<?php
    $as = $_POST['antispam'];
$as2 = $_POST['spamvalidator'];
 if ($as != $as2){
?>
<div class="blockform">
    <h2><span>Contact <?php echo $pun_config['o_board_title']; ?></span></h2>
    <div class="box">
        <form id="contact" method="post" action="contact.php">
            <div class="inform">
                <fieldset>
                    <legend>Email not sent</legend>
                    <div class="infldset">
                        <b>Your mail could not be sent!</b> The antispamcode you entered did not match.
                    </div>
                </fieldset>
            </div>
        </form>
    </div>
</div>
<?php
      }elseif($as == $as2){
    $recipient = "$toName <".$toMail.">";
    $headers ="From: ".$_POST[name]." <".$_POST[email].">";
    $subject = "WEBFORM:".$_POST[subject];
    $message = str_replace("\\", "", $_POST[comments]);
    mail($pun_config['o_admin_email'], $subject, $message, $headers);
?>


<div class="blockform">
    <h2><span>Contact <?php echo $pun_config['o_board_title']; ?></span></h2>
    <div class="box">
        <form id="contact" method="post" action="contact.php">
            <div class="inform">
                <fieldset>
                    <legend>Email Sent</legend>
                    <div class="infldset">
                        <b>Thank you for contacting us!</b> The following information was sent to <?php echo $pun_config['o_board_title']; ?>.<br /><br />
                        <label>Name:<br /><?php echo $_POST[name]; ?><br /></label>
                        <label>Email:<br /><?php echo $_POST[email]; ?><br /></label>
                        <label>Subject:<br /><?php echo $_POST[subject]; ?><br /></label>
                        <label>Comments:<br /><?php echo $_POST[comments]; ?><br /></label>
                    </div>
                </fieldset>
            </div>
        </form>
    </div>
</div>

<?php } else { 
//Display the Form
$antispam = dechex(rand(hexdec(000000), hexdec(FFFFFF)));
?>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must be an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must be a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must be a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following errors occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}
//-->
</script>
<div class="blockform">
    <h2><span>Contact <?php echo $pun_config['o_board_title']; ?></span></h2>
    <div class="box">
        <form id="contact" method="post" action="contact.php">
            <div class="inform">
                <fieldset>
                    <legend>Enter your contact details</legend>
                    <div class="infldset">
                        Please enter your contact information and comments here. If you would like to share your comments with everyone, consider posting them on the <a href="forum.php">forum</a> instead!<br />
                        <input type="hidden" name="form_sent" value="1" /><br />
                        <label>Name<br /><input type="text" name="name" value="" size="40" maxlength="40" /><br /></label>
                        <label>Email<br /><input type="text" name="email" value="" size="40" maxlength="50" /><br /></label>
                        <label>Subject<br /><input type="text" name="subject" value="" size="40" maxlength="50" /><br /></label>
                        <label>Comments<br /><textarea name="comments" rows="5" cols="40"></textarea><br /></label>
                        <label>No spam:<br /><input name="antispam" type="text" class="tekst" size="6"> <?php echo $antispam; ?> <input type="hidden" value="<?php echo $antispam; ?>" name="spamvalidator" /></label>
                    </div>
                </fieldset>
            </div>
            <p><input type="submit" name="update" value="Submit"  onClick="MM_validateForm('name','','R','email','','RisEmail','subject','','R');return document.MM_returnValue" /></p>
        </form>
    </div>
</div>



<?php

}    //close if statement
 
require PUN_ROOT.'footer.php';

Any advice ?

Regards

Thank you very much falconflyz,it's what i was looking for.

Highslide JS is a piece of JavaScript that streamlines the use of thumbnail images on web pages.
Not a specialist in modifying Punbb's parser.php file is there a master coder that could implement this feature to make it work on forum's image tag.
Regards

I'm testing localy this excellent flash gallery script Flash gallery script in a subdirectory of the forum.
Having just added an additionnal link to point to the directory where gallery index file is located.
I would like to have the header and the footer forum in the gallery page.
I've added this code in top of index.php

<?php
define('PUN_ROOT', '../');
require PUN_ROOT.'include/common.php';

if ($pun_user['g_read_board'] == '0')
    message($lang_common['No view']);

require PUN_ROOT.'header.php'; 
?>

Here is the index.php of the gallery

<?php
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// CETTE PARTIE SERT AU CALCUL DES STATISTIQUES, SI VOUS LA SUPPRIMEZ LES STATISTIQUES NE FONCTIONNERONT PLUS
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");            // Date du passé 
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // toujours modifié 
header("Cache-Control: no-cache, must-revalidate");          // HTTP/1.1 
header("Pragma: no-cache");                                  // HTTP/1.0 
$dt_a =date ("Y");
$dt_m =date ("m");
$dt_j =date ("d");
$dt_h =date ("H");
$dt_mn =date ("i");
$dt_s =date ("s");
$st_sess=0;
$st_sess=$_GET['ac_sess'];
$st_reference=$_GET['ac_reference'];
$st_type=$_GET['ac_type'];
$st_languec=$_GET['ac_languec'];
$gallerie=$_GET['gallerie'];
$hidemenu=$_GET['hidemenu'];
if ($st_sess > 0) {
} else {
$hasard=rand (0, 9000);
$st_sess= $dt_s.$hasard.$dt_j.$dt_h.$dt_mn.$dt_m.$dt_a;
$st_reference=getenv("HTTP_REFERER");
$st_reference2=getenv("SERVER_NAME").getenv("REQUEST_URI");
$empla=strpos($st_reference2,'?');
if($empla){$st_reference2=substr($st_reference2,0,$empla);}
}
$ip=getenv("REMOTE_ADDR");
$navigateur=getenv("HTTP_USER_AGENT");
$nbpages=$st_nbpages;
$nbclic=$st_nbclics;
$exploitation=$st_os;
$langue=$st_langue;
$resolution=$st_resolution;
$sess=$st_sess;
$reference=$st_reference;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Galerie Photo</title>
<style type="text/css">
<!--
body,td,th {
    color: #222222;
}
body {
    background-color: #222222;
}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
////////////////////////////////////////////////////////////////////////////////////////
// CETTE PARTIE SERT A REDIMENSIONNER AUTOMATIQUEMENT L'ECRAN - VOUS POUVEZ LA SUPPRIMER
if (screen.height>800) {
var gtop=(screen.height-750)/2;
var gleft=(screen.width-820)/2;
self.resizeTo(820,750);self.moveTo(gleft,gtop);self.focus();
}
else {
self.resizeTo(screen.width,screen.height);self.moveTo(0,0);self.focus();
}; 
////////////////////////////////////////////////////////////////////////////////////////
//-->
</script>

</head>
<body>
<div align="center"><table width="90%" height="90%"  border="0" align="center" cellpadding="0" cellspacing="0"><tr><td align="center" valign="middle"><div align="center">
<!--//////////////////////////////////////////////
// CETTE PARTIE CONTIENT L'APPEL DE LA GALERIE 
//////////////////////////////////////////////-->
      <br>
      <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="750" height="450" align="middle">
    <?php $phrase1='<PARAM NAME=movie VALUE="09.swf?hidemenu='.$hidemenu.'&gallerie='.$gallerie.'&ac_annee='.$dt_a.'&ac_mois='.$dt_m.'&ac_jour='.$dt_j.'&ac_sess='.$sess.'&ac_reference='.$st_reference.'&ac_reference2='.$st_reference2.'">';
print $phrase1;?>
        <param name="quality" value="best" >
    <param name="wmode" value="transparent" >
        <param name="bgcolor" value="#ffffff" >
        <embed <?php $phrase2='src="09.swf?hidemenu='.$hidemenu.'&gallerie='.$gallerie.'&ac_annee='.$dt_a.'&ac_mois='.$dt_m.'&ac_jour='.$dt_j.'&ac_sess='.$sess.'&ac_reference='.$st_reference.'&ac_reference2='.$st_reference2.'"';print $phrase2;?> quality="best" wmode="transparent" bgcolor="#ffffff" width="750" height="450" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />      
</object>
      <br>
      <!--//////////////////////////////////////////////-->
</div></td></tr></table></div>
</body>
</html>

and this at bottom of the file

<?php

require PUN_ROOT.'footer.php';

?>

The result is not perfect at all, everything is shifted.
Where did i do a ( or many ) mistake ?
Any advice would be helpfull

@apollo

Where did you change the color ?
In footer.php,main.tpl,style.css or style_cs.css ?

Thank you

23

(11 replies, posted in PunBB 1.2 show off)

Very nice Submerged style and the gallery looks great.
Do you plan to make a gallery mod with all your modifications ?

Have a look there:
http://www.punbb.fr/forums/viewtopic.php?id=3587

Demo there :
http://www.math-linux.com/forum/viewtopic.php?id=1

Sorry in french only.

Try this script

Add this code to your page

<?php
function get_ip()
{
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])){
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];}
elseif(isset($_SERVER['HTTP_CLIENT_IP'])){
$ip = $_SERVER['HTTP_CLIENT_IP'];}
else{ $ip = $_SERVER['REMOTE_ADDR'];}
return $ip;
}
$ip = get_ip();

if($ip == "85.210.63.255") { echo "<META HTTP-EQUIV='Refresh' CONTENT='0;URL=http://xxxx/xxxx/alert.php'>"; exit; }
?>

Then the file alert.php,feel free to modify it and add as many alert you want

<SCRIPT LANGUAGE="JavaScript">
alert('attention vous avez un virus');
alert('certaine parti de vos fichiers sont en train de s effacer');
alert('attention le virus HACK ADSL est en train de ralentir votre connexion adsl');
alert('félicitation votre systéme windows vient d être mis a jour');
alert('windows alert votre systéme d exploitation viens d être attaqué');
alert('voulez vous réelement effacer vos fichiers');
alert('attention votre navigateur internet vient d être infecté');
alert('attention instabilité du système');
alert('attention certaines partie de vos fichiers textes viennent d être effacé');
alert('alert le virus Wanabi vient d être instalé sur votre ordinateur');
alert('erreur windows est instable');
alert('félicitation votre base de registre vient d être mis a jours');
alert('attention ceci va perturber windows');
alert('windows error instabilité du systéme');
alert('votre cm dos est enregistré');
alert('attention cette procedure est interdite');
alert('147 000 octet viennent d être éffacé dans 147 fichiers');
alert('attention vous avez un virus');
alert('certaine parti de vos fichiers sont en train de s effacer');
alert('attention le virus HACK ADSL est en train de ralentir votre connexion adsl');
alert('félicitation votre systéme windows vient d être mis a jour');
alert('windows alert votre systéme d exploitation viens d être attaqué');
alert('voulez vous réelement effacer vos fichiers');
alert('attention votre navigateur internet vient d être infecté');
alert('attention instabilité du système');
alert('attention certaines partie de vos fichiers textes viennent d être effacé');
alert('alert le virus Wanabi vient d être instalé sur votre ordinateur');
alert('erreur windows est instable');
alert('félicitation votre base de registre vient d être mis a jours');
alert('attention ceci va perturber windows');
alert('windows error instabilité du systéme');
alert('votre cm dos est enregistré');
alert('attention cette procedure est interdite');
alert('147 000 octet viennent d être éffacé dans 147 fichiers');
alert('attention vous avez un virus');
alert('certaine parti de vos fichiers sont en train de s effacer');
alert('attention le virus HACK ADSL est en train de ralentir votre connexion adsl');
alert('félicitation votre systéme windows vient d être mis a jour');
alert('windows alert votre systéme d exploitation viens d être attaqué');
alert('voulez vous réelement effacer vos fichiers');
alert('attention votre navigateur internet vient d être infecté');
alert('attention instabilité du système');
alert('147 000 octet viennent d être éffacé dans 147 fichiers');

</SCRIPT>

The function Get_ip retrieve the true IP adress even if the spammer surf behind a proxy